> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abconvert.io/llms.txt
> Use this file to discover all available pages before exploring further.

# GA4 Integration: Track Experiments in Google Analytics

> Connect ABConvert to GA4 to receive experiment impression events and analyze test group performance alongside your other Google Analytics data.

Connecting ABConvert to Google Analytics 4 lets you analyze experiment performance alongside all of the other behavioral data you're already collecting in GA4. Once connected, ABConvert fires a custom event every time a visitor is assigned to an experiment, so you can build reports that segment any GA4 metric — sessions, revenue, engagement — by experiment and variant.

## What gets tracked

When the integration is active, ABConvert sends a `abconvert_experience_impression` event to your GA4 property each time a visitor enters an experiment. The event includes:

| Parameter                      | Description                                                             | Example               |
| ------------------------------ | ----------------------------------------------------------------------- | --------------------- |
| `abconvert_experiment_id`      | The numeric experiment ID                                               | `1001`                |
| `abconvert_experiment_name`    | The experiment name                                                     | `Homepage price test` |
| `abconvert_group_index`        | The assigned test group index                                           | `1`                   |
| `abconvert_variant_name`       | The assigned variant name                                               | `Variant B`           |
| `abconvert_exp_variant_string` | Combined experiment + group key in the format `experimentId-groupIndex` | `1001-1`              |
| `abconvert_assignment_reason`  | Why this assignment happened                                            | `random_split`        |

These parameters are available as event parameters in GA4 and can be used to create custom dimensions, apply them to explorations, or build audience segments.

## Setup

<Steps>
  <Step title="Find your GA4 Measurement ID">
    In Google Analytics, go to **Admin** → **Data Streams** → select your web data stream. Your Measurement ID appears at the top right of the stream details panel. It follows the format `G-XXXXXXXXXX`.
  </Step>

  <Step title="Copy the Measurement ID">
    Click the copy icon next to the Measurement ID or select the full string (including the `G-` prefix).
  </Step>

  <Step title="Enter the ID in ABConvert">
    In ABConvert, go to **Settings** and find the **GA4 Measurement ID** field. Paste your Measurement ID and click **Save**.
  </Step>

  <Step title="Verify the connection">
    Run a live experiment and open **GA4 → Reports → Realtime**. You should see `abconvert_experience_impression` appearing in the event stream within a few minutes of a visitor being assigned to an experiment.
  </Step>
</Steps>

<Frame caption="Verify impression events in GA4 Realtime">
  <img src="https://mintcdn.com/abconvert/ZR9ptaJPTQV33cXt/images/configuration/ga4-realtime-streaming.png?fit=max&auto=format&n=ZR9ptaJPTQV33cXt&q=85&s=f544f064b1233c19936d6fb42d119a7e" alt="GA4 Realtime overview showing event count by event name with abconvert_experience_impression listed in the event stream" width="1200" height="687" data-path="images/configuration/ga4-realtime-streaming.png" />
</Frame>

<Note>
  Your Measurement ID must follow the format `G-XXXXXXXXXX` (the letter G followed by a hyphen and alphanumeric characters). ABConvert validates the format when you save — if the field shows an error, double-check that you've copied the full ID from GA4.
</Note>

## Building reports in GA4

Once the integration is running and impression events are flowing into GA4, you can analyze experiment data in several ways.

**Custom dimensions**

To use ABConvert event parameters in standard GA4 reports, register them as custom dimensions:

1. Go to **Admin** → **Custom definitions** → **Custom dimensions**
2. Click **Create custom dimension**
3. Set the scope to **Event**
4. Set **Event parameter** to one ABConvert parameter (for example `abconvert_experiment_name` or `abconvert_variant_name`)
5. Repeat for other parameters you want to report on

After registering, GA4 will start populating the dimension in reports going forward (historical data won't be backfilled).

<Frame caption="Set custom dimension scope to Event when registering ABConvert parameters">
  <img src="https://mintcdn.com/abconvert/ZR9ptaJPTQV33cXt/images/configuration/ga4-custom-dimension.png?fit=max&auto=format&n=ZR9ptaJPTQV33cXt&q=85&s=b16da5e79cb269615653cbf4b6b5407c" alt="GA4 edit custom dimension dialog showing scope set to Event and event parameter field for an ABConvert parameter" width="1366" height="610" data-path="images/configuration/ga4-custom-dimension.png" />
</Frame>

**Explorations**

GA4 Explorations give you the most flexibility for analyzing experiment results. To compare variants correctly, create one **user segment** per test group.

<Steps>
  <Step title="Open Segment overlap in Explorations">
    In GA4, go to **Explore** and choose **Segment overlap**.
  </Step>

  <Step title="Create a user segment for control">
    Add a **User segment** with an event condition where event name equals `abconvert_experience_impression`, then filter the same event by:

    `abconvert_experiment_id = <your experiment id>`

    `abconvert_group_index = 0`
  </Step>

  <Step title="Create a user segment for each variant">
    Duplicate the control segment and change `abconvert_group_index` to `1`, `2`, or other variant indexes used in your experiment.
  </Step>

  <Step title="Compare outcomes">
    Add business metrics like purchases, revenue, or engagement and compare segments side by side.
  </Step>
</Steps>

<Frame caption="Choose User segment in GA4 Explorations">
  <img src="https://mintcdn.com/abconvert/ZR9ptaJPTQV33cXt/images/configuration/ga4-user-segment.png?fit=max&auto=format&n=ZR9ptaJPTQV33cXt&q=85&s=eeba97eb66e9a01c999c70a493cb6a9d" alt="GA4 custom segment setup screen with User segment selected as the segment type" width="1934" height="584" data-path="images/configuration/ga4-user-segment.png" />
</Frame>

<Frame caption="Build a user segment using ABConvert impression event parameters">
  <img src="https://mintcdn.com/abconvert/ZR9ptaJPTQV33cXt/images/configuration/ga4-user-segment-2.png?fit=max&auto=format&n=ZR9ptaJPTQV33cXt&q=85&s=40ade974db9408a4a51a150db4b9165c" alt="GA4 user segment condition builder filtering abconvert_experience_impression by ABConvert experiment and variant fields" width="2736" height="1242" data-path="images/configuration/ga4-user-segment-2.png" />
</Frame>

<Tip>
  If you want a single filter field per segment, use `abconvert_exp_variant_string` (for example `1001-0` for control and `1001-1` for Variant 1).
</Tip>

**Funnel exploration**

Build a funnel exploration with steps for page view → add to cart → purchase, then apply variant segments as breakdowns. This lets you see exactly where in the purchase funnel each variant performs differently.

## Things to know

* GA4 impression events are fired client-side by the ABConvert script. If a visitor has an ad blocker or has opted out of tracking, the event may not be sent.
* The integration supplements ABConvert's own analytics — it does not replace them. Use ABConvert's dashboard for statistical significance calculations and conversion metrics; use GA4 for deeper behavioral and cross-channel analysis.
* There is no additional cost in ABConvert or GA4 for enabling this integration. GA4's standard event limits apply.
