> 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/optimize-your-setup/google-tag-gateway-gtg.md).

# Google tag gateway (GTG)

What Google Tag Gateway does, how it compares to your AdPage server-side setup, and when to combine the two.

{% hint style="info" %}
**Google Tag Gateway (GTG)** is a Google product for loading Google tags in first-party. It's a different layer than your AdPage container — this article explains how the two fit together, and links to the setup guides below.
{% endhint %}

## Why first-party delivery matters

Two things are steadily eating into standard tag measurement:

* **Ad blockers.** A large share of visitors now run one. If a script like `gtm.js` is blocked because it's requested from a Google domain, the tags inside that container never fire — no page views, no add-to-cart, no purchase events.
* **Safari's ITP.** Safari treats cookies set by client-side JavaScript as tracking cookies once it decides they were set in a third-party context, and caps their lifetime at 7 days. A returning visitor after a week can look like a brand-new one, which quietly degrades attribution, remarketing audiences, and journey reporting.

## What Google Tag Gateway actually does

GTG puts a reverse proxy on your own domain. Instead of the browser requesting `googletagmanager.com/gtm.js`, it requests a path on your domain (e.g. `yourdomain.com/8kpl/gtm.js`), which is silently forwarded to Google and back.

That gets you:

* **Google scripts served first-party** — GTM, the Google tag, and Google Ads all load from your domain.
* **A partial reduction in ad-blocker impact** — blockers that key off the Google domain lose that signal. Blockers that key off the *shape* of the request (URL pattern, parameters) aren't affected.

What it does **not** get you:

* **No Safari fix.** GTG doesn't change *how* cookies are set — GA4 and GTM still write them via JavaScript, so Safari's 7-day cap still applies.
* **Google tags only.** GTG has no effect on Meta, TikTok, Snapchat, Pinterest, or LinkedIn.

## How this relates to your AdPage container

Your AdPage container already gives you a first-party tagging subdomain with a full server-side GTM environment behind it — that's what Setup AdPage container walks you through. GTG and AdPage solve overlapping but different problems:

|                                                      | GTG only                                                       | Your AdPage container          | GTG + AdPage |
| ---------------------------------------------------- | -------------------------------------------------------------- | ------------------------------ | ------------ |
| Google scripts served first-party                    | ✅                                                              | ✅ (via your tagging subdomain) | ✅            |
| Ad blocker reduction                                 | ⚠️ Partial                                                     | ✅                              | ⚠️ Partial+  |
| Safari 16.4+ resilience (cookies beyond 7 days)      | ❌                                                              | ✅ Server-set cookies           | ✅            |
| Meta / TikTok / Snapchat / Pinterest / LinkedIn CAPI | ❌                                                              | ✅                              | ✅            |
| Webhook matching & Data Assistant monitoring         | ❌                                                              | ✅                              | ✅            |
| Setup complexity                                     | <p>Low–medium<br><br>Depends on with or without claudflare</p> | Medium                         | Medium–high  |

{% hint style="success" %}
**In short:** GTG is a solid, low-effort first step for first-party delivery of Google's own scripts. It doesn't replace your AdPage container — for Safari resilience, non-Google platforms, data enrichment, and monitoring, you still need server-side tagging.
{% endhint %}

## Combining GTG with your AdPage setup

You don't have to choose one or the other. Two ways to combine them:

**Option A — GTG loads the tag, AdPage keeps its own endpoint (simplest).** GTG serves the Google tag/GTM script first-party via its measurement path. Events still flow to your existing AdPage tagging subdomain exactly as before — no changes to your webhook matching, consent setup, or server container.

**Option B — the measurement path as a single entry point (most "GTG-aligned").** The browser only ever talks to one path on your domain. Your reverse proxy then routes Google-bound traffic to GTG and everything else to your AdPage tagging subdomain. More routing work, but a cleaner single entry point.

For most setups, **Option A** is the practical choice — it adds first-party delivery for Google's scripts without touching anything in your existing AdPage configuration.

{% hint style="info" %}
**GTG and AdPage work better together.** Use GTG for Google’s first-party delivery, then use AdPage to activate your data across your marketing stack.

* **GTG** provides a **first-party delivery layer** for Google scripts and selected requests.
* **AdPage** provides a **server-side data layer** for collection, processing, and delivery to multiple destinations.

Together, GTG is the first-party **front door**. AdPage is the server-side **engine** that powers your marketing data.
{% endhint %}

## Benefits and limitations

**Partial reduction of ad blocker impact**

GTG serves scripts and some requests through your own domain. This can reduce blocks that only target Google domains.

This does not bypass every ad blocker. Some blockers inspect the request itself. They may block its URL, parameters, path, or type, even on your domain.

**Safari 16.4+: GTG does not bypass ITP**

Safari's Intelligent Tracking Prevention (ITP) limits JavaScript-set cookies to seven days. This applies even when the script loads from your domain.

Google Analytics 4 (GA4) and Google Tag Manager (GTM) set cookies in the browser with JavaScript. GTG serves these scripts through your domain, but does not change how they set cookies. Safari still limits them to seven days.

To keep cookies longer than seven days in Safari, set them **server-side** with an HTTP `Set-Cookie` header. GTG does not set cookies this way.

**Scope**

GTG works with **Google scripts and tags**, including Google tag and GTM. It does not change non-Google tags, such as Meta or TikTok.

## Setup guides

GTG itself is configured on your CDN or infrastructure, not inside AdPage. Pick the guide that matches your setup:

{% content-ref url="/pages/sLi12S5bnOrr52zl9YZP" %}
[Setup GTG via Cloudflare](/optimize-your-setup/google-tag-gateway-gtg/setup-gtg-via-cloudflare.md)
{% endcontent-ref %}

{% content-ref url="/pages/KC1GkiQPxhr3uRhwHGMA" %}
[Setup GTG without Cloudflare](/optimize-your-setup/google-tag-gateway-gtg/setup-gtg-without-cloudflare.md)
{% endcontent-ref %}

## What's next?

Once GTG is live, verify it with Tag Assistant or your browser's network tab (covered in both setup guides), then confirm events are still arriving correctly in your AdPage Data Assistant.


---

# 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/optimize-your-setup/google-tag-gateway-gtg.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.
