---
title: Product Analytics data capture - Android
description: Access to acquisition analysis and lifetime metrics by implementing the Product Analytics data capture using the CSQ SDK
lastUpdated: 08 July 2026
source_url:
  html: https://docs.contentsquare.com/en/csq-sdk-android/experience-analytics/set-up-product-analytics-data-capture/
  md: https://docs.contentsquare.com/en/csq-sdk-android/experience-analytics/set-up-product-analytics-data-capture/index.md
---

> Documentation index: https://docs.contentsquare.com/llms.txt
> Use this file to discover all available pages before exploring further.

This page instructs how to set up Product Analytics data capture in combination with Experience Analytics.

1. Initialize the SDK with your environment ID.

   * Product Analytics

     **MyApplication.kt**

     ```kotlin
     import android.app.Application
     import com.contentsquare.CSQ


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


         CSQ.start(
           context = this,
           StartConfig.withEnvironmentId(
             id = "YOUR_ENVIRONMENT_ID"
           )
         )


       }
     }
     ```

     Find your environment ID

     `YOUR_ENVIRONMENT_ID` is either provided to you by Contentsquare or you can find it in **Account** > **Manage** > **Projects** > \[Select your project] > **Environments** within the [Product Analytics web app ↗](https://heapanalytics.com/app/).

   * CSQ Experience Platform (Early Access)

     **MyApplication.kt**

     ```kotlin
     import android.app.Application
     import com.contentsquare.CSQ


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


         CSQ.start(
           context = this,
           StartConfig.withDataSourceId(
             id = "YOUR_DATASOURCE_ID"
           )
         )


       }
     }
     ```

     Find your data source ID

     `YOUR_DATASOURCE_ID` is either provided to you by Contentsquare or you can find it in **Definitions** > **Data sources** > \[Expand your mobile data source] > \[Copy the App ID in step 1] within the [CSQ Experience Platform web app ↗](https://app.contentsquare.com/).

2. Add the Android View Autocapture Plugin to instrument your app code:

   * Kotlin

     **build.gradle.kts**

     ```kotlin
     plugins {
       // ...


       id("io.heap.gradle") version "1.1.1"
     }
     ```

   * Groovy

     **build.gradle**

     ```groovy
     plugins {
       // ...


       id 'io.heap.gradle' version "1.1.1"
     }
     ```

3. Set up autocapture by adding `enableViewAutocapture = true`.

   * Product Analytics

     **MyApplication.kt**

     ```kotlin
     import android.app.Application
     import com.contentsquare.CSQ


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


         CSQ.start(
           context = this,
           StartConfig.withEnvironmentId(
             id = "YOUR_ENVIRONMENT_ID",
             options = AnalyticsOptions(
               enableViewAutocapture = true
             )
           )
         )


       }
     }
     ```

   * CSQ Experience Platform (Early Access)

     **MyApplication.kt**

     ```kotlin
     import android.app.Application
     import com.contentsquare.CSQ


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


         CSQ.start(
           context = this,
           StartConfig.withDataSourceId(
             id = "YOUR_DATASOURCE_ID",
             options = AnalyticsOptions(
               enableViewAutocapture = true
             )
           )
         )


       }
     }
     ```

4. (Optional) For Jetpack Compose, add the dedicated import and register the Compose Autocapture SDK.

   * Kotlin

     **build.gradle.kts**

     ```kotlin
     dependencies {
       implementation("com.contentsquare.android:sdk:1.11.2")
       implementation("com.contentsquare.android:sdk-compose:1.11.2")
     }
     ```

   * Groovy

     **build.gradle**

     ```groovy
     dependencies {
       implementation 'com.contentsquare.android:sdk:1.11.2'
       implementation 'com.contentsquare.android:sdk-compose:1.11.2'
     }
     ```

   - Product Analytics

     **MyApplication.kt**

     ```kotlin
     import android.app.Application
     import com.contentsquare.CSQ
     import io.heap.autocapture.compose.ComposeAutocaptureSDK


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


         ComposeAutocaptureSDK.register()


         CSQ.start(
           context = this,
           StartConfig.withEnvironmentId(
             id = "YOUR_ENVIRONMENT_ID",
             options = AnalyticsOptions(
               enableViewAutocapture = true
             )
           )
         )


       }
     }
     ```

   - CSQ Experience Platform (Early Access)

     **MyApplication.kt**

     ```kotlin
     import android.app.Application
     import com.contentsquare.CSQ
     import io.heap.autocapture.compose.ComposeAutocaptureSDK


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


         ComposeAutocaptureSDK.register()


         CSQ.start(
           context = this,
           StartConfig.withDataSourceId(
             id = "YOUR_DATASOURCE_ID",
             options = AnalyticsOptions(
               enableViewAutocapture = true
             )
           )
         )


       }
     }
     ```

5. (Optional) If your Product Analytics environment is hosted in the EU, set the `baseUri` option to `https://mh.ba.contentsquare.net`.

   * Product Analytics

     **MyApplication.kt**

     ```kotlin
     import android.app.Application
     import com.contentsquare.CSQ


     class 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")
             )
           )
         )
       }
     }
     ```

   * CSQ Experience Platform (Early Access)

     **MyApplication.kt**

     ```kotlin
     import android.app.Application
     import com.contentsquare.CSQ


     class 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")
             )
           )
         )
       }
     }
     ```

1) Add the `disablePageviewAutocapture: true` option to the configuration.

   * Product Analytics

     **MyApplication.kt**

     ```kotlin
     import android.app.Application
     import com.contentsquare.CSQ


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


         CSQ.start(
           context = this,
           StartConfig.withEnvironmentId(
             id = "YOUR_ENVIRONMENT_ID",
             options = AnalyticsOptions(
               enableViewAutocapture = true,
               disablePageviewAutocapture = true
             )
           )
         )


       }
     }
     ```

   * CSQ Experience Platform (Early Access)

     **MyApplication.kt**

     ```kotlin
     import android.app.Application
     import com.contentsquare.CSQ


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


         CSQ.start(
           context = this,
           StartConfig.withDataSourceId(
             id = "YOUR_DATASOURCE_ID",
             options = AnalyticsOptions(
               enableViewAutocapture = true,
               disablePageviewAutocapture = true
             )
           )
         )


       }
     }
     ```
