In this topic you will learn how to integrate the Quantcast analytics service into your Video Cloud players. By integrating Quantcast into your players, you will receive detailed analytics information about the reach and engagement of your content as it relates to your audience.
Note: The steps outlined in this topic are for Flash based players only.
Leveraging Quantcast in your Video Cloud players is as simple as setting some configuration parameters and dropping the Quantcast module into the Video Cloud players that you want 'quantified'.
This article provides information on how to use the Quantcast analytics SWF as well as how it was implemented. You can download the source to this analytics SWF and modify it to meet your business requirements.
The following events are tracked in Quantcast:
For each of these events, the following information is tracked:
Follow these steps in order to use the Quantcast analytics SWF:
<allow-access-from domain="admin.brightcove.com" />
You may have to contact your webmaster in order to make this modification. The crossdomain.xml file is a file that lives on your domain that contains a list of trusted third party domains. If you're unsure how to modify this file as described here, please consult your webmaster. For more information and sample crossdomain files, read Cross-Domain Security
http://mysite.com/QuantcastAnalyticsModule.swf?qacct=AA-123456-A
This section lists additional configuration you can make to the Quantcast Analytics SWF to enable you to customize the data that is tracked for each event fired into Quantcast.
You can customize the following options that are sent to Quantcast:
quantcastLabels query parameter when referencing the SWF to the value you want. For example, to set your label to sport, reference the SWF as follows:http://mysite.com/QuantcastAnalyticsModule.swf?qacct=AA-1234-A&quantcastLabels=sport
http://mysite.com/QuantcastAnalyticsModule.swf?qacct=AA-1234-A&quantcastMeta=bar
You can download and examine the source for the Quantcast Analytics SWF. You can modify this source to customize the way that events are tracked into your Quantcast account. This zip file contains all required libraries and source files. Here is a summary of how this project was constructed:
We take advantage of the Player API SWC by enabling the document class to extend the com.brightcove.api.CustomModule class. By extending this class, you just need to define the initialize() function which will be called automatically when the Brightcove player has been created, initialized and is ready to be interacted with.
In the initialize() method, we capture references to the VideoPlayerModule and ExperienceModule. These references are stored on class instance variables. Additionally, a Quantcast object is constructed (which, as a side effect, will track an impression event). Finally, event handlers are attached to the VideoPlayerModule to handle all of the events from the VideoPlayer that we care about. Here is what the complete initialize() method looks like:
override protected function initialize():void {
// grab a reference to our player module event
_experienceModule = player.getModule(APIModules.EXPERIENCE) as ExperienceModule;
_videoPlayerModule = player.getModule(APIModules.VIDEO_PLAYER) as VideoPlayerModule;
_contentModule = player.getModule(APIModules.CONTENT) as ContentModule;
// track our 'impression' event
_qc = new Quantcast(defaultQuantcastOptions(), this);
// register our event listeners that we can map to Quantcast events
_videoPlayerModule.addEventListener(MediaEvent.BEGIN, onBegin);
_videoPlayerModule.addEventListener(MediaEvent.PROGRESS, onProgress);
_videoPlayerModule.addEventListener(MediaEvent.STOP, onStop);
_videoPlayerModule.addEventListener(MediaEvent.PLAY, onPlay);
_videoPlayerModule.addEventListener(MediaEvent.SEEK, onSeek);
_videoPlayerModule.addEventListener(MediaEvent.COMPLETE, onComplete);
_videoPlayerModule.addEventListener(MediaEvent.CHANGE, onMediaChange);
}
Tracking events in Quantcast is just a matter of calling the appropriate function on the Quantcast object that was created in our initialize() function. From the example above, you can see that the Quantcast object is assigned to a class instance variable named _qc. Here are examples of calling the appropriate methods on the Quantcast object from the various event handlers on the VideoPlayerModule:
internal function onBegin(evt:MediaEvent):void { _lastBeginEvent = new Date().getTime(); _qc.played(quantcastOptionsWithMediaInfo(evt)); } internal function onProgress(evt:MediaEvent):void { _qc.progress(quantcastOptionsWithMediaAndTimeInfo(evt)); } internal function onStop(evt:MediaEvent):void { _pauseCalled = true; _qc.paused(quantcastOptionsWithMediaInfo(evt)); }
Post new comment
Comments