---
title: Retrieving Contentsquare session identifiers from the customer's website - APIs
description: How to retrieve User Identifiers with the Enrichment API
lastUpdated: 07 April 2026
source_url:
  html: https://docs.contentsquare.com/en/api/enrichment/retrieving-cs-session-ids-from-customers-website/
  md: https://docs.contentsquare.com/en/api/enrichment/retrieving-cs-session-ids-from-customers-website/index.md
---

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

Once an integration has been installed, the [Provider](https://docs.contentsquare.com/en/api/enrichment/definitions/#provider) should start collecting Contentsquare session identifiers during web visits on the common customer's website. These identifiers will be used to attach the enrichment data to the right Contentsquare sessions when data will be received from the [Provider](https://docs.contentsquare.com/en/api/enrichment/definitions/#provider).

Those identifiers are:

* The **project ID**: identifies the Contentsquare project ID where the data is stored
* The **user ID**: identifies the Contentsquare anonymous user ID for the user visiting the website
* The **session number**: identifies a specific session (as an ordered index) of the user ID. For example, if Contentsquare has tracked 4 different sessions of the same anonymous user, the last session number will be 4.

Note

The combination of a user ID and session number makes a unique session identifier.

## How to get those Contentsquare session identifiers?

### Web

During a visit on a website, you can interact with Contentsquare's tag to pull those identifiers via the [`afterPageView`](https://docs.contentsquare.com/en/web/third-party-integrations-and-implementation-examples/#afterpageview) command. A JavaScript code using that command should look like this:

```javascript
const yourCallback = (context) => {
  const projectId = context.projectId;
  const [userId, sessionNumber] = context.sessionKey.split(".");
  // store these Contentsquare session identifiers in your backend
};


window._uxa = window._uxa || [];
_uxa.push(["afterPageView", yourCallback]);
```

By calling this function you will get the project ID, user ID and session number of each session that are required to identify the Contentsquare sessions to be enriched.

Tip

We advise [Provider](https://docs.contentsquare.com/en/api/enrichment/definitions/#provider) to group the data by project ID as each project ID will require specific OAuth credentials to authenticate.

### Android native

You can call the Contentsquare public API on the Android SDK to retrieve these identifiers at any time.

```kotlin
val projectId = Contentsquare.getProjectId()
val sessionNumber = Contentsquare.getSessionNumber()
// store these Contentsquare session identifiers in your backend
```

Tip

We advise [Provider](https://docs.contentsquare.com/en/api/enrichment/definitions/#provider) to group the data by project ID as each project ID will require specific OAuth credentials to authenticate.

### iOS native

You can call the Contentsquare public API on the iOS SDK to retrieve these identifiers at any time.

```swift
let projectID = Contentsquare.projectID
let sessionNumber = Contentsquare.sessionNumber
// store these Contentsquare session identifiers in your backend
```

Tip

We advise [Provider](https://docs.contentsquare.com/en/api/enrichment/definitions/#provider) to group the data by project ID as each project ID will require specific OAuth credentials to authenticate.
