Integrate Kameleoon with Google Analytics 4

Written by Julie Trenque

Updated on 01/16/2024

4 min

Intermediate

Manage your integrations

Analytics

Automation

CDP

CMP

CMS/CRM

Data Warehouses

Developers

Was this content useful?

This integration is deprecated. We recommend using the new Google Analytics 4 integration. If you are using Google Tag Manager (GTM), we have created a specific documentation page just for you.

Integrate Kameleoon with Google Analytics 4 and automatically send events when your users are targeted by your Kameleoon campaigns.

Events let you measure user interactions on your Kameleoon campaigns; for example, you can measure when someone loads a specific experiment, personalization or variation. Google Analytics 4 allows you to use data from events to create reports with information about your website audience. Learn more

If you want to use Google Analytics 4 Audiences in Kameleoon, please read this documentation.

Key benefits

  • Use GA4 reports to analyze your campaigns.
  • Track the impact your campaigns have on the right metrics (acquisition, retention, activation, etc.).

Considerations

When using this integration, we assume that:

  • You’ve set up Google Analytics and are starting to see data in your reports,
  • You want to collect more information about your Kameleoon campaigns (that Google Analytics is not automatically collecting)

Setup using the Google tag (gtag.js)

Prerequisites

To configure this  integration, you should have done the following actions:

Send Kameleoon Exposure Events to GA4

Step 1: Enable GA4 integration on Kameleoon

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.

Make sure you select Google tag (gtag.js) as the method to be used when sending events.

You can also provide a Measurement ID if you would like to use a specific data stream in GA4. In this case, click on the checkbox and enter your Measurement ID in the dedicated field.

If you enable the GA4 integration for more than one project, you will be able to switch between projects using the dropdown.

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.

Note: 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.

Step 2: Associate GA4 with a Kameleoon campaign

Once GA4 has been activated on the Integrations page for a project, it will be listed among the available tracking tools when configuring your campaigns.

In the Graphic/Code editor

When finalizing your experiment, click the Integrations step to configure Google Analytics 4 as a tracking tool. 

Click on Google Analytics 4 to select GA4 as your tracking tool.

Google Analytics 4 will be mentioned in the summary before going live. Kameleoon will automatically transmit the data to Google Analytics 4 and you will be able to view your results directly in the tool.

On the personalization creation page

In the same way as the Graphic Editor/Code Editor of your experiments, you can select Google Analytics 4 among the reporting tools for personalization.

On the results page

Once Google Analytics 4 is set as a reporting tool for an experiment, you can select (or unselect) it via the Kameleoon results page. To do this, click on Reporting Tools in the panel on the right to open the corresponding menu.

The reporting tools associated with the experiment are displayed. Click Edit to edit this selection.

You can then select or unselect Google Analytics 4. Then click on Validate and continue to finalize or update your campaign.

On a feature flag

Learn how to manage third-party analytics integrations

Setup using Google Tag Manager

Prerequisites

To configure this  integration, you should have done the following actions:

Send Kameleoon Exposure Events to GA4

Step 1: Create GA4 Event tags in Google Analytics

Start by creating a Google Analytics: GA4 Event tag for the new events sent by Kameloon.

  1. In Google Tag Manager, click An image of the Tags icon Tags > New.
  2. Enter a name for the GA4 Event tag at the top (e.g., “Kameleoon Experiment”).
  3. Select Google Analytics: GA4 Event.
  4. In Configuration Tag, select your Google Analytics: GA4 Configuration tag.
  5. In Event Name, enter a name for the event (e.g. experiment_variation). This will create a new custom event and the name will appear in your GA4 reports.
  6. In Tag Configuration, expand Event Parameters.
  7. In Parameter Name, enter a name for the parameter (e.g., “button_label”).
  8. In Value, click An image of the Add variable icon next to the field to add a variable.
  9. Choose a variable for the value of the event parameter: 
    1. Select + in the top right and enter a title for the variation.
    2. Click the Variable Configuration box.
    3. Choose Data Layer Variable.
    4. Enter the name of the event attribute as the Data Layer Variable Name
  10. Save your changes and publish your container.

You have to create two GA4 Event tags: one for your experiments and one for your personalizations. Of course, the GA4 Event tag for experiments will have a different configuration than the GA4 Event tag for personalizations.

For experiments

Your configuration for experiments will be the following:

  1. GA4 Event tag name (at the top): “Kameleoon Experiment”
  2. Tag Type: select Google Analytics: GA4 Event
  3. Configuration Tag: select your Google Analytics: GA4 Configuration tag
  4. Event Name: “kameleoon_experiment
  5. Event Parameters: add four parameters with the following attributes:
    1. Parameter Name: kameleoon_campaign_name
      Value > Data Layer Variable > Data Layer Variable Name: kameleoon_campaign_name
    1. Parameter Name: kameleoon_campaign_id
      Value > Data Layer Variable > Data Layer Variable Name: kameleoon_campaign_id
    2. Parameter Name: kameleoon_variation_name
      Value > Data Layer Variable > Data Layer Variable Name: kameleoon_variation_name
    3. Parameter Name: kameleoon_variation_id
      Value > Data Layer Variable > Data Layer Variable Name: kameleoon_variation_id
For personalizations

Your configuration for personalization will be the following:

  1. GA4 Event tag name (at the top): “Kameleoon Personalization”
  2. Tag Type: select Google Analytics: GA4 Event
  3. Configuration Tag: select your Google Analytics: GA4 Configuration tag
  4. Event Name: kameleoon_personalization
  5. Event Parameters: add four parameters with the following attributes:
    1. Parameter Name: kameleoon_campaign_name
      Value → Data Layer Variable → Data Layer Variable Name: kameleoon_campaign_name
    2. Parameter Name: kameleoon_campaign_id
      Value → Data Layer Variable → Data Layer Variable Name: kameleoon_campaign_id
    3. Parameter Name: kameleoon_variation_name
      Value → Data Layer Variable → Data Layer Variable Name: kameleoon_variation_name
    4. Parameter Name: kameleoon_variation_id
      Value → Data Layer Variable → Data Layer Variable Name: kameleoon_variation_id

Step 2: Create triggers in Google Analytics

Next, create a trigger to send the event when a visitor is targeted by one of your campaigns.

In Google Tag Manager, every Tag requires a Trigger to fire. As you chose to set up this integration using Google Tag Manager,  Kameleoon will set events using the data layer. Therefore, we have to create a Custom Event Trigger, where we specify the value of the ‘event’ key in the data layer that fires your tag.

  1. Click the Triggering box in your GA4 Event tag.
  2. Click + on the top right.
  3. Enter a name for the trigger (e.g., “Trigger – Signup newsletter”).

You have to create two Triggers: one for your experiments and one for your personalizations. 

For experiments

Your configuration for experiments will be the following:

  1. Click the Triggering box in your GA4 Event tag.
  2. Click + on the top right.
  3. Enter a name for the trigger: “Trigger – Kameleoon Experiment”.
  4. Click the Trigger Configuration box in your trigger.
  5. Click on Custom Event.
  6. Enter the Event Name: “kameleoon_experiment
  7. Save all your changes.
For personalizations

Your configuration for personalization will be the following:

  1. Click the Triggering box in your GA4 Event tag.
  2. Click + on the top right.
  3. Enter a name for the trigger: “Trigger – Kameleoon Personalization”.
  4. Click the Trigger Configuration box in your trigger.
  5. Click on Custom Event.
  6. Enter the Event Name: “kameleoon_personalization
  7. Save all your changes.

Step 3: Enable GA4 integration on Kameleoon

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.

Make sure you select Google Tag Manager as the method to be used when sending events.

If you enable the GA4 integration for more than one project, you will be able to switch between projects using the dropdown.

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.

Note: The code has been optimized to only send one GA event per campaign and per visit.

Note: 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.

Step 4: Associate GA4 with a Kameleoon campaign

Once GA4 has been activated on the Integrations page for a project, it will be listed among the available tracking tools when configuring your campaigns.

In the Graphic/Code editor

When finalizing your experiment, click the Tracking and Goals  step to configure Google Analytics 4 as a tracking tool. 

In the Other tracking tools tab, click on Google Analytics 4 to select GA4 as your tracking tool.

Google Analytics 4 will be mentioned in the summary before going live. Kameleoon will automatically transmit the data to Google Analytics 4 and you will be able to view your results directly in the tool.

On the personalization creation page

In the same way as the Graphic Editor/Code Editor of your experiments, you can select Google Analytics 4 among the reporting tools for personalization.

On the results page

Once Google Analytics 4 is set as a reporting tool for an experiment, you can select (or unselect) it via the Kameleoon results page. To do this, click on Reporting Tools in the panel on the right to open the corresponding menu.

The reporting tools associated with the experiment are displayed. Click Edit to edit this selection.

You can then select or unselect Google Analytics 4. Then click on Validate and continue to finalize or update your campaign.

See your events in Analytics

Report on a custom event

When someone performs the action that triggers the custom event, the event will appear in the Realtime report and DebugView. You can also click the name of an event in the Realtime report and DebugView to see its event parameters.

When Analytics processes your custom event, you can use the following to see the event:

  • In Reports, go to the Events report
  • In Admin, go to Events in the Property column
  • In Explore, create a free-form exploration with the Event name dimension

Report on a custom event parameter

To see the event parameter values, you must create a custom dimension or metric for each event parameter. Once Analytics processes the custom dimension or metric, you can add it to your custom reports, audiences, explorations, and segments, and as secondary dimensions in standard reports.

References

Setup using the Google tag (gtag.js)

Setup using Google Tag Manager

See your events in Analytics

  • In this article :