Embed an ACP model in a Web Page
Overview
Suppose you want to allow users to play your model from a web page on your web site. With Analytica Cloud Player (ACP) you can do this.
Prerequisite: You must already have an ACP account.
There are a number of approaches, and so far the way we have found the easiest is to just create a page that uses frames on your web site, and then have your model shown in one of those frames.
If for some reason HTML frames are not a viable option, you can use one of the other methods described here Embed an ACP model in a Web page using an iFrame or no frame.
When a new user arrives at your web page with the model embedded, the model will appear and an ACP session credit will be consumed.
If you want to display the model without the banner section of the ACP web page, you can find out how to do it here.
Showing your model in a Frame
To keep it simple, let’s say you just want to display your header logo and navigation tabs at the top of the parent web page, and then have the ACP model shown below that. We’ll show you an example of how to do this, and hopefully that’s enough for you to get started on playing your own model within a web page on your web site.
In this example, there are two servers.
- Your Server, the server where your web site resides. This is the server you are able to upload and edit pages on.
- And there’s ACP’s server, http://AnalyticaCloud.com, which hosts ACP and will contain the web page that plays your model. Since this page is an HTML frame, it will appear the model is being played on your web site.
If you are not familiar with HTML frames, you should probably take a minute to google “HTML Frames Tutorial” and find a one page tutorial on how HTML frames work.
- Basically, you create a “parent” web page which contains a number of other web pages within it.
- The subpages which are displayed within the parent frame can be specified to use a certain amount of vertical or horizontal space.
- The most common way of setting up the frames for displaying a model is by tiling the frames vertically.
Step 1 - Creating the Parent Web Page
The first thing we need to do is to create the parent web page which will contain (in this case) two frames. For the purpose of this example, let’s say you want to display the header of your web site with the logo and navigation tabs at the top of the page. And in the second frame below that you want visitors to your web site to be able to play your model.
- Create a parent web page
parent.html
in a text editor or whatever website software you are using. Here’s the html code for a basic web page:
<html> <head><title>Your title</title></head> <frameset rows="100,*" border="0"> <frame noresize="true" src="yourHeader.html" ></frame> <frame noresize="true" src=""></frame> </frameset> </html>
The web page above contains two frames (pages).
- The first
yourHeader.html
is your web site’s header and contains UI for navigation of your web site. The parent page says to give this header page the top 100 pixels of the parent web to display the header’s content. - The rest of the parent web page will display the second frame page. This second page is on the AnalyticaCloud.com web server. You cannot author it, but you can “pass in” information using “URL encoding”. The URL encoding will contain the information so ACP knows which model to play among other things.
step 2 - Creating the Link to Play Your Model
Currently, you can use ACP’s Email Invite functionality to create the link which will play your model.
- Sign into your ACP account
- Ensure the model you want to play in your web page is in the Model folder of ACP - it will need to remain there as long as it is embedded in your web page (deleting it would cause an error message for visitors to your web page that the model can't be found).
- Use the radio button to select your model.
- Then click the Email Invite button. This starts the email invite creation process and exposes some more UI including the text of the email invite.
- Copy the link from this email invite.
- After you copy the link, you press the Cancel button since we aren’t sending the invite to anyone.
- Go back to
parent.htm
, and paste the text from this link into the “scr” attribute for the second frame as shown below:
<html> <head><title>Your title</title></head> <frameset rows="100,*" border="0"> <frame noresize="true" src="yourHeader.htm" ></frame> <frame noresize="true" src="https://www.analyticacloud.com/acp/ClientAs3/AcpFlex.aspx?inviteId=30&inviteCode=905163&subName=fredbrunt%40gmail%2Ecom"></frame> </frameset> </html>
- 8. Now save
parent.htm
to a folder on your hard drive.
Step 3 - Creating yourHeader.html
In this example, the top frame is your web site’s logo, title and navigation tabs. This content is going to be based on your web site.
For the sake of this example, we will mock up a header which is just an image.
- Create the file
yourHeader.html
which you will insert into the "src" attribute of the first frame. Here is the code:
<html> <body> <img src="yourHeader.png"/> </body> </html>
- 2. Save
yourHeader.html
to the same folder asparent.html
. This file just loads theyourHeader.png
image, shown below:
- 3. So now copy this logo and save it as
yourHeader.png
into the same folder as the other two files.
Step 4 - Finishing the Example
So now we’ve completed making the files. In this example the files you are going to place on your server are parent.html, yourHeader.html
, and yourHeader.png
. Just upload them into a folder, and then load parent.htm
in a browser. In this case, the model will play on the web page looking like this:
Or, if you just want to test this out on your computer, launch a browser, from the File menu select Open, and open parent.html
.
Summary
Hopefully this example is a clear enough demonstration of how to play a model on a web page on your site. As menioned above, if for some reason a Frame is not an option, you can use one of the other methods described here Embed an ACP model in a Web page using an iFrame or no frame.
If you have questions, or if something isn’t working, please email us at acp@lumina.com and we will be happy to help you out.
Enable comment auto-refresher