Integration with Google Analytics

Product
Video Cloud
Applies to Roles
Publisher
Version
Brightcove 5
Edition
All

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:

  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, video start, and video 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.

This topic includes information on:

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.

Using an existing Google Analytics account

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:

  1. Click Add Website Profile.
  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. Optionally, edit the timezone settings for the profile, and save the file.

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.

Using the Google Analytics SWF

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:

  • Player ID
  • Player Name
  • Player URL (the URL location where the viewer loaded the player)
  • Referring URL (the page the viewer was looking at before opening the Video Cloud 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
  • 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 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:

  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 file 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 and is firing Google events, it can take up to 24 hours for your events to appear in Google reports.

Viewing Video Cloud 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 Video Cloud events are tracked as 'virtual' page views in the displayed report.
  4. If you want to search the reports for a specific Video Cloud 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 file

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.

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.
  • Since the analytics plug-in is a SWF, it works only in a Video Cloud Flash player and will not load in a smart player in HTML5 mode.
  • Google Analytics has a page view limit. Google Analytics is a free service that offers users up to 5 million page views a month. If your site generates more than 5 million page views 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