Integrate Kameleoon with Amplitude Event Streaming

Written by Julie Trenque

Updated on 08/03/2023

3 min

Advanced

Manage your integrations

Analytics

Automation

CDP

CMP

CMS/CRM

Data Warehouses

Developers

Was this content useful?

With this Amplitude x Kameleoon integration, every event that is triggered by Amplitude will be automatically sent to Kameleoon, saving developers from having to re-implement an existing Amplitude tracking plan in Kameleoon.

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

Key benefits

  • Automatically send Amplitude events to Kameleoon to create highly targeted optimization campaigns.
  • Enhance the targeting definition and analyze results of your A/B/n tests with Amplitude event data.
  • Re-implement an existing Amplitude tracking plan in Kameleoon from the Amplitude events generated by your users.

Considerations

Keep these things in mind when sending events to Kameleoon:

  • You must enable this integration in each Amplitude project you want to use it in.
  • You need a paid Kameleoon plan to enable this integration.
  • Your need to match your Amplitude users with the Kameleoon visitors using the same system of identifiers for both tools.
  • This integration has technical limitations.
  • Amplitude sends all user, event, and group properties along with the event.

Limitations

Relevant limits for Kameleoon events are:

  • Maximum size of event data: 1 MB
  • Can’t create more than 50 Kameleoon goals over a 10 seconds period
  • Can’t create more than 1000 Kameleoon goals over a 60 minutes period

Setup

Prerequisites

To configure an Event Streaming integration from Amplitude to Kameleoon, you need the following information from Kameleoon:

  • REST API Key: To start sending data into Kameleoon, you first have to get your API Key. See the Generate your API Key section for more help.
  • Sitecode: To know the project that will be used with this integration, you need to provide the Sitecode of your project. See the dedicated Kameleoon documentation to know where you can find your Sitecode. 

Kameleoon setup

Make sure you have your API Key and your sitecode, so you can set up your integration from Amplitude.

Generate your API Key

To generate your API Key:

  1. Get your client ID and client secret. You can find them in your profile page.
  2. Use your client ID and secret with the following URL to generate your API Key:

https://customers.kameleoon.com/kameleoon/amplitude/getapikey?id=[CLIENT ID]&secret=[CLIENT SECRET]

Get your Sitecode

You can find your project’s Sitecode on the project dashboard.  See the dedicated Kameleoon documentation to know where you can find your Sitecode. 

Amplitude setup

  1. In Amplitude, navigate to Data Destinations, then find Kameleoon – Event Stream.
  2. Enter a sync name, then click Create Sync.
  3. Toggle Status from Disabled to Enabled.
  4. Paste your Kameleoon API Key and Sitecode.
  5. Toggle the Send events filter to select the events to send. You can send all events, but Amplitude recommends choosing the most important ones.
  6. Use the Event Properties filter to select which Event Properties you would like to send. 
  7. When finished, enable the destination and save.

Matching an Amplitude user with a Kameleoon visitor

The integration requires that you use the same system of identifiers for both tools, meaning the userId value you pass to Amplitude should be the same value as Kameleoon uses to identify a “visitor”.

If you use Kameleoon Experiment or Kameleoon Personalization on your project, 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 visitor. You have several options available:

  • Option 1: You can pass our visitorcode in the userId property of the Amplitude event to ensure Kameleoon can attribute all events data received from Amplitude to the right visitor.
  • Option 2: You can specify in all subsequent Amplitude track calls an additional user property kameleoon_visitorcode, whose value is the Kameleoon visitorcode. You can retrieve the user visitorCode from the browser by using our Activation API Kameleoon.API.Visitor.code. 

Option 1 – Example

Using the Browser SDK:

amplitude.setUserId(Kameleoon.API.Visitor.code);

Option 2 – Example

Using the Browser SDK:

const visitorcode = Kameleoon.API.Visitor.code;

const identifyEvent = new amplitude.Identify();
identifyEvent.set('kameleoon_visitorcode', visitorcode);

amplitude.identify(identifyEvent);

To know more about uploading events to Amplitude, we recommend reading the dedicated documentation page.

If you use Kameleoon Full Stack, please refer to the Kameleoon SDK documentation  to set your own ID instead of using a generated Kameleoon Visitor Code and so have the exact same one between Amplitude and Kameleoon.

Retrieving automatically created goals

As mentioned before, Kameleoon will create a custom goal by using the Amplitude event name and associate the conversion to the visitor.  The name of the created goals will start with “Amplitude – ” followed by the event name.

Example: If the event name is “Clicked on Checkout”, the generated goal will be named “Amplitude – Clicked on Checkout”.

Moreover, automatically created goals will have a tag named “amplitude” attached to them. 

To find these automatically created goals, go to the goal dashboard and search for goals that have the “amplitude” tag using the tag filter on the side panel.

Renaming or deleting automatically created goals

When receiving an event from Amplitude,  Kameleoon will search for the existing associated goal by looking for a matching goal name (considering the naming convention). If you decide to change the goal name, Kameleoon will not find it and create a new goal with a name matching the Amplitude event name (and the previous goal conversions will still be attached to the previous goal).

Therefore, if you want to change a goal name, we recommend also changing the Amplitude event name to match the new goal name. 

 We also recommend changing the goal name if you decide to renaming an Amplitude event, to match the new event name.

 If you decide to delete the goal, Kameleoon will not find it and create a new goal with a name matching the Amplitude event name, and because it’s a new goal, all the goal conversions will be lost.

Automatic goal conversion

Now that a goal has been generated, Kameleoon will start associating the conversions to it. As mentioned before,  if the Amplitude event name matches exactly the name of an existing goal in your Kameleoon account, a conversion for this goal will be associated with the visitor.

In the Goals dashboard, if you click on an Amplitude goal, you can see the following pop-up:

Please don’t pay attention to the displayed message: “To trigger a custom goal conversion, you can either use our JavaScript Activation API or the SDK corresponding to your back-end server language (example for NodeJS).

Since the events received by Kameleoon will automatically trigger a goal conversion, you don’t need to implement any front-end or back-end code to trigger an Amplitude goal. The goal will be automatically converted if the associated Amplitude event is triggered and forwarded to Kameleoon.

  • In this article :