Skip to main content

Analytics Module

This guide is intended to assist you in integrating the Analytics Module for your player to collect, analyze, and report data related to user playback behavior.
You can obtain a basic example of the Player Analytics Module through this sample project.
For basic player SDK integration, you can refer to Getting Started.

Integration Preparation

Before starting the integration, you must obtain the api token first in order to transmit player playback events to BlendVision Data Platform.

Analytics Field Definition

  • AnalyticsField.token: The field is required, this appears to be an api token or authentication key for analytics purposes.
  • AnalyticsField.sessionId: The field is optional, this represents a session identifier, likely used to track user sessions or interactions with the application.
  • AnalyticsField.resourceId: The field is optional, this could be an identifier for a specific resource or source within your application, used for tracking or categorization.
  • AnalyticsField.resourceType: The field is optional, this might indicate the type or category of the resource mentioned above.
  • AnalyticsField.customData: The field is optional, this seems to be a placeholder for custom data that you can include in your analytics events, allowing you to send additional information as needed.

Initialize the Analytics Module

In your player code, make sure to load the Analytics module during the initialization phase. This typically involves importing the Analytics library, configuring it appropriately, and initializing the connection to the service.

var moduleConfig: [String: String] {
var config = [String: String]()
config[AnalyticsField.token.rawValue] = "123456789" // replace "123456789" with your license
config[AnalyticsField.sessionId.rawValue] = "session id"
config[AnalyticsField.resourceId.rawValue] = "source id"
config[AnalyticsField.resourceType.rawValue] = "resource type"
config[AnalyticsField.customData.rawValue] = "custom data"
return config
}

// Create player based on player config and module config
player = UniPlayerFactory.create(player: playerConfig, moduleConfig: moduleConfig)