Integrate Kameleoon with Segment

portrait de l'auteur Julie Trenque

Written by Julie Trenque

Updated on 22/09/2020

5 min

Intermediate

Was this content useful?

With this integration you can seamlessly connect Kameleoon with Segment.io to:

  • push campaign exposure event data (campain name and variation name) to Segment.io, which can then be used by other platforms available in Segment.io marketplace;
  • import custom event and revenue.

Push Kameleoon data into Segment

Enable Segment.io integration on Kameleoon

On the Integrations page

Log in to your Kameleoon App, click on “Administrate” and then “Integrations” in the sidebar.

For more information on this page, see our dedicated article.

By default, the tool is not installed. This is signaled by this icon:

With a click on “Install the tool”, you will be able to select the websites on which you want to activate it.

Once you have configured the tool, click on “Validate” in the bottom-right corner: the configuration panel closes. You will then see a “ON” toggle on the right of the tool’s line, as well as the number of websites the tool is configured on.

The results of your experiments will be transmitted to Segment.io if the script of the tool is installed on your pages.

Activate Segment.io on a campaign

In an A/B experiment

Once Segment.io is activated on the Integrations page, you can select it as a reporting tool at the “Tracking and goals” step of the finalization panel (or in the Code editor).

In a personalization

Once Segment.io is activated on the Integrations page, you can select it as a reporting tool on the personalization creation page.

On the results page

It is also possible to select it among the reporting tools on the results page.

In the right sidebar, click on “Reporting Tools” and then on “Edit”.

Select Segment.io and don’t forget to validate!

Data transmission

As soon as Segment has been installed and defined as a reporting tool in a campaign, an event called “Experiment viewed” will be sent automatically every time a visitor sees a variation of an active Kameleoon A/B experiment.

More information

Import Segment event into Kameleoon

With this Segment x Kameleoon integration, every tracking call that is triggered by Segment will be automatically collected by Kameleoon as a KPI conversion, saving developers from having to re-implement an existing Segment Tracking plan in Kameleoon.

Step 1: Generate an API key

First, you will have to request an APIKey in order to use this integration. Please ask your Kameleoon Customer Success Manager for it or send us an email to support@kameleoon.com.

Step 2: Get your sitecode

You will also need to get your sitecode in your Kameleoon account.

To learn how to find your sitecode, please read this documentation.

Step 3: Enter this information in your Segment App

  • From the Destinations catalog page in the Segment App, click “Add Destination”.
  • Search for Kameleoon in the Destinations Catalog, and select the Kameleoon destination.
  • Click on “Configure Kameleoon”.
  • Choose which Source should send data to the Kameleoon destination.
  • Enter the APIKey and the sitecode in the Kameleoon destination settings in Segment.

Step 4: Matching Users between Kameleoon and Segment

The integration requires that you use the same system of identifiers for both tools, meaning the userId value you pass to Segment should be the same value as Kameleoon uses to identify a “visitor”. If you use Kameleoon Experiment or Kameleoon AI Personalization on your website, Kameleoon places a cookie that contains an anonymous unique identifier, called the Kameleoon visitorcode, randomly assigned to a visitor. This ID is used to uniquely identify a browser.

Check with your engineers to ensure our visitorcode is passed in the userId property of the Segment calls to ensure Kameleoon can consolidate data and avoid any analytics discrepancies between the tools in your campaign results.

To provide a consistent user identifier to Kameleoon, you may specify in Segment calls a user property, k_visitorCode, whose value is the Kameleoon visitorcode. You can retrieve the user visitorCode from the browser by using our Activation APIKameleoon.API.Visitor.code

If you use Kameleoon Full Stack, please refer to the Kameleoon SDK documentation. We always recommend to use your own internal ID to identify users.

Step 5: Send calls

Kameleoon supports the following methods, as specified in the Segment Spec.

Behind the scenes, if the Segment event name matches exactly the name of an existing goal in your Kameleoon account, a conversion for this goal will be associated to the visitor. If the goal does not exist, Kameleoon will create a custom goal by using the Segment event name and associate the conversion to the visitor. The goal will appear in the Kameleoon goals page with the name convention ‘SegmentIO eventType – eventName’. Once the goal has been created, you can use them in any of your campaign.

Page

Send Page calls to record whenever a user sees a page of your website, along with any optional properties about the page. Calling page or screen in one of our sources is one of the first steps to getting started with Segment.

For example:

analytics.page('Home', {"k_visitorCode": "oa16i4syt2ve3b0z"});

Screen

Send Screen calls to record whenever a user sees a screen, the mobile equivalent of page, in your mobile app, along with any properties about the screen. Calling page or screen in one of our sources is one of the first steps to getting started with Segment.

For example:

[[SEGAnalytics sharedAnalytics] screen:@"Home"
properties:@{ @"k_visitorCode": @"oa16i4syt2ve3b0z" }];

Segment sends Screen calls to Kameleoon as a screenview.

Track

Send Track calls to record any actions your users perform, along with any properties that describe the action.

For example:

analytics.track('Login Button Clicked', {"k_visitorCode": "oa16i4syt2ve3b0z"});

Segment sends Track calls to Kameleoon as a track event.

  • In this article :