---
title: "Google Tag Manager for QR codes and links"
description: "Connect a Google Tag Manager container to Linkbreakers so every person who scans your QR codes or opens your links fires the tags you choose, including Pinterest, Snap, Reddit, X and Microsoft Ads. Triggers that work, where to find the container ID, Preview mode, consent and limits."
canonical: "https://linkbreakers.com/help/article/google-tag-manager-for-qr-codes-and-links"
last-updated: 2026-11-01
---

# Google Tag Manager for QR codes and links

> Connect a Google Tag Manager container to Linkbreakers so every person who scans your QR codes or opens your links fires the tags you choose, including Pinterest, Snap, Reddit, X and Microsoft Ads. Triggers that work, where to find the container ID, Preview mode, consent and limits.

:::try-ai-prompt {"prompt":"Connect my Google Tag Manager container GTM-ABC1234 to all my links and QR codes","description":"Set up Google Tag Manager with the Assistant.","target":"assistant"}:::

## Short answer

Open **Integrations** in the Linkbreakers dashboard, pick **Google Tag Manager** under **Retargeting pixels**, paste your container ID and select **Connect**. From then on, every person who scans one of your QR codes or opens one of your links loads your container, which fires the tags you set up in it.

Google Tag Manager is how you reach platforms that have no field of their own in Linkbreakers, such as Pinterest, Snap, Reddit, X or Microsoft Ads, and how you add a second Google tag or a second pixel of a platform. Tags only fire if their trigger runs early, so use an **Initialization** or **All Pages** trigger.

The container adds a short page before the redirect, usually well under a second and never longer than 1.2 seconds. It is available on every plan, Free included.

## Quick summary

- One container ID per workspace, applied to every link and QR code by default, or only to the links you select
- Linkbreakers pushes `gtm.start` to the `dataLayer` and loads your container; your container decides what fires
- Use **Initialization - All Pages** or **All Pages** triggers; triggers that wait for clicks, scrolls or timers will not run
- The page URL your tags see is the Linkbreakers short link address, so you can limit tags to it with a **Page Hostname** condition
- Only people load it: bots, link previews, AI agents and automated browsers are skipped
- Consent for marketing cookies is the workspace's responsibility
- Also available from the Assistant, the MCP server, the REST API and the CLI

## How it works with Google Tag Manager

Once a container is connected, a person's visit goes through a brief page in their browser. That page runs Google Tag Manager's standard snippet: it pushes the `gtm.start` event to the `dataLayer`, then loads your container. The container fires whatever tags and triggers you published. The page redirects as soon as the scripts have loaded and had about 300 ms to send, and never later than 1.2 seconds.

Linkbreakers does not add tags, events or variables of its own. What happens is what your published container does.

### Set triggers that fire in time

The visitor leaves within about a second, so a tag must fire as the page loads:

- **Initialization - All Pages** fires first, before other page view triggers except consent initialization
- **All Pages** (a Page View trigger) also fires as the container loads

Triggers based on clicks, form submissions, scroll depth, timers or element visibility will not run on this page, since there is nothing to click and no time to wait. Window Loaded and DOM Ready triggers may or may not fire before the redirect, so do not rely on them here.

### Fire tags only on the Linkbreakers page

If you also use the same container on your own website, your tags already fire there. To give the Linkbreakers page its own tags, add a condition to the trigger:

1. Create a Page View trigger of the type **Initialization** or **Page View**
2. Choose **Some Page Views** (or some initialization events)
3. Set **Page Hostname** equals your Linkbreakers link domain, such as your custom domain

The page URL is the address of the Linkbreakers link that was opened, so **Page URL** or **Page Path** conditions also let you fire a tag for one campaign's short link only.

### Pinterest, Snap, Reddit, X and Microsoft Ads

For each platform, add its base tag to your container with one of the triggers above:

1. In Google Tag Manager, select **Add a new tag**
2. Look for the platform's template in the **Community Template Gallery**. Many ad platforms publish one there. If yours does not, paste the platform's base code in a **Custom HTML** tag
3. Enter the platform's ID in the tag and keep its page view or base event
4. Attach the **Initialization - All Pages** or **All Pages** trigger, with the hostname condition if you need it
5. Select **Submit** to publish the container

Then build the audience in that platform's ads manager, from visitors of URLs that contain your short link, as you would for website visitors.

The same works for a second Google tag (for example GA4 when the [Google tag](/help/article/google-tag-ga4-and-google-ads-for-qr-codes-and-links) field holds your Google Ads ID) or a second Meta Pixel.

## Where to find your container ID

In **Google Tag Manager**, open your container. The container ID, starting with `GTM-`, is shown in the workspace header at the top of the page. Make sure the container is **published**: Linkbreakers loads the live version, not your unpublished changes.

Linkbreakers checks the shape when you save: `GTM-` followed by 4 to 12 letters or digits. Anything else is refused with `RETARGETING_PIXEL_INVALID`, and nothing is changed.

## Step-by-step in Linkbreakers

1. Open the dashboard and go to **Integrations**
2. Under **Retargeting pixels**, open **Google Tag Manager**
3. Paste your container ID and select **Connect**
4. Read the delay notice and the consent note on the page
5. In Google Tag Manager, check your triggers and publish the container
6. [Check that the tags fire](#how-to-check-that-it-fires)

To use another container, replace the ID and select **Save**. To turn it off, select **Remove**. When no pixel is left on the workspace, links go back to redirecting instantly.

## How to check that it fires

1. In Google Tag Manager, select **Preview** to open Tag Assistant
2. Enter one of your Linkbreakers links as the URL to connect to
3. In the Tag Assistant window, look at the first page's events and the tags that fired on it

The page redirects within about a second, so the debugger moves on to your destination quickly, and it may not always connect before the redirect. Check the summary for the first page rather than the current one, and try again if it did not connect. The extensions of each platform (such as TikTok Pixel Helper or Meta's extension) also show their own tag on that first page.

Ad blockers and some browsers' tracking protection block Google Tag Manager and the tags inside it. Visitors who use them block them on your links too, as on any website.

## The short delay

Tags are JavaScript that runs in the visitor's browser, and a plain redirect runs none. So once a pixel is connected, people's visits go through the brief page described above: usually well under a second, never longer than 1.2 seconds. Every tag you add to the container is one more script for that page, so keep the container for links lean.

If you also use Advanced data collection, both share the same page, so the visit loads one page, not two.

## Who fires the tags

Only visits classified as **Human** go through the pixel page. Crawlers, link previews (Slack, Teams, Discord, WhatsApp, Facebook, LinkedIn), AI agents and recognized automated browsers get the instant redirect and never load your container.

See [how Linkbreakers detects AI agents and automated browsers](/help/article/how-linkbreakers-detects-ai-agents-and-automated-browsers) for how visits are classified.

## Consent

The tags in your container set the marketing cookies of each platform. In the EU and the UK, that usually needs the visitor's consent first. Linkbreakers does not show a consent banner. Covering your tags in your privacy policy and consent setup is the workspace's responsibility.

A consent banner loaded from your container would not have time to be answered: the page redirects within 1.2 seconds whatever happens. If your tags wait for consent, through consent mode or your consent platform's settings, they may not fire, or may fire without cookies, for visitors who have not already given consent on that domain.

## Set it up from an AI agent, the API or the CLI

**Assistant**: in the dashboard, ask "Connect my Google Tag Manager container GTM-ABC1234 to all my links".

**MCP server**: an agent connected to the [Linkbreakers MCP server](/help/article/mcp-server-setup) calls `retargeting_pixels_update` with `gtm_container_id`. Only the fields sent change, so the other pixels keep their value. For example:

> Set my Google Tag Manager container to GTM-ABC1234 on my Linkbreakers workspace and leave the other pixels as they are.

**REST API**, with a token that has the `integrations:write` scope:

```bash
curl -X PUT https://api.linkbreakers.com/v1/retargeting-pixels \
  -H "Authorization: Bearer $LINKBREAKERS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"gtmContainerId": "GTM-ABC1234"}'
```

Send `{"gtmContainerId": ""}` to remove it.

**CLI**, from the next CLI release:

```bash
linkbreakers retargeting-pixels update --gtm-container-id GTM-ABC1234
```

The agent sets the container ID in Linkbreakers. Tags and triggers are set up in Google Tag Manager itself. See [set up every Linkbreakers integration with an AI agent](/help/article/set-up-linkbreakers-integrations-with-an-ai-agent-mcp) for the other integrations an agent can configure.

## Limits and caveats

- **Early triggers only.** Initialization and All Pages triggers fire in time; click, scroll, timer and visibility triggers do not
- **Your container, your events.** Linkbreakers pushes `gtm.start` and loads the container. It sends no conversion, purchase or lead events of its own
- **All links by default.** The container loads for every link and QR code of the workspace until you choose **Selected links** under **Where it fires** and pick links, directories or tags; Page Hostname, Page URL or Page Path conditions in your triggers split it further
- **One container per workspace.**
- **Published version only.** Unpublished changes do not run on your links
- **Short delay on people's visits**, usually well under a second, never longer than 1.2 seconds
- **No consent banner.** Consent is the workspace's responsibility
- **Blocked like any tag** by ad blockers and tracking protection

## Frequently asked questions

### Which trigger should I use?

**Initialization - All Pages** or **All Pages**. Both fire as the container loads, before the redirect.

### Can I use Pinterest, Snap, Reddit, X or Microsoft Ads?

Yes. Add the platform's base tag to your container, from the Community Template Gallery or as a Custom HTML tag, with an early trigger, and publish.

### Can I use the same container as my website?

Yes. Add a Page Hostname condition to the triggers of the tags meant for links, so you know which tags fire where. Tags with an All Pages trigger and no condition will fire on both.

### Can I have GA4 and Google Ads at the same time?

Yes. Put one ID in the Google tag field and add the other as a tag in your container.

### Why do my tags not show up in Preview mode?

The page redirects within about a second, so the debugger may not connect in time or may move on to your destination. Check the first page in the summary, and try again. Also check that the container is published and that the tags use an early trigger.

### Why was my container ID refused?

A container ID is `GTM-` followed by 4 to 12 letters or digits. A Google tag ID such as `G-` or `AW-` goes in the Google tag field instead.

## Sources

- Linkbreakers Google Tag Manager page, API and MCP tool, checked in the product on 2026-10-30.
- [Retargeting pixels overview](/help/article/retargeting-pixels-meta-google-tiktok-linkedin-and-google-tag-manager)
- [How to retarget people who scanned your QR code with ads](/help/article/how-to-retarget-people-who-scanned-your-qr-code-with-ads)
- Tag Manager Help, create an account and container: https://support.google.com/tagmanager/answer/6103696
- Tag Manager Help, about triggers: https://support.google.com/tagmanager/answer/7679316
- Tag Manager Help, page view triggers: https://support.google.com/tagmanager/answer/7679319
- Tag Manager Help, custom tags: https://support.google.com/tagmanager/answer/6107167
- Tag Manager Help, preview and debug containers: https://support.google.com/tagmanager/answer/6107056

## Last reviewed

2026-10-30 by Laurent Schaffner.
