Integration with Google Analytics

Applies to Roles
Publisher
Version
Brightcove 4
Modules
Edition
Express, Pro, Enterprise

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:

  1. Creating a Google Analytics account.
  2. Setting up your web site profile so that it is ready to accept information from your players.
  3. Download our out-of-the-box Analytics SWF to enable your players to send information about player events, such as player load and video start & complete, to your Google Analytics account.
  4. Once the SWF is uploaded to your web server, you can configure your players to use the SWF by editing them in the Publishing module and entering the location of your Analytics SWF on your web site.

Let's get started!

Creating a Google Analytics Account

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:

  1. Click the "Add Website Profile" link.
  2. In the "Add a Profile for a new domain" field, enter the URL to your player, not including the actual HTML file name.
  3. Edit the timezone settings for the profile, if you like, and save.

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.

Using the Google Analytics SWF

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:

  1. Unzip the download and host the SWF at a URL where it is accessible to your players.
  2. Set your players to use the Google Analytics SWF. You can do this by editing your player settings in the Publishing module and adding the URL of the Analytics SWF in the Plug-Ins tab. You will need to pass in your Google ID using the 'gid' parameter in the Analytics SWF URL you enter for your player. So, for example, you should set your Analytics SWF URL as:
    http://mysite.com/analytics.swf?gid=AA-123456-A
  3. [Optional] Enable ActionScript/JavaScript APIs for your players that use the Analytics SWF in the Edit Settings dialog of the Publishing module. If you choose not to enable APIs for your players, the sample integration code will still work.

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.

Viewing Brightcove Data in Google Analytics

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:

  1. Sign in to your Google Analytics account.
  2. In the left sidebar menu, click to view your Content report and then select 'Top Content' from the submenu.
  3. Select the appropriate time period for your report and observe that the Brightcove events are tracked as 'virtual' page views in the displayed report.
  4. If you want to search the reports for a specific Brightcove Video or Player, use the 'Find Page' search box at the bottom of the page or download the entire report in the format of your choice to search/filter the data.

Configuring your crossdomain.xml

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.

Notes and Limitations

Note the following limitations and other information about using Google Analytics:

  • You can set the path to the Web Analytics SWF in each player, or in a custom player template, but you cannot set it at the account level for all of your players.
  • Google Analytics has a pageview limit. Google Analytics is a free service that offers users up to 5 million pageviews a month. If your site generates more than 5 million pageviews per month, you will need to link it to an active AdWords account in order to avoid interruption of your Google Analytics service. Google Analytics currently defines an active AdWords account as an AdWords account that has at least one active and running Campaign, with a minimum budget of $1 per day (or the equivalent amount in a non-U.S. currency).
  • Google recommends against disabling persistent tracking cookies set by Google Analytics. If you do so, you will lose data in several reports including but not limited to, New Vs. Returning, Visitor Loyalty, and everything under Traffic Sources. If you need to disable all cookies on your site, follow the instructions on the Google Analytics web site for information about how to do so.

 

Tags
Google Analytics, utility SWF