Application collectors
Chromecast Receiver Media Player
v2.20.0 • For the Javascript Collector
The Chromecast Receiver Media Player Extension is a configuration option for the Javascript Collector by Datazoom that makes the following additional data points automatically collectable in real time.
Integration Instructions
Data collected by our Chromecast Collector will appear in its own app session. For example, if you are viewing video on a web browser configured with one of our javascript Collectors and you then cast to a Chromecast web receiver that is instrumented with our Chromecast Collector, data from that viewer will be split into two app sessions, one from the web browser and one from the web receiver.
Datazoom provides plugins for data collection through our Beacon Services. Integrate the Chromecast receiver plugin into your Chromecast web receiver application with the following snippet: Insert this JS line into your HTML Replace the This inserts Datazoom's data collection SDK into the page. To activate data collection for the Chromecast receiver instance, create a Datazoom context which references the playerManager instance with the following snippet: For example: To enable a Chromecast collector to capture the ad related data points, the required steps for a web application differ depending on how the IMA ad framework is integrated with the chromecast player. In general, there are two types of integration method between the chromecast player and ad framework: Chromecast player support IMA ad integration as a part or an optional module of the player. Since the corresponding Datazoom collector for the player is prebuilt with knowledge of the player’s ad related features, for a web application who simply leverages the video player for ads, no additional code is required to enable ad data collection in this scenario. For a web application who likes to enable IMA ads independent of the chromecast player, it can choose to utilize the IMA ad framework library directly. Since it is impossible for the corresponding Datazoom collector to gather ad information through the chromecast player, some provisioning steps will be required to enable ad data collection. For a Datazoom collector to gather ad information in this scenario, the application should give access by attaching these IMA objects to the collector context as soon as they become available. The Datazoom collector context interface expose these methods for this purpose: For more info https://help.datazoom.io/hc/en-us/articles/5395580961805-Enable-Ad-Data-Collection-by-Attaching-IMA-Objects . Direct IMA integration can be done in different ways. See below. This implementation pauses the content when the ad starts and resume the content when ad completes. To enable ad data collection in this scenario, some provisioning steps will be required. The below code snippet helps to pause content when ad starts and resume content when ad ends. Example: That’s it. The Datazoom collector is now provided with the required access to gather ad related information with pause-resume method. This implementation stops the content when the ad starts and loads the content when ad completes. Currently Chromecast collector don’t support this type of implementation. We have made it convenient to manage your Chromecast Collector integration by providing NPM (Node Package Manager) support. Please see installation details here. Chromecast Web Receiver API : https://developers.google.com/cast/docs/reference/web_receiver Plugin Integration
<script src='https://platform.datazoom.io/beacon/v1/config?configuration_id=CONFIG_ID'></script>
CONFIG_ID value with the collector configuration ID.Activate Data Collection for a Chromecast Receiver
var datazoom_context = datazoom.createContext(playerManager);
<html>
<head>
<script type="text/javascript" src="//www.gstatic.com/cast/sdk/libs/caf_receiver/v3/cast_receiver_framework.js"></script>
<script src='https://platform.datazoom.io/beacon/v1/config?configuration_id=CONFIG_ID'></script>
</head>
<body>
<cast-media-player></cast-media-player>
<script>
const context = cast.framework.CastReceiverContext.getInstance();
context.start();
const playerManager = context.getPlayerManager();
//Activates Data Collection
let datazoom_context = datazoom.createContext(playerManager);
</script>
</body>
</html>
Enable Ad Data Collection (Google IMA)
1. Ad framework integration supported by the chromecast player (Native IMA)
2. Ad integration external to the chromecast player (Direct IMA)
// share a adsManager object with the collector context, once per ad-request
this.datazoom_context.attachImaAdsManager(adsManager);
// share the adsLoader object with the collector context, usually once per context
this.datazoom_context.attachImaAdsLoader(adsLoader);
Direct IMA Integration Methods
1. Pause-Resume Method
// Pauses the content when ad starts
this.adsManager_.addEventListener(
google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,
this.playerManager_.pause();
);
// Resumes the content when ad ends
this.adsManager_.addEventListener(
google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,
this.playerManager_.play();
);
let Player = function () {
// Gets the Cast Reciever Context
this.context_ = cast.framework.CastReceiverContext.getInstance();
// Gets the Player Manager
this.playerManager_ = this.context_.getPlayerManager();
// share a playerManager object with the collector context
this.datazoom_context = datazoom.createContext(this.playerManager_);
// Gets Media Element
this.mediaElement_ = document.getElementById("player").getMediaElement();
this.context_.start();
this.initIMA_();
};
Player.prototype.initIMA_ = function () {
//Initializing IMA
...
this.adsLoader_ = new google.ima.AdsLoader(adDisplayContainer);
this.adsLoader_.addEventListener(
google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,
this.onAdsManagerLoaded_.bind(this),
false
);
...
};
Player.prototype.onAdsManagerLoaded_ = function (adsManagerLoadedEvent) {
...
// share a adsManager object with the collector context, once per ad-request
this.datazoom_context.attachImaAdsManager(this.adsManager_);
// share the adsLoader object with the collector context, usually once per context
this.datazoom_context.attachImaAdsLoader(this.adsLoader_);
// Pauses the content when ad starts
this.adsManager_.addEventListener(
google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,
this.onContentPauseRequested_.bind(this)
);
// Resumes the content when ad ends
this.adsManager_.addEventListener(
google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,
this.onContentResumeRequested_.bind(this)
);
...
};
// Pauses the content
Player.prototype.onContentPauseRequested_ = function () {
this.playerManager_.pause();
};
// Resumes the content
Player.prototype.onContentResumeRequested_ = function () {
this.playerManager_.play();
};
2. Stop-Load Method
NPM (Node Package Manager)
References:
Ad Frameworks Extensions
If your Javascript application has a media player with an ad framework, Datazoom’s Javascript Collector with a Chromecast Receiver Media Player can be extended with the following ad framework extensions.
Supported Data Points
Events
Discrete occurrences driven by user interactions or system actions
Metadata
Attributes
Player
User
Fluxdata
Metrics measuring changing parameters over time
-
Bandwidth
-
Buffer Duration
-
Buffer Duration - Content
-
Buffer Length
-
Content Session Start Timestamp
-
Current Audio Track
-
Current Subtitles
-
Number of Content Plays
-
Number of Content Requests
-
Number of Errors
-
Number of Errors - Content
-
Pause Duration
-
Pause Duration - Content
-
Playback Duration
-
Playback Duration - Content
-
Player State
-
Playhead Position
-
Rendition Height
-
Rendition Name
-
Rendition Width
-
Stall Count
-
Stall Count - Content
-
Stall Duration
-
Stall Duration - Content
-
Time Since Content Request
-
Time Since Content Started
-
Time Since Last Buffer Start
-
Time Since Last Buffer Start - Content
-
Time Since Last Heartbeat
-
Time Since Last Milestone - Content
-
Time Since Last Pause
-
Time Since Last Rendition Change
-
Time Since Last Seek Start
-
Time Since Last Stall Start
- Time Since Last Stall Start - Content