Send user data to Kameleoon
The Map endpoints allow 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 and all our SDKs. You can also use the map endpoint to retrieve stored data for a given key.

Example of Payload
{ "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
curl -L 'https://data.kameleoon.io/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
In a nutshell, you will need to create and setup a Kameleoon custom data.

Please follow these steps to set up the custom data:
- Name your custom data.
- Select your project.
- Select Custom JavaScript code retrieval method.

Please use the code below.
Replace NAME_OF_YOUR_CUSTOMDATA
by the name of your custom data and NAME_OF_YOUR_USER_ID
by the name of your user ID.
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}
- Choose the type List and format String.
- Choose the scope Page.
Save the values for targeting condition associated with the custom data point

More informations here: Create and push a custom data
Create your segments
Create a new segment for your project

Please follow these steps to set up a segment:
- Name your segment.
- Select your project.
- Select campaign type for segment.

Use the custom data created previously to create your segment
After the custom data has been set up, you can build segments within the Kameleoon segment builder, by choosing the custom data and selecting is among the values, which will then show a list of every user data
from your third-party tool. Selecting one or multiple user data
will enable targeting in personalizations and experiments.

Use this segment for your experiments