Skip to content

Google Analytics: Universal Analytics plugin

This plugin allows you to track your media content in Google Analytics. It supports VOD, live streams, and ads tracking. The plugin uses Google Analytics event tracking to record a number of different playback related events.

Warning

Google is deprecating the Universal Analytics property on July 1, 2023. While you can still use this Wowza Flowplayer plugin, it will also be deprecated on October 1, 2023. See our Google Analytics 4 plugin for updated functionality.

Prerequisites

The Wowza Flowplayer Advertising plugin is required if you want to measure ads.

Installation

  1. Load the plugin and the library from Google next to the core player along with any other plugins (ads) you require.

  2. Add the Google Analytics analytics.js file on the same page as the player to make the plugin work.

<!-- Google Analytics -->
<script async src='//www.google-analytics.com/analytics.js'></script>
<script src="//cdn.flowplayer.com/releases/native/3/stable/flowplayer.min.js"></script>
<script src="//cdn.flowplayer.com/releases/native/3/stable/plugins/google-analytics.min.js"></script>

Configuration (mandatory)

Configure the plugin with top level configuration option ga.

The following properties are available:

Example of top level configuration:

ga: {
  ga_instances: ["UA-XXXXXX-X"],
  media_title: "[media_name]",
  event_categories: {live: "my_live_label"},
  event_actions: { live_start: "my_live_start_label"},
  custom_data: { dimension0: "my dimension value", metric0: "my metric value"}
}

Default labels

There are default labels for each event category and event action.

Replace default labels

It's possible to override the default labels for the event categories and event actions by specifying the event action/category in the config. For example: video_player_load: "my_custom_load_action".

Notice that when replacing the default labels, all events that you want to track must be specified in the config, including event actions were you don't want to change the label.

Ad positions

If you want information on the position of your ad, like whether it's the first, second, or third preroll you're sending, use the replace default labels. Make sure that you include [x] in your custom ad_start_preroll.

For example, use ad_start_preroll_[x]. Then, the plugin will ensure that the [x] is replaced so the ad_start_sequence is ad_start_preroll_1, ad_start_preroll_2, etc. This is only applicable for the ad_start-events, but also includes ad_start_midroll and ad_start_postroll, with separate counters for all three events.

Tracking a subset of events

It's possible to track only a subset of the events that are available in this plugin. Just add the event that should be tracked to the config and the plugin will only track those events.

Example that only tracks different start and complete events:

ga: {
  ga_instances: ["UA-XXXXXX-1"],
  event_actions: {
    video_start: "video_start",
    video_complete: "video_complete",
    live_start: "live_start",
    ad_start_preroll: "ad_start",
    ad_start_midroll: "ad_start",
    ad_start_postroll: "ad_start"
  }
}

Demo

Codepen