---
title: From Contentsquare SDK to CSQ SDK - Android
description: Learn how to migrate from the Contentsquare SDK to the CSQ SDK
lastUpdated: 12 May 2026
source_url:
  html: https://docs.contentsquare.com/en/csq-sdk-android/experience-analytics/upgrade-from-cs-sdk/
  md: https://docs.contentsquare.com/en/csq-sdk-android/experience-analytics/upgrade-from-cs-sdk/index.md
---

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

Faster implementation using agent skills

Use [Agent skills](https://docs.contentsquare.com/csq-sdk-android/experience-analytics/using-agent-skills/) to let your AI coding assistant handle SDK setup, version migration, and feature implementation automatically.

This guide provides a step-by-step upgrade process from your current installation of Contentsquare Mobile SDK to the latest version of the CSQ SDK.

![Contentsquare SDK](https://docs.contentsquare.com/cs-logo.png)

**Contentsquare SDK**

→

![CSQ SDK](https://docs.contentsquare.com/csq-logo.png)

**CSQ SDK**

The latest version of our SDK provides a unified set of APIs for Product Analytics, Experience Analytics, and Experience Monitoring, eliminating redundant APIs that perform the same actions.

Upgrading to the latest version ensures you benefit from all our newest features and product enhancements.

## Dependency upgrades

Replace Contentsquare SDK dependencies with the CSQ SDK:

* Kotlin

  **build.gradle**

  ```diff
  implementation("com.contentsquare.android:library:4.39.1")
  implementation("com.contentsquare.android:compose:4.39.1")
  implementation("com.contentsquare.android:sdk:1.11.0")
  implementation("com.contentsquare.android:sdk-compose:1.11.0")
  ```

* Groovy

  **build.gradle**

  ```diff
  implementation 'com.contentsquare.android:library:4.39.1'
  implementation 'com.contentsquare.android:compose:4.39.1'
  implementation 'com.contentsquare.android:sdk:1.11.0'
  implementation 'com.contentsquare.android:sdk-compose:1.11.0'
  ```

## Library imports

Replace the Contentsquare SDK import with a CSQ SDK import.

```diff
import com.contentsquare.android.Contentsquare
import com.contentsquare.CSQ
```

## SDK start

Start the CSQ SDK manually using `CSQ.start()` — unlike earlier versions, it no longer starts automatically.

**MyApplication.kt**

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


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


    CSQ.start(this)
  }
}
```

Note

(Optional) If you have chosen to deactivate the autostart of the Contentsquare SDK, you can now remove the entry in the manifest, as the CSQ SDK doesn't have an autostart.

**AndroidManifest.xml**

```xml
<application>
  ...
    <meta-data
      android:name="com.contentsquare.android.autostart"
      android:value="false"
    />
  ...
</application>
```

## Get user consent

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

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

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.

## Transactions

1. Update your transaction imports:

   ```diff
   import com.contentsquare.android.api.model.Transaction
   import com.contentsquare.api.model.Transaction
   ```

2. Update your currency imports:

   ```diff
   import com.contentsquare.android.api.Currencies
   import com.contentsquare.api.model.Currency
   ```

3. Replace the currency type from `Int` to `Currency` enum:

   ```diff
   val currency: Int = Currencies.USD
   val currency: Currency = Currency.USD
   ```

4. Replace `Transaction.builder` by `Transaction` and `Contentsquare.send()` by `CSQ.trackTransaction()`:

   ```diff
   val builder = Transaction.builder(100f, Currency.EUR).id("optionalId")
   Contentsquare.send(builder.build())
   val transaction = Transaction(100f, Currency.EUR, "optionalId")
   CSQ.trackTransaction(transaction)
   ```

## API Errors

If you manually added an OkHttp interceptor (`ErrorAnalysisInterceptor`) to monitor network requests, switch to the new `CsqOkHttpInterceptor`:

```diff
import com.contentsquare.android.error.analysis.network.ErrorAnalysisInterceptor
import com.contentsquare.api.contract.CsqOkHttpInterceptor


OkHttpClient().newBuilder()
  .addInterceptor(ErrorAnalysisInterceptor())
  .addInterceptor(CsqOkHttpInterceptor())
  .build()
```

## Update APIs

Search and replace all legacy SDK API calls in your app to the latest CSQ APIs using the following mappings. Updating your API calls ensures continued functionality without disruption.

```diff
Contentsquare.start(this)
CSQ.start(this)
```

For more information on SDK methods, see the [SDK API reference](../command-reference/).

### GDPR / Identification

| Contentsquare SDK | CSQ SDK |
| - | - |
| `Contentsquare.optIn(context: Context)` | `CSQ.optIn()` |
| `Contentsquare.optOut(context: Context)` | `CSQ.optOut()` |
| `Contentsquare.getUserId()` | `CSQ.metadata.userId` |
| `Contentsquare.getProjectId()` | `CSQ.metadata.projectId` |
| `Contentsquare.getSessionNumber()` | `CSQ.metadata.sessionId` |
| `Contentsquare.sendUserIdentifier(identifier: String)` | `CSQ.sendUserIdentifier(identifier: String)` |

### Property tracking

| Contentsquare SDK | CSQ SDK |
| - | - |
| `Contentsquare.send(key: String, value: Long)` | `CSQ.addDynamicVar(key: String, value: Long)` |
| `Contentsquare.send(key: String, value: String)` | `CSQ.addDynamicVar(key: String, value: String)` |

### View tracking

| Contentsquare SDK | CSQ SDK |
| - | - |
| `Contentsquare.excludeFromExposureMetric(view: View)` | `CSQ.excludeFromExposureMetric(view: View)` |

### Interoperability

| Contentsquare SDK | CSQ SDK |
| - | - |
| `Contentsquare.onSessionReplayLinkChange(callback: Consumer<String>)` | `CSQ.metadata.onChanged(metadata: Metadata)` |
| `CsWebViewManager.injectEventTrackingInterface(webView: WebView)` | `CSQ.registerWebView(webView: WebView)` |
| `CsWebViewManager.removeEventTrackingInterface(webView: WebView)` | `CSQ.unregisterWebView(webView: WebView)` |

### Event tracking

| Contentsquare SDK | CSQ SDK |
| - | - |
| `Contentsquare.send(transaction: Transaction)` | `CSQ.trackTransaction(transaction: Transaction)` |
| `Contentsquare.send(screenName: String)` / `Contentsquare.send(screenName: String, customVars: Array<CustomVar>)` | `CSQ.trackScreenview(name: String, customVars: List<CustomVar>)` |
| `Contentsquare.consumeEvent(motionEvent: MotionEvent)` | `CSQ.trackMotionEvent(motionEvent: MotionEvent)` |

Jetpack compose

| Contentsquare SDK | CSQ SDK |
| - | - |
| `import com.contentsquare.android.compose.analytics.TriggeredOnResume` `TriggeredOnResume(block: () -> Unit)` | `import com.contentsquare.api.compose.screen.TriggeredOnResume` `TriggeredOnResume(block: () -> Unit)` |

### Error tracking

| Contentsquare SDK | CSQ SDK |
| - | - |
| `import com.contentsquare.android.error.analysis.network.ErrorAnalysisInterceptor` | `import com.contentsquare.api.contract.CsqOkHttpInterceptor` |
| `import com.contentsquare.android.error.analysis.ErrorAnalysis` | `import com.contentsquare.api.model.NetworkMetric` |
| `ErrorAnalysis.setUrlMaskingPatterns(patterns: List<String>)` | `CSQ.setUrlMaskingPatterns(patterns: List<String>)` |
| `ErrorAnalysis.getInstance().newNetworkMetric(url: String, httpMethod: HttpMethod)` | `NetworkMetric(url: String, httpMethod: HttpMethod)` |
| `ErrorAnalysisInterceptor()` | `CsqOkHttpInterceptor()` |

### Personal Data Handling and Masking

| Contentsquare SDK | CSQ SDK |
| - | - |
| `Contentsquare.doNotTrack(vararg activitiesClasses: Class<Activity?>)` | `CSQ.ignoreInteractions(view: View)` |
| `Contentsquare.setDefaultMasking(masked: Boolean)` | `CSQ.setDefaultMasking(masked: Boolean)` |
| `Contentsquare.mask(view: View)` | `CSQ.mask(view: View)` |
| `Contentsquare.mask(type: Class<*>)` | `CSQ.mask(type: Class<*>)` |
| `Contentsquare.unMask(view: View)` | `CSQ.unmask(view: View)` |
| `Contentsquare.unmask(type: Class<*>)` | `CSQ.unmask(type: Class<*>)` |
| `Contentsquare.maskMenuItem(resourceID: Int)` | `CSQ.maskMenuItem(resourceID: Int)` |
| `Contentsquare.unMaskMenuItem(resourceID: Int)` | `CSQ.unmaskMenuItem(resourceID: Int)` |

Kotlin extension functions

If you use Kotlin, the CSQ SDK comes with Extension functions for:

* `CSQ.ignoreInteractions(view: View)` -> `View.csqIgnoreInteractions(shouldIgnore: Boolean)`
* `CSQ.unmask(view: View)` -> `View.csqMaskContents(true)`
* `CSQ.unmask(view: View)` -> `View.csqMaskContents(false)`

### Jetpack compose

| Contentsquare SDK | CSQ SDK |
| - | - |
| `Modifier.sessionReplayMask(enableMasking: Boolean)` | `@Composable
CsqMask(enable: Boolean) { }` |
| `Modifier.excludeFromGestureRecognition()` | `@Composable
CsqIgnoreInteraction(ignore: Boolean)` |

### SDK initialization and manipulation

| Contentsquare SDK | CSQ SDK |
| - | - |
| `Contentsquare.start(context: Context)` | `CSQ.start(context: Context)` |
| `Contentsquare.stopTracking()` | `CSQ.pauseTracking()` |
| `Contentsquare.resumeTracking()` | `CSQ.resumeTracking()` |

## Checklist

Congratulations! You're all set. Use this checklist to ensure everything is correctly updated.

Ensure that your build files no longer reference `com.contentsquare.android`, `com.contentsquare.android:library`, or `com.contentsquare.android:sdk-compose`.

Your `import com.contentsquare.android.Contentsquare` declarations have been updated to `import com.contentsquare.CSQ`.

You no longer have references to `Contentsquare.` methods in your codebase.

All calls to the CSQ SDK use the `CSQ.`namespace.
