> For the complete documentation index, see [llms.txt](https://docs.adpage.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.adpage.io/getting-started/setup-gtm-web-container.md).

# Setup GTM web container

Go from sign-up to your first deploy in under five minutes.

## GA4 configuration

In your Google Tag Manager web container, you'll set up GA4 event tags based on site-interactions. These tags turn those interactions into events and send them to your server container URL. Once GA4 tracking is set up properly on the client side, sending those events out to the different platforms from the server becomes pretty simple.

{% stepper %}
{% step %}

### Overwrite the GA4 endpoint in the Google Tag

If you use server-side tagging, your GA4 hits should be sent to your own tracking domain instead of directly to Google. The easiest way to do this is in one place: the Google Tag.&#x20;

The Google tag (`gtag.js` outside of Google Tag Manager) is not a tag that measures something by itself. It loads the Google measurement library and sets up the shared configuration that all your GA4 hits use.

A GA4 Event tag contains almost nothing on its own. It adds the event name and its event parameters, and inherits everything else from the Google tag that carries the same Measurement ID. That is exactly why the endpoint override belongs on the Google tag: set it once, and every event tag follows.

Open the Google Tag in the Google Tag Manager web container used for the GA4 configuration. Ensure that the following three parameters are added:

* server\_container\_url = your AdPage server container URL
* send\_page\_view = false
* first\_party\_collection = true

<figure><img src="https://1274044937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA65KwL1NwewlJbtCXsXd%2Fuploads%2FgwZVhk3GEr90cGwMqpzo%2Fimage.png?alt=media&amp;token=876d52dd-e733-458e-91ab-4931cd6a5f6b" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### GA4 page\_view event tag

Because we've just set the 'send\_page\_view' configuration parameter to false in the Google Tag, we will need a separate GA4 event tag.&#x20;

{% hint style="info" %}
You set the `send_page_view` parameter to `false` in the Google tag. The reason is that the `page_view` event would otherwise be created automatically the moment the Google tag fires. If that happens, you cannot add any extra parameters to that `page_view` event. The `event_id` parameter in particular matters a great deal, because the tracking setup of marketing platforms relies on it for deduplication.
{% endhint %}

Go to **Tags** and create new tag. Select **Google Analytics: GA4 Event** as the tag configuration. In the **Measurement ID** input field you fill in your GA4 property's Measurement ID, and in the **Event Name** field you fill in 'page\_view'.

<figure><img src="https://1274044937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA65KwL1NwewlJbtCXsXd%2Fuploads%2F0xnNJd76US1NfvQ6U0jM%2Fimage.png?alt=media&amp;token=3e2da1fe-239e-4d79-a838-75b83b2c7a4b" alt=""><figcaption></figcaption></figure>

Give this tag the correct **Trigger**. If you are using a Consent Management Platform with a dataLayer event push on every page, you set up the trigger based on that dataLayer event. Otherwise choose the **All Pages** trigger.
{% endstep %}
{% endstepper %}

Every other GA4 event tag in your web container that uses the same Measurement ID picks up its configuration from the Google tag. From this point on, all of them get sent to your `server_container_url` instead of straight to Google Analytics. That includes purchases, form submissions, custom events, and everything else you built earlier. This is exactly what's supposed to happen, but it does mean your whole GA4 measurement now runs through the server container.

So test it before you publish. Open preview mode in your web container, click through the pages and interactions that fire your GA4 event tags, and check that each request goes to your tracking domain. Keep the preview of your server container open next to it so you can confirm the events show up there, get claimed by the GA4 Client, and go out to GA4 with the parameters you expect. Don't publish until you've seen every important event make it through from start to finish.

## What's next?

You’ve finished configuring the Google Tag Manager web container to send GA4 event requests towards your server container. Before you start testing the configuration so far and setting up your marketing platform tracking, let's first set up the Data Assistent Tag for events monitoring so that you can monitor what’s happening on the website's dataLayer.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.adpage.io/getting-started/setup-gtm-web-container.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
