Set up Product Analytics data capture
This page instructs how to set up Product Analytics data capture in combination with Experience Analytics.
-
Initialize the SDK with your environment ID.
- Standalone
- Unified CSQ
Onboard to Unified CSQ, our latest, all-in-one platform offering.
Reach out to your Customer Success Manager for more information.
MyApplication.kt import android.app.Applicationimport com.contentsquare.CSQclass MyApplication : Application() {override fun onCreate() {super.onCreate()CSQ.start(context = this,StartConfig.withEnvironmentId(id = "YOUR_ENVIRONMENT_ID"))}}MyApplication.kt import android.app.Applicationimport com.contentsquare.CSQclass MyApplication : Application() {override fun onCreate() {super.onCreate()CSQ.start(context = this,StartConfig.withDataSourceId(id = "YOUR_DATASOURCE_ID"))}} -
Add the Android View Autocapture Plugin to instrument your app code:
build.gradle.kts plugins {// ...id("io.heap.gradle") version "1.1.1"}build.gradle plugins {// ...id 'io.heap.gradle' version "1.1.1"}
-
Set up autocapture by adding
enableViewAutocapture = true.- Standalone
- Unified CSQ
Onboard to Unified CSQ, our latest, all-in-one platform offering.
Reach out to your Customer Success Manager for more information.
MyApplication.kt import android.app.Applicationimport com.contentsquare.CSQclass MyApplication : Application() {override fun onCreate() {super.onCreate()CSQ.start(context = this,StartConfig.withEnvironmentId(id = "YOUR_ENVIRONMENT_ID",options = AnalyticsOptions(enableViewAutocapture = true)))}}MyApplication.kt import android.app.Applicationimport com.contentsquare.CSQclass MyApplication : Application() {override fun onCreate() {super.onCreate()CSQ.start(context = this,StartConfig.withDataSourceId(id = "YOUR_DATASOURCE_ID",options = AnalyticsOptions(enableViewAutocapture = true)))}}
-
(Optional) For Jetpack Compose, add the dedicated import and register the Compose Autocapture SDK.
build.gradle.kts dependencies {implementation("com.contentsquare.android:sdk:1.10.0")implementation("com.contentsquare.android:sdk-compose:1.10.0")}build.gradle dependencies {implementation 'com.contentsquare.android:sdk:1.10.0'implementation 'com.contentsquare.android:sdk-compose:1.10.0'}- Standalone
- Unified CSQ
Onboard to Unified CSQ, our latest, all-in-one platform offering.
Reach out to your Customer Success Manager for more information.
MyApplication.kt import android.app.Applicationimport com.contentsquare.CSQimport io.heap.autocapture.compose.ComposeAutocaptureSDKclass MyApplication : Application() {override fun onCreate() {super.onCreate()ComposeAutocaptureSDK.register()CSQ.start(context = this,StartConfig.withEnvironmentId(id = "YOUR_ENVIRONMENT_ID",options = AnalyticsOptions(enableViewAutocapture = true)))}}MyApplication.kt import android.app.Applicationimport com.contentsquare.CSQimport io.heap.autocapture.compose.ComposeAutocaptureSDKclass MyApplication : Application() {override fun onCreate() {super.onCreate()ComposeAutocaptureSDK.register()CSQ.start(context = this,StartConfig.withDataSourceId(id = "YOUR_DATASOURCE_ID",options = AnalyticsOptions(enableViewAutocapture = true)))}} -
(Optional) If your Product Analytics environment is hosted in the EU, set the
baseUrioption tohttps://mh.ba.contentsquare.net.- Standalone
- Unified CSQ
Onboard to Unified CSQ, our latest, all-in-one platform offering.
Reach out to your Customer Success Manager for more information.
MyApplication.kt import android.app.Applicationimport com.contentsquare.CSQclass MyApplication : Application() {override fun onCreate() {super.onCreate()CSQ.start(context = this,StartConfig.withEnvironmentId(id = "YOUR_ENVIRONMENT_ID",options = AnalyticsOptions(enableViewAutocapture = true,baseUri = URI.create("https://mh.ba.contentsquare.net"))))}}MyApplication.kt import android.app.Applicationimport com.contentsquare.CSQclass MyApplication : Application() {override fun onCreate() {super.onCreate()CSQ.start(context = this,StartConfig.withDataSourceId(id = "YOUR_DATASOURCE_ID",options = AnalyticsOptions(enableViewAutocapture = true,baseUri = URI.create("https://mh.ba.contentsquare.net"))))}}
-
Add the
disablePageviewAutocapture: trueoption to the configuration.- Standalone
- Unified CSQ
Onboard to Unified CSQ, our latest, all-in-one platform offering.
Reach out to your Customer Success Manager for more information.
MyApplication.kt import android.app.Applicationimport com.contentsquare.CSQclass MyApplication : Application() {override fun onCreate() {super.onCreate()CSQ.start(context = this,StartConfig.withEnvironmentId(id = "YOUR_ENVIRONMENT_ID",options = AnalyticsOptions(enableViewAutocapture = true,disablePageviewAutocapture = true)))}}MyApplication.kt import android.app.Applicationimport com.contentsquare.CSQclass MyApplication : Application() {override fun onCreate() {super.onCreate()CSQ.start(context = this,StartConfig.withDataSourceId(id = "YOUR_DATASOURCE_ID",options = AnalyticsOptions(enableViewAutocapture = true,disablePageviewAutocapture = true)))}}