From 546069ba8ff4bbd4b8229c583045c8daaf966cf1 Mon Sep 17 00:00:00 2001 From: Debanjan Chatterjee Date: Thu, 21 Mar 2024 17:34:13 +0530 Subject: [PATCH] chore: updated sample to use local.properties. (#405) feat: added secondary analytics instance. feat: added buttons for secondary analytics. --- .../sample-kotlin-android/build.gradle.kts | 43 ++++- .../android/sampleapp/MyApplication.kt | 8 +- .../analytics/RudderAnalyticsUtils.kt | 51 +++-- .../android/sampleapp/analytics/Values.kt | 13 +- .../sampleapp/mainview/MainActivity.kt | 65 +++++-- .../sampleapp/mainview/MainViewModel.kt | 182 +++++++++++++----- .../sampleapp/mainview/MainViewModelState.kt | 15 +- 7 files changed, 286 insertions(+), 91 deletions(-) diff --git a/samples/sample-kotlin-android/build.gradle.kts b/samples/sample-kotlin-android/build.gradle.kts index d6143166e..fc18980ed 100644 --- a/samples/sample-kotlin-android/build.gradle.kts +++ b/samples/sample-kotlin-android/build.gradle.kts @@ -1,8 +1,23 @@ +import java.io.FileInputStream +import java.util.Properties + plugins { id("com.android.application") id("org.jetbrains.kotlin.android") id("kotlin-android") } +var sampleRudderProperties = Properties() +if (project.rootProject.file("samples/sample-kotlin-android/local.properties").canRead()) { + sampleRudderProperties.apply { + load( + FileInputStream( + File( + rootProject.rootDir, "samples/sample-kotlin-android/local" + ".properties" + ) + ) + ) + } +} android { val majorVersion = 0 @@ -29,6 +44,28 @@ android { vectorDrawables { useSupportLibrary = true } + + buildConfigField( + "String", "WRITE_KEY", sampleRudderProperties.getProperty("writeKey") + ) + buildConfigField( + "String", "WRITE_KEY_SECONDARY", sampleRudderProperties.getProperty("writeKeySecondary") + ) + buildConfigField( + "String", "CONTROL_PLANE_URL", sampleRudderProperties.getProperty("controlplaneUrl") + ) + buildConfigField( + "String", "CONTROL_PLANE_URL_SECONDARY", + sampleRudderProperties.getProperty("controlplaneUrlSecondary") + ) + buildConfigField( + "String", "DATA_PLANE_URL", + sampleRudderProperties.getProperty("dataplaneUrl") + ) + buildConfigField( + "String", "DATA_PLANE_URL_SECONDARY", + sampleRudderProperties.getProperty("dataplaneUrlSecondary") + ) } buildTypes { @@ -36,8 +73,7 @@ android { isMinifyEnabled = false setProguardFiles( listOf( - getDefaultProguardFile("proguard-android-optimize.txt"), - "proguard-rules.pro" + getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" ) ) } @@ -47,8 +83,7 @@ android { isMinifyEnabled = false setProguardFiles( listOf( - getDefaultProguardFile("proguard-android-optimize.txt"), - "proguard-rules.pro" + getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" ) ) } diff --git a/samples/sample-kotlin-android/src/main/kotlin/com/rudderstack/android/sampleapp/MyApplication.kt b/samples/sample-kotlin-android/src/main/kotlin/com/rudderstack/android/sampleapp/MyApplication.kt index f04049c34..808e1fbce 100644 --- a/samples/sample-kotlin-android/src/main/kotlin/com/rudderstack/android/sampleapp/MyApplication.kt +++ b/samples/sample-kotlin-android/src/main/kotlin/com/rudderstack/android/sampleapp/MyApplication.kt @@ -1,6 +1,7 @@ package com.rudderstack.android.sampleapp import android.app.Application +import android.util.Log import com.rudderstack.android.sampleapp.analytics.RudderAnalyticsUtils class MyApplication : Application() { @@ -11,6 +12,11 @@ class MyApplication : Application() { } private fun initAnalyticSdk() { - RudderAnalyticsUtils.initialize(this) + RudderAnalyticsUtils.initialize( + this + ) { instanceName, success, message -> + if (success) Log.d("RudderStack", "Analytics initialized for $instanceName") + else Log.e("RudderStack", "Analytics failed to initialize for $instanceName: $message") + } } } diff --git a/samples/sample-kotlin-android/src/main/kotlin/com/rudderstack/android/sampleapp/analytics/RudderAnalyticsUtils.kt b/samples/sample-kotlin-android/src/main/kotlin/com/rudderstack/android/sampleapp/analytics/RudderAnalyticsUtils.kt index 67cf0b967..f2be0c582 100644 --- a/samples/sample-kotlin-android/src/main/kotlin/com/rudderstack/android/sampleapp/analytics/RudderAnalyticsUtils.kt +++ b/samples/sample-kotlin-android/src/main/kotlin/com/rudderstack/android/sampleapp/analytics/RudderAnalyticsUtils.kt @@ -14,15 +14,19 @@ import com.rudderstack.jacksonrudderadapter.JacksonAdapter object RudderAnalyticsUtils { + private const val PRIMARY_INSTANCE_NAME = "primary" + private const val SECONDARY_INSTANCE_NAME = "secondary" + private var _rudderAnalytics: Analytics? = null + private var _rudderAnalyticsSecondary: Analytics? = null private var _rudderReporter: RudderReporter? = null - private var _listener: InitializationListener? = null - fun initialize(application: Application) { + fun initialize(application: Application, listener: InitializationListener? = null) { _rudderAnalytics = RudderAnalytics( writeKey = WRITE_KEY, + instanceName = PRIMARY_INSTANCE_NAME, initializationListener = { success, message -> - _listener?.onAnalyticsInitialized(success, message) + listener?.onAnalyticsInitialized(PRIMARY_INSTANCE_NAME, success, message) }, configuration = ConfigurationAndroid( application = application, @@ -33,36 +37,51 @@ object RudderAnalyticsUtils { recordScreenViews = true, ) ) + _rudderAnalyticsSecondary = RudderAnalytics( + writeKey = WRITE_KEY_SECONDARY, + instanceName = SECONDARY_INSTANCE_NAME, + initializationListener = { success, message -> + listener?.onAnalyticsInitialized(SECONDARY_INSTANCE_NAME, success, message) + }, + configuration = ConfigurationAndroid( + application = application, + GsonAdapter(), + dataPlaneUrl = DATA_PLANE_URL_SECONDARY, + controlPlaneUrl = CONTROL_PLANE_URL_SECONDARY, + trackLifecycleEvents = true, + recordScreenViews = true, + ) + ) _rudderReporter = DefaultRudderReporter( - context = application, - baseUrl = BASE_URL, - configuration = Configuration( + context = application, baseUrl = METRICS_BASE_URL, configuration = Configuration( LibraryMetadata( name = "android", sdkVersion = BuildConfig.LIBRARY_PACKAGE_NAME, versionCode = BuildConfig.LIBRARY_VERSION_NAME, writeKey = WRITE_KEY ) - ), - JacksonAdapter() + ), JacksonAdapter() ) } - fun getInstance(): Analytics? { - return _rudderAnalytics - } + val primaryAnalytics: Analytics + get() = _rudderAnalytics ?: throw IllegalStateException( + "Rudder Analytics Primary not " + "initialized" + ) + + val secondaryAnalytics: Analytics + get() = _rudderAnalyticsSecondary ?: throw IllegalStateException( + "Rudder Analytics " + "Secondary" + " not initialized" + ) + fun getReporter(): RudderReporter? { return _rudderReporter } - fun setInitializationListener(listener: InitializationListener) { - _listener = listener - } - fun interface InitializationListener { - fun onAnalyticsInitialized(success: Boolean, message: String?) + fun onAnalyticsInitialized(instanceName: String, success: Boolean, message: String?) } } diff --git a/samples/sample-kotlin-android/src/main/kotlin/com/rudderstack/android/sampleapp/analytics/Values.kt b/samples/sample-kotlin-android/src/main/kotlin/com/rudderstack/android/sampleapp/analytics/Values.kt index a7eacb423..690feb41e 100644 --- a/samples/sample-kotlin-android/src/main/kotlin/com/rudderstack/android/sampleapp/analytics/Values.kt +++ b/samples/sample-kotlin-android/src/main/kotlin/com/rudderstack/android/sampleapp/analytics/Values.kt @@ -1,6 +1,11 @@ package com.rudderstack.android.sampleapp.analytics -const val WRITE_KEY = "WRITE_KEY" -const val DATA_PLANE_URL = "DATA_PLANE_URL" -const val CONTROL_PLANE_URL = "CONTROL_PLANE_URL" -const val BASE_URL = "BASE_URL" +import com.rudderstack.android.sampleapp.BuildConfig + +const val WRITE_KEY = BuildConfig.WRITE_KEY +const val DATA_PLANE_URL = BuildConfig.DATA_PLANE_URL +const val CONTROL_PLANE_URL = BuildConfig.CONTROL_PLANE_URL +const val WRITE_KEY_SECONDARY = BuildConfig.WRITE_KEY_SECONDARY +const val DATA_PLANE_URL_SECONDARY = BuildConfig.DATA_PLANE_URL_SECONDARY +const val CONTROL_PLANE_URL_SECONDARY = BuildConfig.CONTROL_PLANE_URL_SECONDARY +const val METRICS_BASE_URL = "BASE_URL" diff --git a/samples/sample-kotlin-android/src/main/kotlin/com/rudderstack/android/sampleapp/mainview/MainActivity.kt b/samples/sample-kotlin-android/src/main/kotlin/com/rudderstack/android/sampleapp/mainview/MainActivity.kt index 1e005b4e8..873f6d198 100644 --- a/samples/sample-kotlin-android/src/main/kotlin/com/rudderstack/android/sampleapp/mainview/MainActivity.kt +++ b/samples/sample-kotlin-android/src/main/kotlin/com/rudderstack/android/sampleapp/mainview/MainActivity.kt @@ -60,7 +60,7 @@ class MainActivity : ComponentActivity() { userScrollEnabled = true, modifier = Modifier .fillMaxWidth() - .padding(vertical = 16.dp) + .padding(vertical = 8.dp) .weight(1f) ) { items(logCatList.size, null) { index -> @@ -102,48 +102,85 @@ class MainActivity : ComponentActivity() { .padding(8.dp), horizontalAlignment = Alignment.CenterHorizontally ) { + Text(text = "Primary Analytics", modifier = Modifier.padding(2.dp).align(Alignment + .CenterHorizontally), ) CreateRowOfApis( names = arrayOf( - AnalyticsState.InitializeAnalytics, AnalyticsState.ShutDownAnalytics, - AnalyticsState.ClearAnalytics, - ), weight = .3f, viewModel = viewModel + AnalyticsState.ForceFlush, + AnalyticsState.OptInAnalytics + ), weight = .5f, viewModel = viewModel ) - Spacer(modifier = Modifier.height(8.dp)) CreateRowOfApis( - names = arrayOf(AnalyticsState.AliasEvent, AnalyticsState.TrackEvent, AnalyticsState.ScreenEvent), + names = arrayOf(AnalyticsState.AliasEvent, + AnalyticsState.TrackEvent, + AnalyticsState.ScreenEvent), weight = .3f, viewModel = viewModel ) - Spacer(modifier = Modifier.height(8.dp)) CreateRowOfApis( names = arrayOf(AnalyticsState.IdentifyEvent, AnalyticsState.GroupEvent), weight = .5f, viewModel = viewModel ) - Spacer(modifier = Modifier.height(8.dp)) CreateRowOfApis( - names = arrayOf(AnalyticsState.OptInAnalytics, AnalyticsState.ForceFlush), + names = arrayOf(AnalyticsState.StartManualSession, AnalyticsState.EndSession), weight = .5f, viewModel = viewModel ) CreateRowOfApis( - names = arrayOf(AnalyticsState.StartManualSession, AnalyticsState.EndSession), + names = arrayOf(AnalyticsState.EnableAutoTracking, AnalyticsState.DisableAutoTracking), weight = .5f, viewModel = viewModel ) + Text(text = "Secondary Analytics", modifier = Modifier.padding(8.dp).align(Alignment + .CenterHorizontally), ) + Spacer(modifier = Modifier.height(2.dp)) CreateRowOfApis( - names = arrayOf(AnalyticsState.EnableAutoTracking, AnalyticsState.DisableAutoTracking), + names = arrayOf( + AnalyticsState.ShutDownAnalyticsSecondary, + AnalyticsState.ForceFlushSecondary, + AnalyticsState.OptInAnalyticsSecondary + ), weight = .3f, viewModel = viewModel + ) + Spacer(modifier = Modifier.height(2.dp)) + CreateRowOfApis( + names = arrayOf(AnalyticsState.AliasEventSecondary, + AnalyticsState.TrackEventSecondary, + AnalyticsState.ScreenEventSecondary), + weight = .3f, + viewModel = viewModel + ) + Spacer(modifier = Modifier.height(2.dp)) + CreateRowOfApis( + names = arrayOf(AnalyticsState.IdentifyEventSecondary, AnalyticsState + .GroupEventSecondary), + weight = .5f, + viewModel = viewModel + ) + Spacer(modifier = Modifier.height(2.dp)) + + CreateRowOfApis( + names = arrayOf(AnalyticsState.StartManualSessionSecondary, AnalyticsState + .EndSessionSecondary), + weight = .5f, + viewModel = viewModel + ) + Spacer(modifier = Modifier.height(2.dp)) + CreateRowOfApis( + names = arrayOf(AnalyticsState.EnableAutoTrackingSecondary, AnalyticsState + .DisableAutoTrackingSecondary), weight = .5f, viewModel = viewModel ) - Spacer(modifier = Modifier.height(8.dp)) CreateRowOfApis( - names = arrayOf(AnalyticsState.SendError), + names = arrayOf(AnalyticsState.SendError, + AnalyticsState.ClearAnalytics, + ), weight = .5f, viewModel = viewModel ) - Spacer(modifier = Modifier.height(8.dp)) + Spacer(modifier = Modifier.height(2.dp)) CreateLogcat(state.logDataList) } } diff --git a/samples/sample-kotlin-android/src/main/kotlin/com/rudderstack/android/sampleapp/mainview/MainViewModel.kt b/samples/sample-kotlin-android/src/main/kotlin/com/rudderstack/android/sampleapp/mainview/MainViewModel.kt index d69a0e899..202c9c521 100644 --- a/samples/sample-kotlin-android/src/main/kotlin/com/rudderstack/android/sampleapp/mainview/MainViewModel.kt +++ b/samples/sample-kotlin-android/src/main/kotlin/com/rudderstack/android/sampleapp/mainview/MainViewModel.kt @@ -3,14 +3,17 @@ package com.rudderstack.android.sampleapp.mainview import android.app.Application import androidx.lifecycle.AndroidViewModel import com.rudderstack.android.applyConfigurationAndroid -import com.rudderstack.android.sampleapp.MyApplication import com.rudderstack.android.sampleapp.analytics.RudderAnalyticsUtils +import com.rudderstack.android.sampleapp.analytics.RudderAnalyticsUtils.primaryAnalytics +import com.rudderstack.android.sampleapp.analytics.RudderAnalyticsUtils.secondaryAnalytics import com.rudderstack.android.utilities.endSession import com.rudderstack.android.utilities.startSession +import com.rudderstack.core.Analytics import com.rudderstack.core.Plugin import com.rudderstack.core.RudderOptions import com.rudderstack.models.GroupTraits import com.rudderstack.models.IdentifyTraits +import com.rudderstack.models.Message import com.rudderstack.models.ScreenProperties import com.rudderstack.models.TrackProperties import kotlinx.coroutines.flow.MutableStateFlow @@ -23,72 +26,69 @@ class MainViewModel(application: Application) : AndroidViewModel(application) { private val _state = MutableStateFlow(MainViewModelState()) val state = _state.asStateFlow() - private var _rudderAnalytics = RudderAnalyticsUtils.getInstance() private var _rudderReporter = RudderAnalyticsUtils.getReporter() private val _loggingInterceptor by lazy { - Plugin { - val msg = it.message() - _state.update { state -> - state.copy( - logDataList = state.logDataList + LogData(Date(), msg.toString()) - ) + object : Plugin { + private var _instanceName: String? = null + override fun setup(analytics: Analytics) { + _instanceName = analytics.instanceName + } + + override fun intercept(chain: Plugin.Chain): Message { + val msg = chain.message() + _state.update { state -> + state.copy( + logDataList = state.logDataList + LogData( + Date(), "from $_instanceName, msg: $msg" + ) + ) + } + return chain.proceed(msg) } - it.proceed(msg) + + } } init { - _rudderAnalytics?.addPlugin(_loggingInterceptor) + primaryAnalytics.addPlugin(_loggingInterceptor) + secondaryAnalytics.addPlugin(_loggingInterceptor) } internal fun onEventClicked(analytics: AnalyticsState) { val log = when (analytics) { - AnalyticsState.InitializeAnalytics -> { - if (_rudderAnalytics?.isShutdown == false) { - "Already initialized" - } else { - _rudderAnalytics = RudderAnalyticsUtils.apply { - setInitializationListener { success, message -> - addLogData(LogData(Date(), "Init Response -> \nsuccess: ${success}, \nmessage: ${message}")) - } - initialize(getApplication()) - }.getInstance() - "Initializing Rudder Analytics" - } - } - AnalyticsState.ShutDownAnalytics -> { - _rudderAnalytics?.shutdown() + primaryAnalytics.shutdown() "Rudder Analytics is shutting down. Init again if needed. This might take a second" } AnalyticsState.TrackEvent -> { - _rudderAnalytics?.track( + primaryAnalytics.track( eventName = "Track at ${Date()}", trackProperties = TrackProperties("key1" to "prop1", "key2" to "prop2"), - options = RudderOptions.Builder().withIntegrations(mapOf("firebase" to false)).withExternalIds( - listOf(mapOf("fb_id" to "1234")) - ).build() + options = RudderOptions.Builder().withIntegrations(mapOf("firebase" to false)) + .withExternalIds( + listOf(mapOf("fb_id" to "1234")) + ).build() ) "Track message sent" } AnalyticsState.IdentifyEvent -> { - _rudderAnalytics?.identify( - userId = "some_user_id", - traits = IdentifyTraits("trait1" to "some_trait") + primaryAnalytics.identify( + userId = "some_user_id", traits = IdentifyTraits("trait1" to "some_trait") ) "Identify called" } AnalyticsState.AliasEvent -> { - _rudderAnalytics?.alias(newId = "user_new_id") + primaryAnalytics.alias(newId = "user_new_id") "Alias called" } AnalyticsState.GroupEvent -> { - _rudderAnalytics?.group( + primaryAnalytics.group( groupId = "group_id", groupTraits = GroupTraits("g_t1" to "t-1", "g_t2" to "t-2"), ) @@ -96,7 +96,7 @@ class MainViewModel(application: Application) : AndroidViewModel(application) { } AnalyticsState.ScreenEvent -> { - _rudderAnalytics?.screen( + primaryAnalytics.screen( screenName = "some_screen", category = "some_category", screenProperties = ScreenProperties() @@ -114,46 +114,126 @@ class MainViewModel(application: Application) : AndroidViewModel(application) { } AnalyticsState.OptInAnalytics -> { - _rudderAnalytics?.optOut(_rudderAnalytics?.isOptedOut == false) - "OPT ${if (_rudderAnalytics?.isOptedOut == true) "out" else "in"} pressed" + primaryAnalytics.optOut(primaryAnalytics.isOptedOut) + "OPT ${if (primaryAnalytics.isOptedOut) "out" else "in"} pressed" } AnalyticsState.ForceFlush -> { - _rudderAnalytics?.flush() + primaryAnalytics.flush() "Forcing a flush" } - AnalyticsState.SendError -> { - _rudderReporter?.errorClient?.leaveBreadcrumb("Error BC") - _rudderReporter?.errorClient?.addMetadata("Error MD", "md_key", "md_value") - _rudderReporter?.errorClient?.notify(Exception("Non Fatal Exception")) - "Sending an error" - } AnalyticsState.EnableAutoTracking -> { - _rudderAnalytics?.applyConfigurationAndroid{ + primaryAnalytics.applyConfigurationAndroid { copy(trackAutoSession = true) } "Auto tracking enabled" } + AnalyticsState.DisableAutoTracking -> { - _rudderAnalytics?.applyConfigurationAndroid{ + primaryAnalytics.applyConfigurationAndroid { copy(trackAutoSession = false) } "Auto tracking disabled" } + AnalyticsState.StartManualSession -> { - _rudderAnalytics?.startSession() + primaryAnalytics.startSession() "Manual Session Started" } + AnalyticsState.EndSession -> { - _rudderAnalytics?.endSession() + primaryAnalytics.endSession() "Session Ended" } + AnalyticsState.ShutDownAnalyticsSecondary -> { + secondaryAnalytics.shutdown() + "Rudder Analytics is shutting down. Init again if needed. This might take a second" + } + + AnalyticsState.TrackEventSecondary -> { + secondaryAnalytics.track( + eventName = "Track at ${Date()}", + trackProperties = TrackProperties("key1" to "prop1", "key2" to "prop2"), + options = RudderOptions.Builder().withIntegrations(mapOf("firebase" to false)) + .withExternalIds( + listOf(mapOf("fb_id" to "1234")) + ).build() + ) + "Track message sent" + } + AnalyticsState.IdentifyEventSecondary -> { + secondaryAnalytics.identify( + userId = "some_user_id", traits = IdentifyTraits("trait1" to "some_trait") + ) + "Identify called" + } + + AnalyticsState.AliasEventSecondary -> { + secondaryAnalytics.alias(newId = "user_new_id") + "Alias called" + } + + AnalyticsState.GroupEventSecondary -> { + secondaryAnalytics.group( + groupId = "group_id", + groupTraits = GroupTraits("g_t1" to "t-1", "g_t2" to "t-2"), + ) + "Group called" + } + + AnalyticsState.ScreenEventSecondary -> { + secondaryAnalytics.screen( + screenName = "some_screen", + category = "some_category", + screenProperties = ScreenProperties() + ) + "Screen called" + } + + AnalyticsState.OptInAnalyticsSecondary -> { + secondaryAnalytics.optOut(primaryAnalytics.isOptedOut) + "OPT ${if (primaryAnalytics.isOptedOut) "out" else "in"} pressed" + } + + AnalyticsState.ForceFlushSecondary -> { + secondaryAnalytics.flush() + "Forcing a flush" + } + + AnalyticsState.EnableAutoTrackingSecondary -> { + secondaryAnalytics.applyConfigurationAndroid { + copy(trackAutoSession = true) + } + "Auto tracking enabled" + } + + AnalyticsState.DisableAutoTrackingSecondary -> { + secondaryAnalytics.applyConfigurationAndroid { + copy(trackAutoSession = false) + } + "Auto tracking disabled" + } + + AnalyticsState.StartManualSessionSecondary -> { + secondaryAnalytics.startSession() + "Manual Session Started" + } + + AnalyticsState.EndSessionSecondary -> { + secondaryAnalytics.endSession() + "Session Ended" + } + AnalyticsState.SendError -> { + _rudderReporter?.errorClient?.leaveBreadcrumb("Error BC") + _rudderReporter?.errorClient?.addMetadata("Error MD", "md_key", "md_value") + _rudderReporter?.errorClient?.notify(Exception("Non Fatal Exception")) + "Sending an error" + } else -> "What's this?" } - if (log.isNotEmpty()) - addLogData(LogData(Date(), log)) + if (log.isNotEmpty()) addLogData(LogData(Date(), log)) } private fun addLogData(logData: LogData) { @@ -165,7 +245,7 @@ class MainViewModel(application: Application) : AndroidViewModel(application) { } override fun onCleared() { - _rudderAnalytics?.removePlugin(_loggingInterceptor) + primaryAnalytics.removePlugin(_loggingInterceptor) super.onCleared() } } diff --git a/samples/sample-kotlin-android/src/main/kotlin/com/rudderstack/android/sampleapp/mainview/MainViewModelState.kt b/samples/sample-kotlin-android/src/main/kotlin/com/rudderstack/android/sampleapp/mainview/MainViewModelState.kt index ad86be380..59beb070b 100644 --- a/samples/sample-kotlin-android/src/main/kotlin/com/rudderstack/android/sampleapp/mainview/MainViewModelState.kt +++ b/samples/sample-kotlin-android/src/main/kotlin/com/rudderstack/android/sampleapp/mainview/MainViewModelState.kt @@ -10,7 +10,7 @@ data class MainViewModelState( data class LogData(val time: Date, val log: String) sealed class AnalyticsState(val eventName: String) { object ClearAnalytics : AnalyticsState("Clear") - object InitializeAnalytics : AnalyticsState("Initialize") +// object InitializeAnalytics : AnalyticsState("Initialize") object ShutDownAnalytics : AnalyticsState("ShutDown") object TrackEvent : AnalyticsState("Track") object IdentifyEvent : AnalyticsState("Identify") @@ -23,5 +23,18 @@ sealed class AnalyticsState(val eventName: String) { object EnableAutoTracking : AnalyticsState("Enable Auto Tracking") object DisableAutoTracking : AnalyticsState("Disable Auto Tracking") object ForceFlush : AnalyticsState("Force Flush") + + object ShutDownAnalyticsSecondary : AnalyticsState("ShutDown Secondary") + object TrackEventSecondary : AnalyticsState("Track Secondary") + object IdentifyEventSecondary : AnalyticsState("Identify Secondary") + object AliasEventSecondary : AnalyticsState("Alias Secondary") + object GroupEventSecondary : AnalyticsState("Group Secondary") + object ScreenEventSecondary : AnalyticsState("Screen Secondary") + object OptInAnalyticsSecondary : AnalyticsState("Opt In/Out Secondary") + object StartManualSessionSecondary : AnalyticsState("start manual session Secondary") + object EndSessionSecondary : AnalyticsState("End Session Secondary") + object EnableAutoTrackingSecondary : AnalyticsState("Enable Auto Tracking Secondary") + object DisableAutoTrackingSecondary : AnalyticsState("Disable Auto Tracking Secondary") + object ForceFlushSecondary : AnalyticsState("Force Flush Secondary") object SendError : AnalyticsState("Send Error") }