# Setting up  Google Analytics 4 integration with AB Tasty

Google Analytics is a service that helps you measure traffic and engagement across your websites and apps. Google Analytics 4 (GA4) is the latest version of the platform.

AB Tasty Google Analytics 4 integration lets you send AB Tasty campaign data directly to your GA4 dashboard. AB Tasty campaign data is pushed to GA4 as an event with the following parameters:

* **Event name**: `abtasty`
* **Event parameter `abtasty_campaign`**: contains the campaign ID and name, formatted as `[campaign_id] campaign_name`
* **Event parameter `abtasty_variation`**: contains the variation ID and name, formatted as `[variation_id] variation_name`

## Prerequisites

* An AB Tasty account
* A GA4 account

## Setting up Google Analytics 4 integration

{% stepper %}
{% step %}

### Retrieve your GA4 Measurement ID

The **Measurement ID** is the unique identifier of your GA4 data stream (format: `G-XXXXXXX`).

To find it:

1. In Google Analytics, go to **Admin > Property > Data Streams > Web**.
2. Select your data stream.
3. Copy the Measurement ID from the top right. More info [here](https://support.google.com/analytics/answer/9539598)
   {% endstep %}

{% step %}

### Configure the integration in AB Tasty

1. In AB Tasty, go to **Integrations > Integration Hub**.
2. Under **PUSH**, select **Google Analytics 4** and click **Create**.
3. Name your connector (to identify it easily).
4. Enter your **Measurement ID** and click **Connect**.
5. *(Optional)* Enter your **API secret** if you use Measurement Protocol. [More info here](/integrations/push-integrations/setting-up-google-analytics-4-integration-with-ab-tasty/how-to-configure-ga4-measurement-protocol.md).
6. *(Optional)* Enter your **Property ID** for automatic audience creation. [More info here](/integrations/push-integrations/setting-up-google-analytics-4-integration-with-ab-tasty/enabling-automatic-audience-creation-for-g4a.md).
7. *(Optional)* Check the box to add this connector automatically to all future campaigns.
8. Click **Save**.
9. Update your AB Tasty tag to make changes live.

{% hint style="info" %}
&#x20;If you checked the auto-apply option, the connector will appear in the **Advanced** step of all future campaigns. It won’t apply retroactively to existing campaigns. You can always add it manually per campaign in **Advanced options**.
{% endhint %}
{% endstep %}

{% step %}

### GA4 custom dimension setup <a href="#h_01hdh9g2x27mjsxr5y8nepe6ht" id="h_01hdh9g2x27mjsxr5y8nepe6ht"></a>

To access AB Tasty event parameters in GA4 reports, create custom dimensions for `abtasty_campaign` and `abtasty_variation`.

1. In GA4, go to **Admin > Property > Custom definitions**.
2. Under **Custom dimensions**, click **Create custom dimension**.
3. Fill in:
   * **Dimension name**: unique name (use underscores/spaces, not hyphens).
   * **Scope**: select the desired scope.
   * **Description**: meaningful description.
   * **Event parameter/User property**: choose the data source.
4. Click **Save**.

<img src="/files/2SMoEETyju0Y2tvfGA6U" alt="" width="375">
{% endstep %}

{% step %}

### Check integration <a href="#h_01gnf071qndevpfdnwpsmxebvs" id="h_01gnf071qndevpfdnwpsmxebvs"></a>

#### **Using browser console**

1. Join a campaign where the GA4 integration is enabled.
2. Open your browser console > **Network tab**.
3. Search for your GA4 **Measurement ID**.
4. Check payloads containing the event `abtasty` and its parameters. If you see them, the integration is working.

<figure><img src="/files/c78q5P6y45kGasPnG192" alt="" width="563"><figcaption></figcaption></figure>

#### In GA4 dashboard

* **Real-time report** : shows currently received AB Tasty events.
* **Events report** : shows processed events after collection.

<figure><img src="/files/hmcRurlrGbzQ4nSU63mA" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

## Learn more <a href="#h_01jcr1t2hpmac64rape6qv3cmq" id="h_01jcr1t2hpmac64rape6qv3cmq"></a>

Check out the following videos and articles to learn more on how to integrate GA4 with AB Tasty:

* [New user (how to create with your measurementID)](https://www.veed.io/view/fr-FR/4defaecb-97c2-4f76-89a8-de4cdec6bf5f)
* [Current User (only how to integrate EmotionAI Audience)](https://www.veed.io/view/fr-FR/3757547c-a069-40ac-9f26-4f4517e4c09f)
* [How to enable EmotionsAI audience for GA4](/integrations/push-integrations/setting-up-google-analytics-4-integration-with-ab-tasty/how-to-enable-emotionsai-audience-for-ga4.md)
* [Enabling automatic audience creation for G4A](/integrations/push-integrations/setting-up-google-analytics-4-integration-with-ab-tasty/enabling-automatic-audience-creation-for-g4a.md)
* [How to configure GA4 Measurement Protocol](/integrations/push-integrations/setting-up-google-analytics-4-integration-with-ab-tasty/how-to-configure-ga4-measurement-protocol.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.abtasty.com/integrations/push-integrations/setting-up-google-analytics-4-integration-with-ab-tasty.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
