This integration is in open beta and in active development. Contact the Kameleoon support team for help with it.

How Klaviyo cohorts fit into your workflow
- Connect Klaviyo to Kameleoon: Store the Kameleoon visitor code in Klaviyo, and then install the Klaviyo Cohorts integration in Kameleoon.
- Target Klaviyo cohorts in Kameleoon: Create custom data that holds the cohorts, add the cohort names to it, and then build a segment that uses it.
Before you begin
- Klaviyo account: An active Klaviyo account with access to the segments you want to use.
- Klaviyo JavaScript API: Your site loads the Klaviyo JavaScript API, which provides
klaviyo.identify(). - Kameleoon script: Your site runs the Kameleoon script, which provides
Kameleoon.API.Visitor.code, the value the snippets in this article read. - Project sitecode: The sitecode of the Kameleoon project that receives the cohorts, which you can find as described in manage your projects.
Connect Klaviyo to Kameleoon
Connecting Klaviyo to Kameleoon has two parts. First, your site stores the Kameleoon visitor code on each Klaviyo profile, so each cohort matches the same visitor in Kameleoon. Then the Klaviyo Cohorts integration asks for permission to view profile and segment information, and you grant that permission in Klaviyo.Store the Kameleoon visitor code in Klaviyo
Add this code to your site after Klaviyo and Kameleoon load, so that Klaviyo stores the visitor’s Kameleoon code on their Klaviyo profile.Install the Klaviyo Cohorts integration
Install the integration in Kameleoon, and then grant Klaviyo permission to share data with it.
- Click Admin > Integrations.
- Click Klaviyo Cohorts, and then click Install the tool.
- In Use this tool on, select the projects where you want to use the integration, and then click Validate. Kameleoon redirects you to Klaviyo.
- In Klaviyo, click Allow to let Kameleoon view your profiles and segments.

Target Klaviyo cohorts in Kameleoon
After the cohorts reach Kameleoon, you target them with custom data, which Kameleoon reads in each campaign. The retrieval method depends on the product: Web Experimentation uses custom JavaScript code, and Feature Experimentation uses the Kameleoon SDK method. For example, you can run an A/B test on visitors who viewed a product page several times but didn’t add anything to their cart, and compare two incentives, such as a limited-time offer and social proof messaging. On the Results page, you can also break down an experiment’s results by custom data, so you can compare how each cohort responded.Create custom data for Web Experimentation
Create custom data that reads each visitor’s Klaviyo cohorts in a Web Experimentation campaign.- Click Settings > Custom Data, and then click New custom data.
- Enter
Klaviyo Cohortsas the name, and select your project. The snippet sets the custom data by this name, so enter it exactly. - Set the Retrieval method to Custom JavaScript code.

Create custom data for Feature Experimentation
Create custom data that your backend retrieves with the Kameleoon SDK.- Click Settings > Custom Data, and then click New custom data.
- Enter
Klaviyo Cohortsas the name, and select your project. - Set the Retrieval method to Kameleoon SDK method.
- Set Type to List, Format to String, and choose the Scope that fits your test. With the Page scope, Kameleoon resets the value for each new page.
KLAVIYO_COHORTS_ followed by the visitor code, and then sets it with the SDK’s addData() method. The Go SDK’s GetRemoteData() method fetches data that Kameleoon stores on its servers for a visitor code or user ID. See the Go SDK documentation for its parameters, and check your SDK’s documentation for the equivalent method.
Add Klaviyo cohort names to the custom data
Add the cohort names so that the segment builder lists each Klaviyo cohort by name instead of by ID.- Click Next to open the options.
- Turn on Save the values for the targeting condition associated with the custom data point. A code field appears.
-
Paste the following script into the code field, and replace
{ADD_YOUR_SITECODE}with your project sitecode. - Click Create.
Build a segment from Klaviyo cohorts
Build a segment that targets visitors in one or more Klaviyo cohorts.- Click Settings > Segments, and then click New segment.
- In the Conditions column, open the Custom data tab, and then select Klaviyo Cohorts.
- Select the is among the values condition, and then select the cohorts you want to target.
- Choose whether to include or exclude the visitors who match the condition.