SRGAnalytics

SRG Analytics entry point.

This object provides a facade for interacting with both Commanders Act and ComScore analytics services. It allows for sending page views, events, and managing persistent labels for both services.

Before using any functionality, SRGAnalytics must be initialized in your Application's onCreate() method using either the initSRGAnalytics() or the init() method and providing an AnalyticsConfig instance.

class MyApplication : Application() {
override fun onCreate() {
super.onCreate()

val config = AnalyticsConfig(
vendor = AnalyticsConfig.Vendor.SRG,
appSiteName = "Your AppSiteName here",
sourceKey = AnalyticsConfig.SOURCE_KEY_SRG_DEBUG,
nonLocalizedApplicationName = "Your non-localized AppSiteName here",
)

initSRGAnalytics(config)
// or
SRGAnalytics.init(this, config)
}
}

Properties

Link copied to clipboard

Provides access to the CommandersAct instance.

Link copied to clipboard

Provides access to the ComScore instance.

Functions

Link copied to clipboard

Retrieves the Commanders Act persistent label associated with the given label.

Link copied to clipboard

Retrieves the ComScore persistent label associated with the given label.

Link copied to clipboard

Initializes the SRGAnalytics instance.

Link copied to clipboard

Initializes the SRGAnalytics instance.

Link copied to clipboard
fun putPersistentLabels(commandersActLabels: Map<String, String>, comScoreLabels: Map<String, String>)

Puts persistent labels for both Commanders Act and ComScore. These labels will be included in all subsequent tracking events until they are overwritten.

Link copied to clipboard

Removes a persistent label from both Commanders Act and ComScore.

Link copied to clipboard

Removes the specified persistent labels from both Commanders Act and ComScore.

Link copied to clipboard

Sends an event to Commanders Act.

Link copied to clipboard
fun sendPageView(commandersAct: CommandersActPageView, comScore: ComScorePageView)

Sends a page view event to both Commanders Act and ComScore.

Link copied to clipboard
fun setUserConsent(userConsent: UserConsent)

Sets the user consent for both Commanders Act and ComScore.