Data warehouse integrations are available as a premium add-on for Kameleoon’s Web Experimentation and Feature Experimentation module. For more information, contact your Customer Success Manager.
- BigQuery
- Snowflake
- Redshift
- Databricks
Choose your targeting approach
Pick the approach that matches what you want to target:- Target a pre-built audience from an Ingestion Task (for example, all visitors in “The Londoners”): follow Target your imported audiences in a Kameleoon experiment. You create one custom data that lists every Ingestion Task audience, then build segments from it.
- Target a specific visitor attribute (for example,
place_of_birthwith many different cities): follow Targeting imported audiences by attributes. You add the attribute to the SQL query and create a custom data that holds its value.
- Kameleoon SDK method: for Feature Experimentation only.
- Custom JavaScript code: for Web Experimentation, or for Web Experimentation and Feature Experimentation together.
Target your imported audiences in a Kameleoon experiment
This standard example shows a basic method of targeting your imported audiences in a Kameleoon experiment. Suppose your warehouse has a user table withid, place_of_birth, and subscription_plan columns.

SELECT id FROM user WHERE place_of_birth="LONDON"
To target the audiences that your Ingestion Tasks poll, complete the following setup.
Set up a Kameleoon custom data entry
Create custom data that holds the warehouse audiences each visitor belongs to.-
In the left menu, click Settings > Custom data.

-
Click New custom data.

- Provide a name for your custom data.
- Select the project on which you configured the Data Ingestion Task.
-
Choose the retrieval method Kameleoon SDK method or Custom JavaScript code.
- See the following section dedicated to this parameter: Custom data retrieval method.
- Choose List for the type and String for the format.
- For the Scope, select Visit.
- Click Next.

- You can set the different values that will appear in the segment’s targeting condition you create. Select the checkbox Save the values for the targeting condition associated with the custom data point.
- Click Create.
Custom data retrieval method
The custom data retrieval method specifies what code fills the custom data’s value and where this code runs. There are several retrieval possibilities according to your Kameleoon set up. If you are using Feature Experimentation only, you can select the Kameleoon SDK method. When you use this method, the acquisition code runs at the points where you call Kameleoon SDK methods. These methods fetch the warehouse audiences your visitor belongs to and store that information in the custom data. The precise code snippet depends on the SDK you are using. Here is an example written with Kameleoon’s JavaScript SDK:YOUR_WAREHOUSE_VISITOR_ID so that the warehouseVisitorId variable contains the visitor ID that your organization uses for this visitor in their warehouse. The visitor ID depends on your organization’s visitor identification system (see Visitor identification). If your organization has no such identifier, you can use the Kameleoon Visitor Code, but you must also use that code in your warehouse.
Replace the value of customDataIndex with your custom data’s index. You can find the index in the Index column of the custom data list:

Create a segment for warehouse audiences
Create a segment that targets warehouse audiences through the custom data you set up. For example, if you have a second Ingestion Task that polls visitors born in March, and you call it “Born in March.” The custom data’s value for a visitor born in March and in London contains both audiences (“The Londoners,” “Born in March”). Thus, you can use this single custom data for all of your Kameleoon segments that target your warehouse audiences. You can then use this custom data in your Kameleoon campaigns (experiments, feature experiments, or personalizations) to target users based on their membership of a specific audience in your warehouse. To create such a segment, follow these steps:- Create a segment.
- In your segment, use a custom data condition.
- When you choose the is among the values operator, the list shows the audiences of the Data Ingestion Tasks you created, for example “The Londoners” and “Born in March.”
Targeting imported audiences by attributes
This section explains an alternative method for targeting audiences you’ve imported from your warehouse. This method is especially helpful if you want to run separate experiments that target different values of the same visitor attribute, such as many cities of origin. Creating one Ingestion Task for each place of birth works, but it becomes tedious when you want to target 50 different cities. Kameleoon lets you import attributes of the visitors in your warehouse audiences. To import them, add extra fields to the SQL query after the visitor ID field, like this:SELECT id, place_of_birth FROM user
You can then create a custom data that holds the value of the attribute place_of_birth. For the JavaScript SDK, the code looks like this:
attributeName and taskId. Keep this name unique for each custom data you create, because two custom data scripts that share a window property overwrite each other’s value.
The taskId is the Ingestion Task ID: the unique number Kameleoon assigns to the task. The Data Ingestion Tasks list shows each task as its ID followed by its name, for example 543 Attributes. The ID is only the number (543), not the name. Set taskId to that number.
You can add as many visitor attributes as you like in the SQL query and use these attributes in many ways with Kameleoon’s SDKs.
Data types of imported values
Kameleoon converts every imported value to text (string) on its side, whatever Type or Format you choose in the custom data form. The Type dropdown offers Single, List, and Count List. The Format dropdown offers Boolean, Number, and String. Kameleoon recommends String.Use Boolean values from Databricks
To target a Boolean column from Databricks, convert its value to1 or 0 in your custom code.
The column reaches Kameleoon as text, for example {"is_premium": "true"}. Parse that text and store 1 or 0 as the custom data value. Segments then test that value against 1 or 0, not TRUE or FALSE.