Use external data to target users
The Kameleoon Feature Experimentation solution allows for targeting users using more than 20 predefined targeting conditions. Additionally, the Data API Map endpoint with the custom data feature can target users based on other relevant data available in the system, such as user preferences and data from a CRM. The Map endpoints enable the storage of additional data for a given key, typically a visitor code or an internal User ID. The app can retrieve this data and use it for targeting and segmentation in the Kameleoon SDKs using the getRemoteData method, which is available in all Kameleoon SDKs.
Using the Data API Map endpoint to store data
To store additional data on Kameleoon remote servers for use with feature flags and experiments, use the Data API Map endpoint to post data for each user. For further details, refer to the Map documentation.
This section explains how to retrieve and use data in feature flags and experiments. This allows for creating more targeted and personalized experiences for users based on relevant data.
Create custom data
To use any data point as a targeting criterion, you first need to create a custom data entry for the data point by following these steps:
- In the Kameleoon app, click Configure > Custom data.
- In the Custom data section, click New custom data.
- Choose the project.
- Enter a descriptive name for the custom data.
- For the acquisition method, choose Kameleoon SDK method.
- For the type, select Single .
- For the data format, select String.
- Choose the appropriate scope for the data.
- Click Next and Skip the following screen to save the custom data.
Retrieve data from the Data API Map endpoint
Once you've created the custom data, you need to do the following:
-
Retrieve the relevant data from the Data API Map endpoint by using the
getRemoteDatamethod. See the documentation for the SDK being used. -
The
getRemoteDatamethod returns a JSON object that contains data related to the user. You can parse this JSON response to retrieve the data value you want to use as a targeting condition and set it as the value of the custom data entry using the SDKaddData()method.
Use the custom data as a targeting criterion
You can now use the custom data entry as a targeting criteria in your feature flags. Here's how:
- In the Segments page (Configure > Segments), create a new segment or open an existing segment to open the segment builder.
- In the *Custom Data section, select the custom data as a targeting criterion.
- Save the segment and use it in the feature flags.