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
- Load the plugin and the library from Google next to the core player along with any other plugins (ads) you require.
- 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:
Property | Type | Description |
---|---|---|
data_layer_tracking |
boolean | Set to true to use the dataLayer object when tracking events. |
ga_instances |
string | Add the Google Analytics tag IDs to track in this array. Required when using the gtag.js approach to set up Google Analytics. If not provided, the plugin pushes events to the dataLayer object. |
event_categories |
string | Use to optionally replace default category names with custom values. If not set, the default values (live or videos) are detected by the player. Sent to Google Analytics as event_category . |
event_actions |
string | Use to optionally replace default action names with custom values. Sent to Google Analytics as event_action . |
custom_data |
string | Add optional data or custom event parameters to be set and used on all existing events. |
Info
-
The video title is used by default to send the
event_label
to Google Analytics. - If the plugin pushes events to the dataLayer object , additional configuration may be required in Google Tag Manager.
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.
Event categories
Categories group objects that you want to analyze. In this case, they can help distinguish between live and video-on-demand events as you aggregate metrics. See the following table for the different event categories and their default values.
Event category | Default value |
---|---|
live: |
"Live" |
videos: |
"Videos" |
Event actions
Event actions help you define event types or interactions that you plan to measure for a particular web object. See the following table for the different event actions and their default values.
info
Preroll ads display before a feature clip or live stream begins. On the other hand, postroll advertisements are shown after the media ends. Ads occurring between preroll and postroll advertisements are considered midroll events.
Event actions | Default value | Description |
---|---|---|
ad_break_completed |
"ad_break_completed" | Emitted after all ads of a preroll, midroll, or postroll are complete, regardless of the ad roll type. |
ad_completed_preroll |
"ad_completed_preroll" | Emitted when each preroll ad is complete. |
ad_completed_midroll |
"ad_completed_midroll" | Emitted when each midroll ad is complete. |
ad_completed_postroll |
"ad_completed_postroll" | Emitted when each postroll ad is complete. |
ad_skipped_preroll |
"ad_skipped_preroll" | Emitted when each preroll ad is skipped. |
ad_skipped_midroll |
"ad_skipped_midroll" | Emitted when each midroll ad is skipped. |
ad_skipped_postroll |
"ad_skipped_postroll" | Emitted when each postroll ad is skipped. |
ad_start_preroll |
"ad_start_preroll" | Emitted when each preroll ad starts. |
ad_start_midroll |
"ad_start_midroll" | Emitted when each midroll ad starts. |
ad_start_postroll |
"ad_start_postroll" | Emitted when each postroll ad starts. |
fullscreen_enter |
"fullscreen_enter" | Emitted when the player goes fullscreen. |
fullscreen_exit |
"fullscreen_exit" | Emitted when the player exits fullscreen mode. |
live_click_play |
"live_click_play" | Emitted when the user clicks to start live stream playback. |
live_complete |
"live_complete" | Emitted when playback for a live stream is complete. |
live_mute |
"live_mute" | Emitted when a live stream is muted. |
live_pause |
"live_pause" | Emitted when a live stream is paused. |
live_resume |
"live_resume" | Emitted when a live stream resumes after a pause. |
live_start |
"live_start" | Emitted when a live stream is initially started. |
live_unmute |
"live_unmute" | Emitted when a live stream is unmuted. |
video_25_percent |
"video_25_percent" | Emitted when a VOD stream is 25 percent complete. |
video_50_percent |
"video_50_percent" | Emitted when a VOD stream is 50 percent complete. |
video_75_percent |
"video_75_percent" | Emitted when a VOD stream is 75 percent complete. |
video_click_play |
"video_click_play" | Emitted when the user clicks to start VOD stream playback. |
video_complete |
"video_complete" | Emitted when playback for a VOD stream is complete. |
video_mute |
"video_mute" | Emitted when a VOD stream is muted. |
video_pause |
"video_pause" | Emitted when a VOD stream is paused. |
video_player_load |
"video_player_load" | Emitted when the player initially loads. |
video_resume |
"video_resume" | Emitted when a VOD stream resumes after a pause. |
video_start |
"video_start" | Emitted when a VOD stream is initially started. |
video_unmute |
"video_unmute" | Emitted when a VOD stream is unmuted. |
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"
}
}