Skip to main content
Your CRM or customer data platform often holds visitor details, such as a segment or product interests, that Kameleoon can’t read by itself. The Map endpoints of the Data API store that data for a given key, which is usually a visitor code or an internal user ID. A custom data point then receives each stored value on your website, which lets a segment include only the visitors who have that value.

Send user data to Kameleoon

To store data for one or more keys, send a JSON object to the POST /map/maps endpoint, with one entry for each key. Each entry can hold several fields, such as userSegment and categoryAffinities. You can also use the Map endpoints to retrieve the data stored for a key.
Table showing user data sent from a third-party tool to Kameleoon, and the web experiments, web personalizations and feature experiments that can use it.
Example of payload:
Example of request:

Retrieve user data in Kameleoon

To use the stored data in a campaign, create a custom data point, then set its value from your website’s global script with the retrieveDataFromRemoteSource method of Kameleoon’s Activation API. All of Kameleoon’s SDKs use the same method.

Create a custom data point

To receive the user data, create a custom data point with the Kameleoon Activation API retrieval method.
  1. Click Settings > Custom Data, then click New custom data.
  2. Name your custom data.
  3. Select your project.
  4. Select Kameleoon Activation API as the retrieval method.
  5. Choose the type List and the format String.
  6. Choose the scope Page.
  7. Click Next.
New custom data pop-in with the Kameleoon Activation API retrieval method, List type, String format and Page scope selected.
Avoid the Custom JavaScript code retrieval method for this data. That option must return a value synchronously, so it can’t call the asynchronous retrieveDataFromRemoteSource method.

Set the custom data from your global script

Add this code to your website’s global script, which loads on every page. Replace NAME_OF_YOUR_CUSTOMDATA with your custom data’s name, and replace NAME_OF_YOUR_USER_ID with the key that you stored with the Map endpoint.
The example sets the userSegment field of the stored data. Create a separate custom data point for each field that you want to target.

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

To choose values in the segment builder, turn on Save the values for the targeting condition associated with the custom data point in the Options step. In the code field, return an array of objects. Each object has a value, which must match the custom data’s type, and a label, which the segment builder displays. Add one object for each value that the segment builder should offer.
Options step with the Save the values for the targeting condition toggle turned on and a code field that lists the values.
Click Next > Create. For more details, see Create custom data.

Create your segments

Create a new segment for your project

To create a segment that uses your custom data, create the segment first, then add the custom data as a condition.
  1. Click Settings > Segments, then click New segment.
  2. Name your segment.
  3. Select your project.
  4. Select Campaign type, then choose All types.
  5. Click Next.
New segment pop-in with the segment name, project, campaign type and description fields.

Add a custom data condition to your segment

To target visitors by the custom data, use it as a condition in your segment. In the segment builder, expand Technical in the Conditions column, then double-click the custom data condition to add it. In the Include visitors with field, select your custom data point and choose is among the values. Check each value that the segment should include. The list shows the values that you saved when you created the custom data.
Segment builder with a custom data condition set to is among the values, listing the saved values.

Use the segment in a campaign

A segment controls which visitors your campaign includes. For an experiment, select Target a segment in the Targeting step of the finalization panel. For a personalization, click Target a segment in the Segments panel of the Targeting step. For the full steps, see Set up a segment in a campaign.