OneStat

Free customer support included.

We provide free customer support and will try to answer your questions to the best of our ability.

E. Tracking Flash websites


For tracking of flash sites you need to implement a specific OneStat script. This section of the manual describes how to do this.

To measure flash with OneStat.com you have to implement a specific flash script. By using the OneStat.com flash script you are able to measure individual flash movies and flash pages. This manual describes the procedure to implement the OneStat flash script.

Requirements:
The OneStat.com flash script code works only for Flash Versions 6 and 7. Flash 5 is not supported.

OneStat can be accessed from Macromedia Flash files v6 and up using the following files:

- onestat.as (click here to download the zip file)
- onestat flash sample.html

A. How to implement the flash script

- Place the above files onestat.as and "onestat flash sample.html" in the same directory as your flash file. Add the following line of code to your main flash file:

#include "onestat.as"

onestat.as creates an object at the _global level. The object is called "OneStat" and contains all OneStat variables.

- Enter your OneStat account ID in onestat.as
To register pageviews on your account you have to modify the code line:

onestat.sid="XXXXXX";

to contain your OneStat account ID. Replace the XXXXXX with your account ID i.e. 223677. If you don't know your account ID, refer to the application email you received when applying for your OneStat account.

- Call the OneStat object in your flash code
The OneStat object is created by calling:

onestat.oneStatLoad();

This function creates the OneStat object, initializes variables including title, URL and referrer from the browser (via a javascript/fscommand call). You only need to call this function once within the scope of your application. After the object is created, you can register a pageview anywhere in your application by calling:

onestat.oneStatPageview();

The onestatPageView function registers a pageview based on the contents of the onestat object.

The proper strategy for using this function is changing the available variables such as osp_URL, osp_Title, CONTENTSECTION, PRODUCTCODE etc. and then calling onestatPageview().

For example, if you load a new movie into _level0, the new movie referenced as "About Us" should include the following code:

onestat.URL = "About Us";
onestat.oneStatPageview();

Keep in mind that every time the play head passes the frame with the included code, a pageview will be registered. The function can also be called within click event handlers, scenes, etc.

An alternative strategy is to implement listeners which call the function as needed. By using listeners you can check if a (sub) file is completely loaded before registering a pageview.

1. Modify the onestat flash sample html file
When displaying your flash file in a browser, you must use the included "onestat flash sample.html". Replace all instances of "myFlash" in this file with the name of your Flash (swf) file. This file is needed for forwarding referrer information to the OneStat object. The referrer information is used to detect search engine information, search engine phrases and basic referrer info from the visitors of the site.

B. Variables of the OneStat object.

The following variables can be set. Please refer to the OneStat manual for more explanation about the OneStat script variables and using the OneStat Commerce module.

osp_Url (required)

The url registered for this flash movie. You can freely select a url i.e.  “Homepage”, “About”, “News”. URLs must be unique for each flash section you want to measure.  When 2 flash sections use the same url the pageviews are added to each other.

osp_Title

The title of the flash section. You can freely select a title i.e.   “Home”, “Latest News”. It is not required to select a unique title for each flash section.

osp_ACTION

The e-Commerce Action (optional)

osp_TRANSACTION

The e-Commerce Transaction (optional)

osp_AMOUNT

The e-Commerce order amount (optional)

osp_PRODUCTCODE

The e-Commerce product code (optional)

osp_PRODUCTGROUP

The e-Commerce product group (optional)

osp_ADCAMPAIGN

The e-Commerce ad campaign (optional)