How to integrate your players with Google Analytics, using a plug-in SWF.
This topic describes how to integrate your players with Google Analytics. With Google's Flash Tracking feature, you can track your players anywhere they are published without relying on in-page JavaScript code. Read this Google documentation for an introduction to Google Flash Tracking.
If you are familiar with ActionScript and would like to customize the Google Analytics Integration, you can read the more advanced topic for developers: Google Analytics Integration for Developers.
The main steps in this integration are:
This topic includes information on:
Let's get started!
The first step in your Google Analytics integration is to open a Google Analytics account. This is free.
Once you have created and signed into your Google Analytics account, create a web site profile. The web site profile is Google's name for a view into your reports. It can be pretty powerful as you can create multiple profiles for the same web site (or player) in order to filter and slice your data in various ways.
If you already have a Profile in Google Analytics created for your web site to track page views, we highly recommend that you create a new Profile for the same web site that you will use for tracking Video Cloud data only. If you don't, you may overwrite other web site data that you're trying to track. You can read more about Profiles in the Google Analytics Help documentation.
To create a profile:
Once you have created your profile, Google Analytics presents some tracking code and your alphanumeric Google account ID, which looks something like the following: "AA-123456-A".
You won't need the JavaScript tracking code to take advantage of Google Analytics' Flash Tracking capabilities. However, you will need your Google Account ID. Save this ID somewhere you'll need it later when configuring your players to send events to Google Analytics.
You can download the Google Analytics SWF as a .zip file. This sample file fires the PLAYER LOAD, MediaEvent.BEGIN, and MediaEvent.COMPLETE events to Google Analytics. For more information on these events, read Player API MediaEvents Help. You can extend the Google Analytics SWF to fire more events if you are familiar with ActionScript. See the topic, Google Analytics SWF Integration for Developers for information about how to do this.
As an alternative, you can download, unzip, and use an open source Google Analytics SWF available in Open Source @ Brightcove. You can download it here.
For player load events that are sent to Google, the following details are tracked:
For media begin and media complete events that are sent to Google, the following details are tracked:
For example, if your player is loaded, the event you will see in the Google Analytics report looks like the following:
http://mysite.com/playerid=12345/playername=My First Player/url=http://mysite.com/video/refurl=http://someothersite.com/player_load
For a Media Begin event when a video playback is started, the URL in the Google report would look like the following:
http://mysite.com/playerid=12345/playername=My First Player/playlistid=67890/videoid=32145/videoname=My First Video Eva/video_start
Once you've downloaded the Google Analytics SWF, you need to make it available in your players. To use the Google Analytics SWF, you need to:
Once your player has been published and is firing Google events, it can take up to 24 hours for your events to appear in Google reports.
Once your player have been set up to fire data to Google as outlined in the steps above, you can view your video data in Google Analytics reports. To do so:
Make sure your crossdomain.xml file is set up properly. The crossdomain.xml file is a file that lives on your domain (the same domain where you are hosting the Google Analytics SWF) that contains a list of trusted third-party domains. You may have to contact your webmaster in order to make this modification. Your site must allow the Flash player to access data from the Brightcove and Google domains. The simplest crossdomain.xml file that allows only these two domains would look like the following:
<cross-domain-policy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://www.adobe.com/xml/schemas/PolicyFile.xsd">
<allow-access-from domain="*.brightcove.com"/>
<allow-access-from domain="*.google-analytics.com"/>
</cross-domain-policy>
If you're unsure how to modify this file as described here, please consult your webmaster. For more information, read Cross-Domain Security.
Note the following limitations and other information about using Google Analytics: