If you are familiar with ActionScript and would like to customize the Google Analytics Integration, please proceed to our more advanced topic for developers: Google Analytics Integration for Developers.
This topic describes how to integrate your players with Google Analytics. With Google's newly-released Flash Tracking feature, you can track your players anywhere they are published without relying on in-page JavaScript code. This Google documentation introduces Google's Flash Tracking.
The main steps in this integration are:
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.
Even if you already have a Profile in Google Analytics created for your website to track page views, we highly recommend you create a new Profile for the same website that will be used for tracking Brightcove data only. You can read more about profiles in Google Analytic's Help documentation.
To create a profile:
Once your profile is created, Google Analytics presents some tracking code and your alphanumeric Google account ID, which looks something like this: "AA-123456-A".
You won't need the JavaScript tracking code to take advantage of Google Analytic's 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, media BEGIN, and media COMPLETE events to Google Analytics. For more information on these events, please see the Player API MediaEvents Help Documentation. You can extend it to fire more events if you are familiar with ActionScript. See our Google Analytics SWF article for Developers.
For player load events that are sent to Google, the following details are tracked: Player ID, Player Name, Player URL (the URL location where the viewer loaded the player), and the Referring URL (the page the viewer was looking at before launching the Brightcove player).
For media begin and media complete events that are sent to Google, the following details are tracked: Player ID, Player Name, Playlist ID, Video ID, Video Name, and the type of event (for example, Begin or Complete).
For example, if your player is loaded, the event you will see in the Google Analytics report will look like:
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:
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 tracking 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 with the Google tracking code, 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 this:
<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: