# GA4 Integration via GTM

### Creating Data Layer Variable

* Log in to your GTM account.
* Click on the **Variables** from the sidebar and then click on **New** button present in User-Defined Variables section.

<figure><img src="/files/vMbXtDC1t89BOx6i5XFi" alt=""><figcaption></figcaption></figure>

* Enter the title as **CustomFit-Exp-Beh-String**
* Next, select the variable type as **Data Layer Variable**.
* Then, provide the Data Layer Variable Name as **customfit\_exp\_beh\_string**.
* Set the **Data Layer Version** to **Version 2.**
* Finally, set the **Default value** as **0** and click the **Save** button.

<figure><img src="/files/i1O43vCnmibii2b5MZCg" alt=""><figcaption></figcaption></figure>

### Creating Triggers

* Click on the **Triggers** from the sidebar and then click on the **New** button.

<figure><img src="/files/XXvHmgbCpOOrTuwiiXTJ" alt=""><figcaption></figcaption></figure>

* Give the **Trigger Name** as **CustomFit-Data-Push-GA4-Trigger**.
* Next, click on the **Trigger Configuration** and choose the Trigger type as **Custom Event**.
* Enter the E**vent name** as **customfit-data-push-ga4.**
* Finally, click on the **Save** button.

<figure><img src="/files/LsDcRAzY4WtnQKLqCSA7" alt=""><figcaption></figcaption></figure>

### Creating Tags

* Click on the **Tags** from the sidebar and then click on the **New** button.

<figure><img src="/files/2b4afZwg2bt9pxzwLq0K" alt=""><figcaption></figcaption></figure>

* Give the **Tag Name** as **CustomFit-Data-Push-GA4**.
* Next, click the **Tag Configuration** and choose Tag type as **Google Analytics**. In Google Analytics, select **Google Analytics: GA4 Event** option.
* In the **Measurement ID** field, enter the Measurement ID of the GA4 account to which the data needs to be sent.
* Enter the **Event Name** as **experience\_impression.**
* In the **Event Parameters** section, click on the **Add row** button. Give the **Event Parameter** as **exp\_variant\_string** and value as **{{CustomFit-Exp-Beh-String}}**.
* Finally, click the **Triggering** section, and choose the **Firing Triggers** as **CustomFit-Data-Push-GA4-Trigger**. And Click on the **Save** button.

<figure><img src="/files/T3QnnFclsYe5zU69f7wL" alt=""><figcaption></figcaption></figure>

### Enabling and Configuring GA4 in CustomFit.ai

GTM is now fully set up to capture your CustomFit.ai data. The next step is to forward this data to GA4 by enabling the GA4 integration within your CustomFit.ai experiences. For detailed guidance on enabling the integration and completing the setup, refer to the article [linked](/integrations/ga4-integration.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://doc.customfit.ai/integrations/ga4-integration-via-gtm.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.
