Flash Measurement Implementation

For video and other flash content such as widgets, the first step is to tag your main site (see Web Measurement Implementation Guide). Be sure to create a network on the quantcast.com. This serves as a hub to show distribution of your video, widget, and other asset distribution across the Internet.

Your Flash video player, widget or other asset uses our ActionScript API to call our measurement server and measure Flash activity by each of your users. For video, the minimum requirement is that you communicate your Quantcast account (identified as the 'qacct' value in your Quantcast JavaScript tag), a video identifier, the type of asset, title and a play event to our measurement servers. However, the API supports many more measurements and you’ll want to consider at least some of these to get the most value from the powerful measurement capabilities. For example, you can include the embed location of the video/widget (useful for understanding your distribution profile) or use our ‘labels’ option to create arbitrary audience segments across all of your content (e.g. answering ‘what is the total audience for my horror movies?’). For more information on this topic, please view the Audience Segment Implementation Guide.

The API comes in the form of an AS3 class, Quantcast.as. The API makes various calls that communicate key usage information Quantcast.

The Flash API includes a VideoTracker class you can use to track FLV playback objects. It is also a useful guideline for integrating your own player with our Flash Tracking API. The first step is to obtain a copy of our ActionScript API code here.

Examples of Use

The following demonstrates the most basic implementation of the API:

var options:Object = {
    publisherId:"p-abcde12345", // This is the 'qacct' value from the JavaScript tag
    title:"Sample Widget",
var qc = new Quantcast(options,this);

// ...after initial content buffering...

Double click the code above to select it.


Event Reference

Event Type Description API Call
Embedded The embedded event is generated when the Quantcast object is first created. This event triggers automatically, even if the content is not yet interactive. E.g., you should construct the Quantcast object when the Flash content is first received so we can count an impression, then call played on it so we can measure the played event separately.
Options can specify any of the standard data parameters used to tag videos.
new Quantcast(options:Object,
rootMC: Sprite);
Played The played event flags that content is being displayed on the user. It should be triggered after the flash content has been loaded.
Options aren’t typically required, but can be used to override or include any additional options that weren’t known when the Quantcast object was created.


Optional Field Reference

These data fields are provided to the Quantcast API through the options associative array. This is defined initially in the construction of the Quantcast measurement object, and additional or overriding values may be provided in subsequent event calls. The following fields are supported:

Data Item Priority Description
publisherId Required Contains your Quantcast puslisher identifier. It must match the ID used on your site. Your publisherId is obtained by logging into your Quantcast account, clicking the ‘Generate Tag’ button in the ‘Home’ area of your account, and taking the ‘qacct’ value from the JavaScript tag. This value always begins with ‘p-‘
media Required Valid options are “video”, “widget”, “music”, “game”, “advertisement”, “apl”, and “other”.
title Required A human readable title for the video or other media item. Titles are displayed in your Quantcast profile for each unique video.
videoId Required Contains a unique identifier you assign to the video. It is often an internal generated value, but it may be the same as title. Please avoid having two videos with the same title, but different videoId’s
labels Recommended Labels allow you to create audience segments from your content (see Audience Segment Labels Guide). Labels must be URL encoded, so for instance a period would be %2e, a comma %2c, and a space %20.
videoUrl Optional URL of the Flash swf that is being viewed. This should be a location at which the Flash content can be viewed (e.g., by typing it into a browser). Normally this information is automatically detected and does not need to be passed.
embedUrl Optional URL of the containing page that embeds the flash that is being viewed. Normally this information is automatically detected when there is permission to execute JavaScript from the Flash system, and if not it will simply not track that. This parameter should only be used if the Flash content has more accurate data about where it is embedded.
allowTrace Optional Boolean value used to decide whether or not to display trace calls made by the Quantcast Flash API. Setting this to true is helpful for debugging while developing, but should be omitted or set to false on production implementations.