Integrate Kameleoon with Google Analytics 4

portrait de l'auteur Julie Trenque

Written by Julie Trenque

Updated on 09/28/2022

2 min

Intermediate

Manage your integrations

Analytics

CDP/DMP

CMP

CMS

Developers

Others

Was this content useful?

Google Analytics 4 (GA4) is ready and fully functional from October 16, 2020.

The main difference between Universal Analytics and GA4 is that GA4 is event based. Instead of sending custom dimensions like in UA, GA4 will handle events, which can be used in the GA4 interface. Custom dimensions in GA4 could be used to handle events more easily in your reports. Also, one of the advantages of GA4 is that it can be used for any kind of project: website, mobile app, or both.

Learn more about Google Analytics 4

The Kameleoon x GA4 integration will allow to use GA4 to analyse all your campaigns by showing you which users are participating in experiments and personalizations for further analysis.

If you are still using Google Universal Analytics, we recommend our Google Universal Analytics integration.

Requirements for GA4

  • You have implemented the gtag.js script on your site (https://developers.google.com/tag-platform/gtagjs/install)
  • You have declared the gtag() function (part of the installation of the Google tag)
  • You have updated the GA4 property in Google Analytics
  • You no longer have UA analysis on the page (or you want to change that in the near future)

Enable GA4 integration on Kameleoon

On the Integrations page

To use GA4, you must activate it on the Integrations page.

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

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

By clicking on “Install the tool”, you will be able to select the projects on which you want to activate it, so that information can be correctly reported to GA4.

Then click on “Validate” in the bottom-right corner: the configuration panel closes. You will then see an “ON” toggle to the right of the tool’s logo, as well as the number of projects the tool is configured on.

Please note that the code has been optimized to only send one GA event per campaign and per visit.

Please note that if you need to slightly change the behavior of our native bridge, you can create a custom analytics bridge and use our GA4 sample code you can take from our Github repository.

Kameleoon GA4 custom definitions / custom dimensions Setup

Kameleoon will send the data to GA4 through an event (“Kameleoon Experiment” for an A/B test ; or “Kameleoon Personalization” for a personalization). In order to analyze your results in GA4, you will need to create a custom dimension using this event name.

Create custom dimensions will help to select your experiments and personalizations for GA4 segments in your GA4 reports.

Click on “Custom definitions” under “Configure” (in the left-hand menu), then click on “Create custom dimensions”.

For A/B testing

  • Dimension name: kameleoon_experiment
  • Scope: Event
  • Description: contains experimentId-experimentName-associatedVariationId-associatedVariationName
  • Event parameter: experiment_variation

For Personalization

  • Dimension name: kameleoon_personalization (for example)
  • Scope: Event
  • Description: contains experimentId-experimentName-associatedVariationId-associatedVariationName
  • Event parameter: personalization_variation

That’s it! Whenever a visitor is bucketed into an experiment  or personalization campaign, Kameleoon will send the data to the defined custom dimensions.

If you have Google Tag Manager

If you have Google Tag Manager, an additional configuration is required.

Create 4 Variables into GTM

  • Kameleoon Campaign ID
    – Data Layer Variable Name: “campaign_id”
    – Data Layer Version: “Version 2”
  • Kameleoon Campaign Name
    – Data Layer Variable Name: “campaign_name”
    – Data Layer Version: “Version 2”
  • Kameleoon Variation ID
    – Data Layer Variable Name: “variation_id”
    – Data Layer Version: “Version 2”
  • Kameleoon Variation Name
    – Data Layer Variable Name: “variation_name”
    – Data Layer Version: “Version 2”

Create 2 Triggers

  • Kameleoon Experiment Trigger
    – Trigger Type: “Custom Event”
    – Event Name: “kameleoon_experiment”
  • Kameleoon Personalization Trigger
    – Trigger Type: “Custom Event”
    – Event Name: “kameleoon_personalization”

Create 2 Tags

For Experiment

  • Kameleoon Experiment Tag
    – Tag Type: “Google Analytics: GA4 Event”
    – Configuration Tag: your GA4 configuration
    – Event Name: “kameleoon_experiment”
    – Event Parameters:
    kameleoonExperimentID: {{Kameleoon Campaign ID}}
    kameleoonExperimentName: {{Kameleoon Campaign Name}}
    kameleoonVariationID: {{Kameleoon Variation ID}}
    kameleoonVariationName: {{Kameleoon Variation Name}}
    – Trigger: Kameleoon Experiment Trigger

For Personalization

  • Kameleoon Personalization Tag
    – Tag Type => Google Analytics: GA4 Event
    – Configuration Tag => your GA4 configuration
    – Event Name => kameleoon_personalization
    – Event Parameters:
    kameleoonPersonalizationID: {{Kameleoon Campaign ID}}
    kameleoonPersonalizationName: {{Kameleoon Campaign Name}}
    kameleoonVariationID: {{Kameleoon Variation ID}}
    kameleoonVariationName: {{Kameleoon Variation Name}}
    – Trigger: Kameleoon Personalization Trigger

Associate GA4 with a Kameleoon campaign

Graphic editor

Once GA4 has been activated on the Integrations page for a project, it has to be displayed in the “Tracking and goals” pop-in in the Graphic editor.

If you want to select it for an experiment, you can just click on the toggle – you have nothing else to parameter at this point.

Once GA4 is added, it is then displayed in the “Experiment summary” pop-in.

Experiments results page

Once GA4 has been chosen as tracking tool for an experiment, it appears in the “Reporting tools” list on the right-hand side of the experiment results page.

If you click on “Edit” you will access a pop-in where you can manage the used tools for this experiment. GA4 should also appear on this list.

Personalization creation page

Once GA4 has been activated on the Integrations page for a project, it has to be displayed in the “Reporting tools” list, when creating a personalization.

  • In this article :