Show Menu
TOPICS×

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 Android
  • Configuration / Initialization Information - Contact your Adobe representative for your specific video-tracking account information:
ADBMobileConfig.json
Important: This JSON config file name must remain ADBMobileConfig.json . The name and the path of this configuration file cannot be changed. The path to this file must be <source root>/assets .
AppMeasurement tracking server endpoint The URL of the Adobe Analytics (formerly SiteCatalyst) back-end collection endpoint.
Video analytics tracking server endpoint The URL of the video analytics back-end collection endpoint. This is where all video heartbeat tracking calls are sent.
Tip: The URL of the visitor tracking server is the same as the URL of the analytics tracking server. For information about implementing the Visitor ID Service, see Implement ID Service .
Account name Also known as the Report Suite ID (RSID).
Marketing Cloud organization ID A string value required for instantiating the Visitor component.
Publisher This is the Publisher ID, which is provided to customers by their Adobe representative.
Tip: This ID is not just a string with the brand/television name.
To configure video tracking in your player:
  1. Confirm that load-time options in the ADBMobileConfig.json resource file are correct.
    { 
        "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:
    1. Confirm that the ADBMobileConfig.json file contains the appropriate values that are provided by Adobe.
    2. Confirm that this file is located in the assets folder.
      This folder must be located in the root of your application source tree.
    3. Compile and build your application.
    4. Deploy and run the bundled application.
      For more information about these AppMeasurement settings, see Measuring Video in Adobe Analytics .
  2. Initialize and configure video heartbeat tracking metadata.
    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.
    1. 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:
      private VideoAnalyticsMetadata getVideoAnalyticsTrackingMetadata() { 
          VideoAnalyticsMetadata vaMetadata = new VideoAnalyticsMetadata(); 
      
          vaMetadata.setTrackingServer("example.com"); 
          vaMetadata.setPublisher("sample-publisher"); 
          vaMetadata.setChannel("test-channel"); 
          vaMetadata.setVideoName("myvideo"); 
          vaMetadata.setVideoId("myvideoid"); 
          vaMetadata.setPlayerName("PSDK Player"); 
          vaMetadata.setUseSSL(false); 
          vaMetadata.debugLogging = true; // Set to NO for production deployment. 
          vaMetadata.quietMode = false; // Set to NO for production deployment. 
          vaMetadata.setEnableChapterTracking(true); 
          // use this API to override the default asset length -1 for live streams 
          vaMetadata.setAssetDuration(SAMPLE_ASSET_DURATION); 
      
          return vaMetadata; 
      }
      
      
    2. 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:
      ((MetadataNode)resourceMetadata).setNode( 
            DefaultMetadataKeys.VIDEO_ANALYTICS_METADATA_KEY.getValue(), vaMetadata);
      
      
    3. 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.
      Always create a new tracker instance for each content playback session and remove the previous reference after you detach the media player instance.
      VideoAnalyticsProvider videoAnalyticsProvider =  
        new VideoAnalyticsProvider(appContext); 
      
      // Attach the TVSDK media player instance 
      videoAnalyticsProvider.attachMediaPlayer(mediaPlayer); 
      
      
    4. 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.
      if (_videoAnalyticsProvider) { 
          _videoAnalyticsProvider.detachMediaPlayer(); 
          _videoAnalyticsProvider = null; 
      }
      
      
    5. 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.
      This API is optional and is not needed for VOD video tracking.
      if (_videoAnalyticsProvider) { 
         _videoAnalyticsProvider.trackVideoComplete();    
      }