Use external data to target users
The Kameleoon Feature Experimentation solution allows you to target users using more than 20 predefined targeting conditions. Additionally, you can use the Data API Map endpoint with the custom data feature to target users based on other relevant data available in your system, such as user preferences and data from your CRM. The Map endpoints enable the storage of additional data for a given key, typically a visitor code or an internal User ID. Your 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 of our SDKs.
Using the Data API Map endpoint to store data
To store additional data on the Kameleoon remote servers for use with your feature flags and experiments, you need to use the Data API Map endpoint to post your data for each user. For further details, refer to the Map documentation.
Using the Data API Map endpoint to fetch data
This section explains how to retrieve and use your data in your feature flags and experiments. This allows you to create more targeted and personalized experiences for your users based on the relevant data you own.
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 your project.
- Enter a descriptive name for your 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
getRemoteData
method. See the documentation for the SDK that you use.The
getRemoteData
method 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 your segment and use it in your feature flags.