Application collectors
Chromecast Receiver Media Player
v2.21.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
1<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
1var datazoom_context = datazoom.createContext(playerManager);1<html>23<head>4 <script type="text/javascript" src="//www.gstatic.com/cast/sdk/libs/caf_receiver/v3/cast_receiver_framework.js"></script>5 <script src='https://platform.datazoom.io/beacon/v1/config?configuration_id=CONFIG_ID'></script>6</head>78<body>9 <cast-media-player></cast-media-player>1011 <script>12 const context = cast.framework.CastReceiverContext.getInstance();13 context.start();14 const playerManager = context.getPlayerManager();15 //Activates Data Collection16 let datazoom_context = datazoom.createContext(playerManager);17 </script>18</body>1920</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)
1// share a adsManager object with the collector context, once per ad-request2this.datazoom_context.attachImaAdsManager(adsManager);34// share the adsLoader object with the collector context, usually once per context5this.datazoom_context.attachImaAdsLoader(adsLoader);Direct IMA Integration Methods
1. Pause-Resume Method
1// Pauses the content when ad starts2this.adsManager_.addEventListener(3 google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,4 this.playerManager_.pause();5);67// Resumes the content when ad ends8this.adsManager_.addEventListener(9 google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,10 this.playerManager_.play();11);1let Player = function () {2 // Gets the Cast Reciever Context3 this.context_ = cast.framework.CastReceiverContext.getInstance();45 // Gets the Player Manager6 this.playerManager_ = this.context_.getPlayerManager();78 // share a playerManager object with the collector context9 this.datazoom_context = datazoom.createContext(this.playerManager_);10 11 // Gets Media Element12 this.mediaElement_ = document.getElementById("player").getMediaElement();1314 this.context_.start();15 this.initIMA_();16};1718Player.prototype.initIMA_ = function () {19 //Initializing IMA20 ...21 this.adsLoader_ = new google.ima.AdsLoader(adDisplayContainer);22 this.adsLoader_.addEventListener(23 google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,24 this.onAdsManagerLoaded_.bind(this),25 false26 );27 ...28};2930Player.prototype.onAdsManagerLoaded_ = function (adsManagerLoadedEvent) {31 ...32 // share a adsManager object with the collector context, once per ad-request33 this.datazoom_context.attachImaAdsManager(this.adsManager_);3435 // share the adsLoader object with the collector context, usually once per context36 this.datazoom_context.attachImaAdsLoader(this.adsLoader_);3738 // Pauses the content when ad starts39 this.adsManager_.addEventListener(40 google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,41 this.onContentPauseRequested_.bind(this)42 );4344 // Resumes the content when ad ends45 this.adsManager_.addEventListener(46 google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,47 this.onContentResumeRequested_.bind(this)48 );49 ...50};5152// Pauses the content 53Player.prototype.onContentPauseRequested_ = function () {54 this.playerManager_.pause();55};5657// Resumes the content58Player.prototype.onContentResumeRequested_ = function () {59 this.playerManager_.play();60};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
Player
Attributes
User
Fluxdata
Metrics measuring changing parameters over time
-
Audio Track
-
Bandwidth
-
Buffer Duration (Content Session)
-
Buffer Length
-
Buffer Start Recency (Content Session)
-
Content Buffer Duration (Content Session)
-
Content Buffer Start Recency (Content Session)
-
Content Error Count (App Session)
-
Content Media Request Count (App Session)
-
Content Media Request Recency (Content Session)
-
Content Milestone Recency (Content Session)
-
Content Pause Duration (Content Session)
-
Content Playback Duration (Content Session)
-
Content Playback Start Count (App Session)
-
Content Playback Start Recency (Content Session)
-
Content Session Start Timestamp
-
Content Stall Count (Content Session)
-
Content Stall Duration (Content Session)
-
Content Stall Start Recency (Content Session)
-
Error Count (App Session)
-
Heartbeat Recency (Content Session)
-
Pause Duration (Content Session)
-
Pause Recency (Content Session)
-
Playback Duration (Content Session)
-
Player State
-
Playhead Position
-
Rendition Change Recency (Content Session)
-
Rendition Height
-
Rendition Name
-
Rendition Width
-
Seek Start Recency (Content Session)
-
Stall Count (Content Session)
-
Stall Duration (Content Session)
-
Stall Start Recency (Content Session)
- Subtitle Track