Initialize and configure video analytics initialize-and-configure-video-analytics
You can configure your player to track and analyze video use.
Before activating video tracking (video heartbeats), ensure that you have the following:
- TVSDK for iOS
- Configuration / Initialization Information - Contact your Adobe representative for your specific video-tracking account information:
To configure video tracking in your player:
-
Confirm that load-time options in the
ADBMobileConfig.jsonresource file are correct.code language-none { "version" : "1.1", "analytics" : { "rsids" : "adobedevelopment", "server" : "10.131.129.149:3000", "charset" : "UTF-8", "ssl" : false, "offlineEnabled" : false, "lifecycleTimeout" : 5, "batchLimit" : 50, "privacyDefault" : "optedin", "poi" : [] }, "marketingCloud": { "org": "ADOBE PROVIDED VALUE" }, "target" : { "clientCode" : "", "timeout" : 5 }, "audienceManager" : { "server" : "" } }This JSON-formatted configuration file is bundled as a resource with TVSDK. Your player reads these values only at load time, and the values remain constant while your application runs.
To configure load-time options:
-
Confirm that the
ADBMobileConfig.jsonfile contains the appropriate values that are provided by Adobe. -
Confirm that this file is located in the
AdobeMobilefolder.This folder must be located in the root of your application source tree.
-
Compile and build your application.
-
Deploy and run the bundled application.
For more information about these AppMeasurement settings, see Measuring Video in Adobe Analytics.
-
-
Initialize and configure video heartbeat tracking metadata.
note important IMPORTANT You can stop the video analytics module midstream and reinitialize it again as necessary. Before the module is reinitialized, ensure that the video analytics metadata is also updated to the correct content metadata. To recreate the metadata, repeat sub-steps 1 and 2. -
Create an instance of the Video Analytics metadata.
This instance contains all of the configuration information that is needed to enable video heartbeat tracking. For example:
code language-none - (PTVideoAnalyticsTrackingMetadata *)getVideoAnalyticsTrackingMetadata { PTVideoAnalyticsTrackingMetadata *vaTrackingMetadata = [[[PTVideoAnalyticsTrackingMetadata alloc] initWithTrackingServer:@"example.com" publisher:@"sample-publisher"] autorelease]; // Set these to NO for production deployment. vaTrackingMetadata.debugLogging = YES; vaTrackingMetadata.quietMode = NO; vaTrackingMetadata.channel = @"test-channel"; vaTrackingMetadata.videoName = @"myvideo"; vaTrackingMetadata.videoId = @"myvideoid"; vaTrackingMetadata.playerName = @"PSDK Player"; vaTrackingMetadata.enableChapterTracking = YES; vaTrackingMetadata.useSSL = NO; // use this API to override the default asset length -1 for live streams vaTrackingMetadata.assetDuration = SAMPLE_ASSET_DURATION; } -
Add the Video Analytics metadata to the global metadata instance.
When you are ready, set the global metadata instance on the media resource or the media player item:
code language-none - (PTMetadata *)createMetadata { PTMetadata *metadata = [[[PTMetadata alloc] init] autorelease]; [metadata setMetadata:[self getVideoAnalyticsTrackingMetadata] forKey:PTVideoAnalyticsTrackingMetadataKey]; return metadata; } PTMetadata *metadata = [self createMetadata]; PTMediaPlayerItem *item = [[[PTMediaPlayerItem alloc] initWithUrl:[[[NSURL alloc] initWithString:@"media-url"] autorelease] mediaId:@"media-id" metadata:metadata] autorelease]; -
Initialize the Video Analytics tracker.
After creating a media player instance, you must create a Video Analytics tracker instance and provide a reference to the media player instance.
note tip TIP Always create a new tracker instance for each content playback session and remove the previous reference after you detach the media player instance. code language-none self.videoAnalyticsTracker = [[[PTVideoAnalyticsTracker alloc] initWithMediaPlayer:self.player] autorelease]; -
Destroy the Video Analytics tracker.
Before you begin a new content playback session, destroy the previous instance of the video tracker. After you receive the content complete event (or notification), wait a few minutes before you destroy the video tracker instance. Destroying the instance immediately might interfere with the Video Analytics tracker’s ability to send a video complete ping.
code language-none self.videoAnalyticsTracker = nil; -
Manually mark the Live/Linear stream as complete.
If you have various episodes on one live stream, you can manually mark an episode as complete by using the complete API. This ends the video tracking session for the current video episode, and you can start a new tracking session for the next episode.
note tip TIP This API is optional and is not needed for VOD video tracking. code language-none if (self.videoAnalyticsTracker) { [self.videoAnalyticsTracker trackVideoComplete]; }
-