Skip to main content

Custom analytics integration

Kameleoon comes with a lot of built-in integrations such as Mixpanel, Amplitude, Snowplow, GA4, Segment... They can be used with any front-end or hybrid experiments.

However, if you happen to use a platform for which we do not provide an official bridge yet, it's also very easy to build your own integration by leveraging our Custom Analytics bridge feature. You can follow the guidelines provided in our user manual to create your own custom integration.

Alternatively, you can also listen to custom DOM events which are being fired by our JavaScript engine and send experiment or personalization events to the tool of your choice. You can follow the simple steps below:

  • you need to obtain a list of all active experiments or personalizations on the page, then loop over this list and perform a given action: for instance, sending the ids of the experiment and of the variation to your analytics platform, by using their API.
  • since the code can either load and execute before, or after Kameleoon experiments trigger and activate, you must both check the current active experiments at the start of your code, AND also stay informed of any new experiments that are activated later.

Since experiments can activate at any time (for instance only after the user has clicked on a specific button), you can never assume that your code, when running, has all the required information about the active Kameleoon experiments at any given moment. Always setup an event listener (as shown in the sample code) to be alerted of any new experiment activated in the future.

Sample code‚Äč

var processExperimentForMyTargetPlatform = function(experiment)
// Here you should implement your own logic, depending on the APIs of your target platform
// It can be something similar to:

myTargetPlatform.addExternalData({"experimentId":, "experimentName":, "variationId":, "variationName":});

// We loop over the experiments, but the exact same logic could be used for personalizations as well


window.addEventListener("Kameleoon::ExperimentActivated", function(event) {

With this sample implementation, the data could be passed to your target platform several times for a single experiment, if this experiment is active on several pages. Every page where the experiment is active would result in the invocation of the processExperimentForMyTargetPlatform() function. You could of course improve the sample code to remember every experiment already processed, and thus restrict the passing of data to a single use. Usually, this would have the advantage of removing useless extra server calls to your target platform.