---
title: Getting Started with Experience Analytics - Android
description: Integrate the Contentsquare SDK into your Android app in minutes (installation, user consent, screen tracking, and testing)
lastUpdated: 05 May 2026
source_url:
  html: https://docs.contentsquare.com/fr/csq-sdk-android/experience-analytics/
  md: https://docs.contentsquare.com/fr/csq-sdk-android/experience-analytics/index.md
---

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

Note

Cette page est affichée en anglais car elle n'est pas disponible dans votre langue.

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

After completing the setup process, you'll be able to take full advantage of the CSQ API to collect data from your app, within just a few minutes.

Upgrading

See our guide to upgrade to the CSQ SDK from the [CS SDK](upgrade-from-cs-sdk/).

## Install the SDK

1. Add the CSQ SDK dependency to your Gradle build file:

   * Kotlin

     **build.gradle.kts**

     ```kotlin
     implementation("com.contentsquare.android:sdk:1.10.1")
     ```

   * Groovy

     **build.gradle**

     ```groovy
     implementation "com.contentsquare.android:sdk:1.10.1"
     ```

2. Synchronize your Gradle project to be able to use the CSQ API.

## Start the SDK

1. Add a call to [`CSQ.start(context)`](command-reference/#csqstart) within `onCreate()` of a custom Application subclass:

   * Standalone

     **MyApplication.kt**

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


     class MyApplication : Application() {
       override fun onCreate() {
         super.onCreate()
         CSQ.start(this)
       }
     }
     ```

   * Unified CSQ

     **MyApplication.kt**

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

     Find your datasource 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 [Unified CSQ web app ↗](https://app.contentsquare.com/).

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

   ```text
   [INFO] CSQ 1.10.1 for Experience Analytics is attempting to start.
   ```

## Get user consent

The CSQ SDK treats users as opted-out by default.

Implement the [`optIn()`](command-reference/#csqoptin) API to forward user consent to the SDK and generate a user ID.

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


class MyApplication : Application() {
  override fun onCreate() {
      super.onCreate()
      CSQ.start(this)
  }
}


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


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

Start your application, click the UI that triggers the opt-in, and check logs for this output:

```text
User is drawn for tracking: true
```

## Track your first screens

Contentsquare aggregates the user behavior and engagement at the screen level. Start your SDK implementation by tracking key screens like the home screen, product list, product details, or conversion funnel.

Once tracking has started, you're able to take full advantage of the CSQ SDK API to track screen views, monitor user interactions, and capture app behavior data.

Contentsquare Experience Analytics also comes with powerful Session Replay and Error Monitoring capabilities as paid options.

### Sending screenview events

Screen tracking is achieved by sending a `screenview` event when:

* The screen appears on the device
* A modal or pop-up is displayed
* A modal or pop-up is closed, returning the user to the screen
* The app is brought back to the foreground (after being minimized)

To trigger a screenview each time an activity becomes visible, place the call in the `onResume()` method (Android view system only):

```kotlin
import com.contentsquare.CSQ


class MyActivity : Activity() {
    override fun onResume() {
        super.onResume()
        // Send screenView
        CSQ.trackScreenview("screen_name")
    }
}
```

For more information, see [Implementation recommendations](track-screens/#implementation-recommendations)

#### Jetpack Compose support

To enable Jetpack Compose support, add a new dependency to your Gradle build file.

* Kotlin

  **build.gradle.kts**

  ```kotlin
  implementation("com.contentsquare.android:sdk-compose:1.10.1")
  ```

* Groovy

  **build.gradle**

  ```groovy
  implementation 'com.contentsquare.android:sdk-compose:1.10.1'
  ```

Attention must be paid to recompositions. The call should be wrapped using `TriggeredOnResume` to ensure only one screenview is triggered when a given screen is presented to the user.

```kotlin
import com.contentsquare.CSQ
import com.contentsquare.api.compose.TriggeredOnResume


@Composable
fun MyComposable(data: Data) {
  TriggeredOnResume {
      CSQ.trackScreenview("screen_name")
  }
  // ...
}
```

#### Tracking app launch

Most events collected by the SDK require a screenview event to be sent first so they can be associated with that screen; otherwise, they will be discarded. If you need to collect events from the moment the app launches, you should trigger a screenview event immediately after the SDK has started.

Refer to [our guide](track-screens/#when-to-send-your-first-screenview) for implementation examples.

#### Screen name handling

It is necessary to provide a name for each screen when calling the screenview API.

As a general rule, keep distinct screen names under 100. As they are used to map your app in Contentsquare, you will want something comprehensive. The screen name length is not limited on the SDK side. However, the limit is 2083 characters on the server side.

More on [screen name handling](track-screens/#how-to-name-screens).

Tracking plan

To get the most out of your data, it's best to follow a tracking plan. This way, you'll capture every step of the user's journey without missing important interactions, giving you a complete picture of how your app is used.

## Sample app

To explore some of these features in context, check our Android sample app.

### [contentsquare-android-sample](https://github.com/ContentSquare/contentsquare-android-sample)

[Kotlin](https://github.com/ContentSquare/contentsquare-android-sample)

## Next Steps

While screen tracking gives an overview of user navigation, capturing session, screen, or user metadata provides a deeper understanding of the context behind user behavior.

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

Proceed with these how-to's to refine your implementation.

[Custom Variables ](track-custom-variables/)Collect additional details about the screen or the user.

[Dynamic Variables ](track-dynamic-variables/)Collect additional information about the session.

[Transactions tracking ](track-transactions/)Associate user's session with their potential purchases and corresponding revenue.

[WebViews ](track-webviews/)For native apps which embark web applications or pages.

[Session Replay ](session-replay/)Collect data for Session Replay in compliance personal data masking.

[Error Analysis ](error-analysis/)Track API errors and application crashes with automated collection and privacy-safe debugging tools.
