This guide describes measuring video on Android using milestone video measurement.
Note: Adobe has a new video measurement solution called video heartbeat. During video playback, frequent "heartbeat" calls are sent to this service to measure time played. These heartbeat calls are sent every 10 seconds , which results in granular video engagement metrics and more accurate video fallout reports. See Measuring Video in Adobe Analytics using Video Heartbeat for details.
Additional information on milestone video measurement is available in the Measuring Video in Analytics guide. The general process to measure video is very similar across all platforms. This quick start section provides a basic overview of the developer tasks along with code samples.
Map Player Events to Analytics Variables
The following table lists the media data that is sent to Analytics. Use processing rules to map the context data in the Context Data Variable column to an Analytics variable as described in the Variable Type column.
Description Variable Type
Context Data Variable
(Required) Collects the name of the video, as specified in the implementation, when a visitor views the video in some way.You can add classifications for this variable.
eVar
Default expiration: Visit Custom Insight (s.prop, used for video pathing)
a.media.name
35 Analytics
Description Variable Type
Context Data Variable
(Optional) The Custom Insight variable provides video pathing information.
(Optional) Provides video pathing information. Pathing must be enabled for this variable by ClientCare.
Custom Insight (s.prop) a.media.name
Event type: Custom Insight (s.prop)
(Required) Collects video segment data, including the segment name and the order in which the segment occurs in the video. eVar
Default expiration: Page view a.media.segment
This variable is populated by enabling the
segmentByMilestones variable when tracking player events automatically, or by setting a custom segment name when tracking player events manually.
For example, when a visitor views the first segment in a video, SiteCatalyst might collect the following in the Segments eVar:
1:M:0-25
The default video data collection method collects data at the following points: video start (play), segment begin, and video end (stop). Analytics counts the first segment view at the start of the segment, when the visitor starts watching. Subsequent segment views as the segment begins.
Collects data about the type of content viewed by a visitor. Hits sent by video measurement are assigned a content type of "video". eVar
Default expiration: Page view a.contentType
This variable does not need to be reserved exclusively for video tracking. Having other content report content type using this same variable lets you analyze the distribution of visitors across the different types of content. For example, you could tag other content types using values such as “article" or “product page" using this variable.
From a video measurement perspective, Content Type lets you identify video visitors and thereby calculate video conversion rates.
Counts the time, in seconds, spent watching a video since the last data collection process (image request).
Event
Type: Counter a.media.timePlayed
Indicates that a visitor has viewed some portion of a video. However, it does not provide any information about how much, or what part, of a video the visitor viewed.
Event
Type: Counter a.media.view
36 Analytics
Description Variable Type
Context Data Variable
Indicates that a visitor has viewed some portion of a video segment. However, it does not provide any information about how much, or what part, of a video the visitor viewed. Event
Type: Counter a.media.segmentView
Indicates that a user has viewed a complete video. By default, the complete event is measured 1 second before the end of the video.
Event
Type: Counter a .media.complete
During implementation, you can specify how many seconds from the end of the video you would like to consider a view complete. For live video and other streams that don't have a defined end, you can specify a custom point to measure completes. For example, after a specific time viewed.
Configure Media Settings
Configure a MediaSettings object with the settings you want to use to track video:
MediaSettings mySettings = Media.settingsWith("name", 10, "playerName", "playerId");
Track Player Events
To measure video playback, The mediaPlay, mediaStop, and mediaClose methods need to be called at the appropriate times.
For example, when the player is paused, mediaStop. mediaPlay is called when playback starts or is resumed.
Classes
Class: MediaSettings public String name; public String playerName; public String playerID; public double length; public String channel; public String milestones; public String offsetMilestones; public boolean segmentByMilestones; public boolean segmentByOffsetMilestones; public int trackSeconds = 0;
public int completeCloseOffsetThreshold = 1; // MediaAnalytics Ad settings
public String parentName; public String parentPod; public String CPM;
public double parentPodPosition; public boolean isMediaAd;
Class: MediaState
public Date openTime = new Date(); public String name;
public String segment; public String playerName; public String mediaEvent; public int offsetMilestone; public int segmentNum;
37 Analytics
public int milestone; public double length; public double offset; public double percent; public double timePlayed; public double segmentLength; public boolean complete = false; public boolean clicked = false; public boolean ad;
public boolean eventFirstTime;
Media Measurement Class and Method Reference
Description Method
Returns a MediaSettings object with specified parameters. settingsWith
Syntax:
public static MediaSettings adSettingsWith(String name, double length, String playerName, String parentName, String parentPod, double
parentPodPosition, String CPM); Example:
MediaSettings mySettings = Media.settingsWith("name", 10, "playerName", "playerId");
Returns a MediaSettings object for use with tracking an ad video. adSettingsWith
Syntax:
public static MediaSettings adSettingsWith(String name, double length, String playerName, String parentName, String parentPod, double
parentPodPosition, String CPM); Example:
Opens a MediaSettings object for tracking.
open
Syntax:
public static void open(MediaSettings settings, MediaCallback callback); Example:
Media.open(mySettings, new Media.MediaCallback() { @Override
public void call(Object item) {
// monitor callback if you want to be notified every second the media is playing
} });
Closes the media item named name. close
Syntax:
public static void close(String name); Example:
Media.close("name");
38 Analytics
Description Method
Plays the media item named name at the given offset (in seconds). play
Syntax:
public static void play(String name, double offset); Example:
Manually mark the media item as complete at the offset provided (in seconds). complete
Syntax:
public static void complete(String name, double offset); Example:
Media.complete("name", 0);
Notifies the media module that the video has been stopped or paused at the given offset. stop
Syntax:
public static void stop(String name, double offset); Example:
Media.stop("name", 0);
Notifies the media module that the media item has been clicked. click
Syntax:
public static void click(String name, double offset); Example:
Media.click("name", 0);
Sends a track action call (no page view) for the current media state. track
Syntax:
public static void track(String name, Map<String, Object> data); Example:
Media.track("name", null);