---
title: Getting Started with Product Analytics - Android
description: Integrate the CSQ SDK for Product Analytics into your Android app in minutes
source_url:
  html: https://docs.contentsquare.com/en/csq-sdk-android/product-analytics/
  md: https://docs.contentsquare.com/en/csq-sdk-android/product-analytics/index.md
---

> ## Documentation index
> Fetch the complete documentation index at: https://docs.contentsquare.com/llms.txt
> Use this file to discover all available pages before exploring further.

This quick start guide shows you how to get Contentsquare Product Analytics set up in an Android application.

## Setup with agents

1. Run the wizard in your project directory:

   ```shell
   npx @contentsquare/wizard install
   ```

2. Paste this prompt into your AI coding assistant:

   ```text
   Install Contentsquare for Android.
   ```

Prefer to install our skill manually or need custom prompts? See [AI setup for Android](https://docs.contentsquare.com/csq-sdk-android/product-analytics/ai-setup/).

Prefer to set things up manually? Continue with the steps below.

## Manual setup

Once you've completed the setup process, the Contentsquare SDK will capture a wide variety of user interactions in your application with no additional code required.

> **Upgrading**
>
> See our guides to upgrade to the CSQ SDK from the [Heap Core SDK](https://docs.contentsquare.com/en/csq-sdk-android/product-analytics/upgrade-from-heap-core-sdk/) or the [Heap Classic SDK](https://docs.contentsquare.com/en/csq-sdk-android/product-analytics/upgrade-from-heap-classic-sdk/).

### Install the SDK

1. In your app-level `build.gradle` file, add the dependency for the CSQ SDK and the CSQ Compose SDK.

   * Kotlin

     **build.gradle.kts**

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

   * Groovy

     **build.gradle**

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

2. Apply the Contentsquare Gradle plugin to your Android application module to instrument your app code. If the root build file declares plugin versions with `apply false`, declare the version there and apply the plugin in the application module without repeating the version.

   The Contentsquare Gradle plugin requires Android Gradle Plugin (AGP) 8.1 or later.

   * Kotlin

     **build.gradle.kts**

     ```kotlin
     plugins {
       // ...

       id("com.contentsquare.gradle") version "1.1.1"
     }
     ```

   * Groovy

     **build.gradle**

     ```groovy
     plugins {
       // ...

       id 'com.contentsquare.gradle' version "1.1.1"
     }
     ```

   When upgrading from `io.heap.gradle` or `com.contentsquare.error.analysis.network`, remove the old plugin declaration. The Contentsquare Gradle plugin replaces both, and the build fails if one of them is applied to the same module.

3. Once the dependencies and plugins have been added, sync Gradle and rebuild your application.

### Start the SDK

1. Configure and start the SDK with `CSQ.start()`.

   * 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/).

   * Experience Platform

     **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 the [CSQ Experience Platform web app ↗](https://app.contentsquare.com/): Open the project selector then navigate to **Project Settings** > **Data sources**, expand your mobile data source, and copy the ID in step 1.

2. Enable autocapture by setting `enableViewAutocapture` to `true`.

   * Product Analytics

     **MyApplication.kt**

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

   * Experience Platform

     **MyApplication.kt**

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

   > **Autocapture and screenviews**
   >
   > With `enableViewAutocapture` set to `true`, `CSQ.start()` registers both Views and Jetpack Compose autocapture.
   >
   > The SDK also reports each Fragment, Jetpack Compose destination, or custom screen as its own screenview.
   >
   > For more information, see [Track screenviews](https://docs.contentsquare.com/en/csq-sdk-android/product-analytics/track-screenviews/#set-up-screens-for-your-navigation).

3. (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")
             )
           )
         )
       }
     }
     ```

   * Experience Platform

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

4. Implement the `optIn()` API to forward user consent to the SDK, generate a user ID, and initiate tracking.

   * Product Analytics

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

     class MyApplication : Application() {
       override fun onCreate() {
           super.onCreate()
           CSQ.start(this, StartConfig.withEnvironmentId("YOUR_ENVIRONMENT_ID"))
       }
     }

     // ConsentActivity
     val optinButton: Button = findViewById(R.id.btn_accept_tracking)

     optinButton.setOnClickListener {
       CSQ.optIn()
       startActivity(Intent(this, MainActivity::class.java))
     }
     ```

   * Experience Platform

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

     class MyApplication : Application() {
       override fun onCreate() {
           super.onCreate()
           CSQ.start(this, StartConfig.withDataSourceId("YOUR_DATASOURCE_ID"))
       }
     }

     // ConsentActivity
     val optinButton: Button = findViewById(R.id.btn_accept_tracking)

     optinButton.setOnClickListener {
       CSQ.optIn()
       startActivity(Intent(this, MainActivity::class.java))
     }
     ```

   Once tracking has started, you're able to take full advantage of the CSQ SDK API to identify users, track custom events, and more.

   Contentsquare's Product Analytics module will also automatically start tracking a wide range of user interactions, view controller changes, and app version changes without any additional code.

5. Start your application, and check logs for this output:

   ```text
   [INFO] CSQ 1.13.0 for Product Analytics is attempting to start.
   ```

## Next steps

Our SDK offers a wide range of features to enhance your implementation, including extended tracking capabilities, and personal data masking.

[Track screenviews](https://docs.contentsquare.com/en/csq-sdk-android/product-analytics/track-screenviews/)

: Set up screenview autocapture for Activities, Fragments, and Compose navigation

[Track identity](https://docs.contentsquare.com/en/csq-sdk-android/product-analytics/track-identity/)

: Link anonymous and identified user data across sessions and devices for comprehensive analytics

[Track push notifications](https://docs.contentsquare.com/en/csq-sdk-android/product-analytics/track-push-notifications/)

: Track mobile notification interactions automatically

[Track events manually](https://docs.contentsquare.com/en/csq-sdk-android/product-analytics/track-events-manually/)

: Learn how to track custom events

[Hide sensitive data](https://docs.contentsquare.com/en/csq-sdk-android/product-analytics/hide-sensitive-data/)

: Protect sensitive data by disabling text capture, masking specific views, or ignoring interactions

Session Replay and Error Monitoring are both available with the [Experience Analytics extension](https://docs.contentsquare.com/en/csq-sdk-android/product-analytics/dxae-setup/), which you can purchase separately.

[Experience Analytics extension](https://docs.contentsquare.com/en/csq-sdk-android/product-analytics/dxae-setup/)


```json
{"@context":"https://schema.org","@type":"TechArticle","headline":"Getting Started with Product Analytics","description":"Integrate the CSQ SDK for Product Analytics into your Android app in minutes","url":"https://docs.contentsquare.com/en/csq-sdk-android/product-analytics/","inLanguage":"en","dateModified":"2026-10-23T12:39:09+02:00","publisher":{"@type":"Organization","name":"Contentsquare","url":"https://www.contentsquare.com/"},"isPartOf":{"@type":"WebSite","@id":"https://docs.contentsquare.com/#website","name":"Contentsquare Technical Documentation","url":"https://docs.contentsquare.com/"}}
```