Insight data collection
The NAGRA Insight tool allows data collection for device and network profiling purposes. The OtvInsightAgent
class abstracts the NAGRA Insight library functionality that provides the data collection mechanism to the SDK.
Integrating the Insight library
Download the opy-sdk-js-5.12.x-insight.zip file; see Downloading the SDK.
Include the NAGRA Insight ni-agent.js
module in the HTML file before the opy-sdk-js-all.js
SDK file:
<script src="../ni-agent.js"></script>
<script src="../opy-sdk-js-all.js"></script>
Replace opy-sdk-js-all.js with opy-sdk-js-all-no-ui.js when using the Reduced Size SDK.
Instantiation
Create an instance of the OtvInsightAgent
class, providing it with the necessary configuration.
const insightConfig = {
collectorURL: "https://collector.insight-stats.com/api/v1",
reportingInterval: 1, // minutes (1-60, default 30)
samplingInterval: 20, // seconds (15-reportingInterval, default 30)
appName: "OpenTV Player Sample App",
appVersion: "5.x",
deviceType: "desktop",
operatorId: "TBD",
deviceId: "TBD",
};
agent = new OTV.OtvInsightAgent(insightConfig);
Starting a session
Immediately before setting the source stream, the instance of the agent needs the startSession()
method called providing the player instance, details of the stream to be played, and the user's profile.
const vodContentInfo = {
contentId: "9876543",
contentName: "Big Buck Bunny",
genre: ["animation"], // optional
scrambled: false, // optional
};
const userInfo = {
userId: "User001",
accountId: "account001",
fullName: "Homer J Simpson",
gender: "male",
age: 37,
ageRange: "AlwaysTheSame",
category: "D'oh",
street: "Evergreen Terrace",
city: "Springfield",
state: "Idono",
postCode: "1DK",
country: "US",
};
agent.startSession(window.player, vodContentInfo, userInfo);
window.player.src(stream.source);
From that point, event-based analytic data will be collected in the background and periodically uploaded to the Insight server.
Stopping a session
Completing the session is achieved by calling stopSession()
immediately before the player's reset()
method is called to stop the playback of that stream. A session must be stopped before a new session can be started (e.g. when zapping from one content to another).
agent.stopSession();
window.player.reset();
Termination
Calling terminate() will clean up the agent and upload any pending collected data to the Insight server. Termination is typically done when the application must shut down (e.g. before navigation from the page). If terminate()
is not called, it is possible that the most recently collected data will not be uploaded. After calling terminate()
all other calls to this instance of the OtvInsightAgent
object are unsupported.