Skip to main content

Conviva Plugin

MobileWebTV Platforms
Android logoiOS logoResponsive Web logoWebTV logoAndroidTV logoRoku logoTvOS logo

DIVA Conviva Plugin

The DIVA Conviva Plugin is an out-of-the-box implementation of a Media Analytics listener which is able to receive events from Diva and directly send them to Conviva.

This plugin is implemented for iOS, tvOS, Android and Web and is used in all our Integration Demo projects as well as in the DIVA Chromecast Receiver app.

The main parameters of this plugin are:

  • Touchstone URL: Used while debugging the integration using the Conviva Touchstone online tool
  • CDN Name: A string identifying which CDN solution is used by the project
  • ViewerID: An identifier of the user or playback session
  • customTagGenerator: A function used by the plugin to calculate Conviva Custom TAGs dynamically. Every time the VideoMetadata gets updated and receives a parameter, the function is called.
  • player version: the version of the diva player used to provide additional informations (only Web TV)

Conviva documentation for more information.

// Set plugin parameters
const convivaConfig = {
playerVersion: Diva.version,
customerKey: "<INSERT-CONVIVA-CUSTOMERKEY-HERE>",
playerName: 'Diva',
viewerId: "<INSERT-VIEWERID-HERE>",
cdnName: "<INSERT-CDN-NAME-HERE>",
customTagGenerator: (videoMetadata) => ({
// just an example, custom tags are project-specific
platform: 'Web',
videoId: videoMetadata.videoId,
eventId: videoMetadata.eventId,
videoTitle: videoMetadata.title
}),
gatewayUrl: divaParams.debug ? "<INSERT-DEBUG-TOUCHSTONE-HERE>" : undefined,
}

mediaAnalyticPlugin = new d3lib.ConvivaPlugin()
mediaAnalyticPlugin.init(convivaConfig)
window.addEventListener("beforeunload", (e) => {
mediaAnalyticPlugin.detachPlugin();
})

// Start Diva
const {
element: divaElement,
api: divaAPI
} = new Diva('.diva-player-container', {
// ...
onMediaAnalyticEvent: mediaAnalyticPlugin.handleEvent
})