Class: Reporter

.Analytics. Reporter

Reporter(pCode, sessionId)

Initialize an instance of the current class using the new keyword along with this constructor.

The Ooyala IQ JavaScript SDK enables the integration of Ooyala analytics with any web-based player. You need to obtain a provider code (pCode) from Ooyala first before creating an integration. The integration must conform to calling the methods in the right order, otherwise analytics metrics are not guaranteed to be correct.

Parameters:
Name Type Description
pCode string The customer-specific provider code obtained from Ooyala.
sessionId string A unique identifier for the user session. This property is optional. Arandomly generated guid is used if the property is not provided by the caller.
Example
var pCode = "xxxxxx";var ooyalaReporter = new Ooyala.Analytics.Reporter(pCode, sessionId);setDeviceInfo('dvid_ff14d8e1',{browser: 'chrome', browserVersion: '51.0.2704.84', os: 'windows', osVersion: '8.1', deviceType: 'desktop'});setPlayerInfo('plid_b149aae0', 'Ooyala Player', '4.4.8')ooyalaReporter.reportPlayerLoad();ooyalaReporter.initializeMedia('5612443', Ooyala.Analytics.MediaContentType.OOYALA_CONTENT,   contentSessionId);ooyalaReporter.setMediaDuration(60000);ooyalaReporter.reportPlayRequested();ooyalaReporter.reportPlaybackStarted();ooyalaReporter.reportPlayHeadUpdate(2000);ooyalaReporter.reportPlayHeadUpdate(4000);ooyalaReporter.reportPlayHeadUpdate(60000);ooyalaReporter.reportComplete();

Methods

setIQBackendURL(url)

Override the _iqEndpoint set by the config file with the new url supplied as url argument
Parameters:
Name Type Description
url string Backend IQ endpoint.

setDocumentURL(url)

Add DocumentUrl which is supplied as url argument to be able to manually set the documentURL.
Parameters:
Name Type Description
url string DocumentUrl

setDeviceInfo(deviceId, deviceInfo, userAgent)

Set the device information to enable data aggregation based on this information in Ooyala Analytics. This should only get called oncewhen you are setting up the SDK on the device.
Parameters:
Name Type Description
deviceId string The device-specific id. If null, a random identifier is generated.
deviceInfo Ooyala.Analytics.DeviceInfo The device-specific information array containing browser, browserVersion, os, osVersion, deviceType ,deviceBrand , and model.
userAgent string User agent information for the browser or device.

setUserInfo(emailHashMD5, userId, gender, geo)

Set the user information to enable data aggregation based on this information in Ooyala Analytics.
Parameters:
Name Type Description
emailHashMD5 string MD5 hash of the email id of the viewer, if available. E.g.: 9fb1308b4d75de1e96b2bf2e7fb84438.
userId string User id of the viewer, if available.
gender string Gender of the viewer. E.g.: M, F etc.
geo Ooyala.Analytics.geo The geographical details of the viewer.

setPlayerInfo(playerId, playerName, playerVersion)

Set the player information of the deployed player to enable data aggregation based on this information in Ooyala Analytics. This should only get called oncewhen you are setting up the SDK on the device.
Parameters:
Name Type Description
playerId string Unique identifier for the player.
playerName string Name of the player.
playerVersion string Version of the player.

setSessionId(sessionId)

Set the player session id created on player creation, used this information to aggregate videosplayed in same session. This is to be used only if the session id cannot be provided at the time ofinvoking the constructor. This function should be called before reporting any events.
Parameters:
Name Type Description
sessionId string A unique identifier for the user session.

reportPlayerLoad()

Report that a player instance has fully loaded. This should only be called once for each reporter.

initializeMedia(mediaId, contentType, contentSessionId)

Set the media ID for which to report analytics information. Call this method each time thevideo within the player changes (in the case of back-to-back videos coming from a single instanceof the player). This may only be called once for each video and should only be called when the video hassuccessfully been displayed to the end user.
Parameters:
Name Type Description
mediaId string The customer-specific id for the media item.
contentType Ooyala.Analytics.MediaContentType The content type of the media item.
contentSessionId string A unique identifier for the session specific to the media item.This property is optional. A randomly generated guid is used if the property is not provided by thecaller.

setMediaDuration(durationMillis)

Set the duration of the video.Call this method each time and also only after the Ooyala.Analytics.Reporter#initializeVideo has been called.
Parameters:
Name Type Description
durationMillis number The duration of the video in milliseconds.

reportPlayRequested(isAutoPlay)

Report when the playback of the video has been requested.
Parameters:
Name Type Description
isAutoPlay boolean true if the play was auto triggered.

setPlugins(plugins)

Sets the array of plugins for the content being watched. Call this method for each video immediately afterdetermining which plugins will be used. This method must be called before reporting the videoStarted event.This method will throw an exception if any plugin is not in the expected format.
Parameters:
Name Type Description
plugins Ooyala.Analytics.Plugin An array of Plugin objects.

reportOfflineContentAcquired(downloadType)

Report when the video has been downloaded for offline viewing.
Parameters:
Name Type Description
downloadType enum rental , own as types.

reportReplay()

Report that the media has been requested to be *replayed*.

reportPlaybackStarted()

Report that playback of the media has actually begun.

reportPlayHeadUpdate(playHeadPositionMillis)

Report that the playhead of the media was updated (either because someamount of playback occurred or through scrubbing). It is important to call this methodfrequently (every 2-3 seconds) while the media is being played.
Parameters:
Name Type Description
playHeadPositionMillis number The current position of the playhead in milliseconds.

reportPause()

Report that playback pause has been triggered.

reportResume()

Report that playback resume has been triggered.

reportSeek(startMillis, endMillis)

Report that seeking has been triggered.
Parameters:
Name Type Description
startMillis number The playhead position before seeking in milliseconds.
endMillis number The playhead position after seeking in milliseconds.

reportComplete()

Report that playback of the media item has completed.

reportCustomEvent(name, metadata)

Report custom events.
Parameters:
Name Type Description
name string The custom event's name.
metadata object Additional custom metadata related to the event, as a set of keys and values.

updateTopLevelSource(sourceJson)

Updates top level source information by
Parameters:
Name Type Description
sourceJson object

reportAssetImpression(displayedAsset, customData, uiTag, contentSource, pageSize, assetPosition)

reports asset impression event for each asset in the recommended assets
Parameters:
Name Type Description
displayedAsset object : single asset informaton in json format
customData object an optional Object which can contain additional information about where the recommendation was clicked. It can have the following keys (all optional):- "source": may be one of "endScreen" or "pauseScreen", depending on where the recommendation was clicked.- "countdown": the remaining value of the end-screen countdown timer, as a floating point number of seconds. Only valid when { "source": "endScreen" }.- "autoplay": a boolean indicating whether the recommendation played automatically because the timer expired. Implied to be true if "countdown" is given and has a value of 0.0.- "playheadPercent": if the recommendations were shown on the pause screen, this float can report the fraction of the video that has been played. For example, if a 10 minute video is paused at the 5 minute mark, the value would be ~0.5. It is not actually a percentage but a fraction, the name is unfortunate but must be preserved for compatibility
uiTag String : The UI tag which indicates the identity of the carousel in the site/app UI. Assigned by the provider
contentSource String : The source can be “ooyala-discovery” or other string set by the provider and identifies the origin of the asset in this particular context
pageSize int : A number that identifies the size of the carousel/page. e.g., 5
assetPosition int : A number that identifies the position of the asset in the carousel

reportAssetClick(clickedAsset, customData, uiTag, contentSource, pageSize, assetPosition)

reports asset click event for each asset in the recommended assets
Parameters:
Name Type Description
clickedAsset object : single asset informaton in json format
customData object an optional Object which can contain additional information about where the recommendation was clicked. It can have the following keys (all optional):- "source": may be one of "endScreen" or "pauseScreen", depending on where the recommendation was clicked.- "countdown": the remaining value of the end-screen countdown timer, as a floating point number of seconds. Only valid when { "source": "endScreen" }.- "autoplay": a boolean indicating whether the recommendation played automatically because the timer expired. Implied to be true if "countdown" is given and has a value of 0.0.- "playheadPercent": if the recommendations were shown on the pause screen, this float can report the fraction of the video that has been played. For example, if a 10 minute video is paused at the 5 minute mark, the value would be ~0.5. It is not actually a percentage but a fraction, the name is unfortunate but must be preserved for compatibility
uiTag String : The UI tag which indicates the identity of the carousel in the site/app UI. Assigned by the provider
contentSource String : The source can be “ooyala-discovery” or other string set by the provider and identifies the origin of the asset in this particular context
pageSize int : A number that identifies the size of the carousel/page. e.g., 5
assetPosition int : A number that identifies the position of the asset in the carousel

setCustomDimensions(customDimensions)

Set custom metadata
Parameters:
Name Type Description
customDimensions object Custom metadata key-value store. The keys must be string. The values must be strings, numbers or boolean values.