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

# Receive user data in Kameleoon with any third-party solution

> Send user data from any third-party tool to Kameleoon using the Data API Map endpoints, then use it as a targeting condition in your campaigns.

## Send user data to Kameleoon

The [Map endpoints](../../../developer-docs/apis/data-api-rest/overview#map-endpoints) allow you to store additional data for a given key (usually a visitor code or an internal user ID), which can then be retrieved and used for targeting and segmentation purposes, by using the `retrieveDataFromRemoteSource` method available in our [Activation API](../../../developer-docs/apis/activation-api-js/api-reference/api-reference#retrievedatafromremotesource) and all our [SDKs](../../../developer-docs/sdks/web-sdks/nodejs-sdk#getremotedata). You can also use the map endpoint to retrieve stored data for a given key.

<Frame>
  ![](https://storage.googleapis.com/kameleoon-storage-documentation/user-manual/images/integrations/as-a-source/receive-user-data-in-kameleoon-with-any-third-party-solution/Capture-décran-2025-02-27-à-10.40.06.png)
</Frame>

**Example of payload:**

```json theme={null}
{
     "U67891": {
         "userSegment": ["Tech Enthusiast", "Gamer"],
         "categoryAffinities": [
             {
                 "id": "0567012",
                 "name": "Gaming Keyboards"
             },
             {
                 "id": "0456789",
                 "name": "Mechanical Keyboards"
             }
         ]
     },
     "U23456": {
         "userSegment": ["Fitness & Outdoors", "Health Conscious"],
         "categoryAffinities": [
             {
                 "id": "0321009",
                 "name": "Smartwatches"
             },
             {
                 "id": "0789456",
                 "name": "Wireless Earbuds"
             }
         ]
     },
     "U98765": {
         "userSegment": ["Music Lover", "Audiophile"],
         "categoryAffinities": [
             {
                 "id": "0984321",
                 "name": "Bluetooth Speakers"
             },
             {
                 "id": "0678901",
                 "name": "Noise-Canceling Headphones"
             }
         ]
     }
 }
```

**Example of request:**

```bash theme={null}
curl -L 'https://na-data/map/maps' \\
 -H 'Content-Type: application/json' \\
 -d '{"U67891":{"userSegment":["Tech Enthusiast","Gamer"],"categoryAffinities":[{"id":"0567012","name":"Gaming Keyboards"},{"id":"0456789","name":"Mechanical Keyboards"}]},"U23456":{"userSegment":["Fitness & Outdoors","Health Conscious"],"categoryAffinities":[{"id":"0321009","name":"Smartwatches"},{"id":"0789456","name":"Wireless Earbuds"}]},"U98765":{"userSegment":["Music Lover","Audiophile"],"categoryAffinities":[{"id":"0984321","name":"Bluetooth Speakers"},{"id":"0678901","name":"Noise-Canceling Headphones"}]}}'
```

## Retrieve user data in Kameleoon

### Create a custom data

You must create and set up a Kameleoon custom data

You will need to create and set up a Kameleoon custom data. To do so:

1. Click **Settings** > **Custom data**.
2. Name your custom data.
3. Select your project.
4. Select **Custom JavaScript code** retrieval method.

<Frame>
  ![](https://storage.googleapis.com/kameleoon-storage-documentation/user-manual/images/integrations/as-a-source/receive-user-data-in-kameleoon-with-any-third-party-solution/Capture-décran-2025-02-27-à-10.24.41.png)
</Frame>

Use the code below.

Replace `NAME_OF_YOUR_CUSTOMDATA` with your custom data's name, and `NAME_OF_YOUR_USER_ID` with your user ID.

```javascript theme={null}
Kameleoon.API.Data.retrieveDataFromRemoteSource(NAME_OF_YOUR_USER_ID, function(data) {
      for (const [key, value] of Object.entries(data)) {
          Kameleoon.API.Data.setCustomData('NAME_OF_YOUR_CUSTOMDATA',key)
      }
  });
  return { "value": null}
```

4. Choose the type **List** and format **String**.
5. Choose the scope **Page**.

#### Save the values for targeting condition associated with the custom data point

<Frame>
  ![](https://storage.googleapis.com/kameleoon-storage-documentation/user-manual/images/integrations/as-a-source/receive-user-data-in-kameleoon-with-any-third-party-solution/Capture-décran-2025-02-27-à-10.28.46.png)
</Frame>

More information here: [Create and push a custom data](../../assets/custom-data/create-custom-data)

### Create your segments

#### Create a new segment for your project

Follow these steps to set up a segment:

1. Click **Settings** > **Custom data**.
2. Name your segment.
3. Select your project.
4. Select **campaign type** for segment.

<Frame>
  ![](https://storage.googleapis.com/kameleoon-storage-documentation/user-manual/images/integrations/as-a-source/receive-user-data-in-kameleoon-with-any-third-party-solution/Capture-décran-2025-02-27-à-10.31.56.png)
</Frame>

### Use the custom data created previously to create your segment

After you've set up the custom data, you can build segments in the Kameleoon Segment Builder. Choose the custom data and select **is among the values**, which will then display a list of every `user data` from your third-party tool. Select a `user data` to enable targeting in personalizations and experiments.

<Frame>
  ![](https://storage.googleapis.com/kameleoon-storage-documentation/user-manual/images/integrations/as-a-source/receive-user-data-in-kameleoon-with-any-third-party-solution/Capture-décran-2025-02-27-à-10.36.26-1920x901.png)
</Frame>

### Use this segment for your experiments

[More information here](../../assets/segments/create-a-segment)
