Nagra OTV Analytics Javascript Agent

Class: OtvAnalyticsWrapper

OtvAnalyticsWrapper

new OtvAnalyticsWrapper()

This class is a wrapper for the OtvAnalyticsAgent class. It automates some OtvActivity detection using a Nagra Connect Player, and forwards the detected activities to the OtvAnalyticsAgent.

Note: There is no need for the integrator to call new on this class as it handled internally to the SDK.

Methods

appStart(metadata)

Submit the appStart Activity Must be the first activity submitted (must be called before any other calls to submitActivity). Should not be called again without first submitting an appStop activity.

Name Type Description
metadata Object

Containing key-value pairs of metadata for the appStart activity

Returns:
error object

close()

Close the analytics session. After calling this method, do not call any other unless initialise is called again

Returns:
error object

initialise(wrapperConfig, agentConfig)

Initialise the OpenTv Analytics Agent and Wrapper. Call this method once, before calling any other. Do not call again unless close is called first.

Name Type Description
wrapperConfig Object

Configuration for the wrapper

agentConfig Object

Configuration for the OtvAnalyticsAgent

Returns:
error object

playbackStart(metadata, insightContent, insightUserInfo)

Submit the playbackStart Activity. Should be called after a player has been set for the wrapper.

Name Type Description
metadata Object

Containing key-value pairs of metadata for the playbackStart activity

insightContent Object optional

if insight reporting is required.

insightUserInfo Object optional

if insight reporting is required but can still be omitted.

Returns:
error object

setConnectPlayer(player)

Provide a reference to a Nagra Connect Player which may be used to automatically detect some activities, and populate some metadata. Must be called before submitting the playbackStart activity. Must not be changed or removed between playbackStart and playbackStop activities. Player may be removed by passing a null reference.

Name Type Description
player player

Reference to a Nagra Connect Player

Returns:
error object

submitActivity(activity, metadata)

Submit an activity. appStart and playbackStart activities should not be submitted using this method.

Name Type Description
activity OtvActivity

The activity being submitted

metadata Object

Containing key-value pairs of metadata for the submitted activity

Returns:
error object

updateConfig(updatedWrapperConfig, updatedAgentConfig)

Provide an updated configuration. The configuration object should only contain the updated attributes. Not all attributes may be updated. If either object does not need to be updated, an empty object {} may be provided.

Name Type Description
updatedWrapperConfig Object

updated configuration for the wrapper

updatedAgentConfig Object

updated configuration for the OtvAnalyticsAgent

Returns:
error object