Skip to main content

Experiment Events in the dataLayer for GTM and GA4

· 2 min read

We’ve added experiment events to the dataLayer, making it easier to integrate experiments with Google Tag Manager (GTM) and Google Analytics 4 (GA4).

When a visitor is exposed to an experiment, Lyftio automatically pushes an event containing experiment and variation information to the dataLayer. GTM can then capture this event and forward it to GA4 for further analysis.

This allows you to segment analytics data by experiment variation directly inside GA4.

This feature requires a configuration in Google Tag Manager to forward the events to GA4.


How It Works

By default, Lyftio pushes an event to the dataLayer the first time a visitor is exposed to an experiment during a session.

The event includes the following information:

  • Experiment ID
  • Variation ID

Example event pushed to the dataLayer:

dataLayer.push({
event: "experience_impression",
exp_variant_string: "LYFTIO-401245-611002"
});

Google Tag Manager can be configured to listen for this event and send the data to GA4.


Setting Up GTM

To use this integration, you need to configure GTM to capture the event and forward it to GA4.

The basic setup involves:

  1. Creating a Custom Event Trigger in GTM that listens for the event name.
  2. Creating a GA4 Event Tag.
  3. Passing the experiment parameters (such as experiment ID and variation ID) to GA4.

Once configured, GA4 will receive the experiment information as part of your analytics data.


Analyzing Experiments in GA4

With experiment data available in GA4, you can create segments based on variation exposure. This provides additional context when reviewing experiment outcomes. Follow this guide for more information on how to segment on variations.


A Complementary Analysis Tool

While GA4 can provide useful insights, it is important to note that this integration is designed as a supplementary analysis tool.

Experiment results should still be evaluated using the experiment reporting and statistical analysis within Lyftio. GA4 metrics can help provide additional behavioral insights but should not be used as the primary measure of experiment success.