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
YOUR_TOKEN
: The field is required, this appears to be an api token or authentication key for analytics purposes.resourceId
: The field is optional, this could be an identifier for a specific resource or source within your application, used for tracking or categorization.sessionId
: The field is optional, this represents a session identifier, likely used to track user sessions or interactions with the application.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.
Create AnalyticsConfig
val analyticsConfig = AnalyticsConfig.Builder("YOUR_TOKEN") // token is required
.setResourceId("I am resource id.") // optional
.setUserId("I am user id.") // optional
.setSessionId("I am session id.") // optional
.setCustomData(
mapOf(
"custom_parameter" to "I am String",
"custom_parameter2" to 999
)
) // optional
.build()
Set AnalyticsConfig to UniPlayer
Call setAnalyticsConfig() method from player and inject AnalyticsConfig.
val uniPlayer = UniPlayer.Builder(requireContext(), createPlayConfigFromArgument())
.setAnalyticsConfig(analyticsConfig)//set analyticsConfig
.build()