> ## Documentation Index
> Fetch the complete documentation index at: https://www.macaly.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Tag Manager

> Add Google Tag Manager to your Macaly project

Google Tag Manager (GTM) lets you manage tracking tags (analytics, ads, remarketing) from one dashboard, without editing code every time you add a new tool.

Instead of asking the agent to add each tracking script separately, you add GTM once and manage everything else from the GTM interface.

<Callout icon="user">
  Available on all plans
</Callout>

## Why use Google Tag Manager

* **One setup, any tool.** Add GTM once and connect Google Analytics, Meta Pixel, LinkedIn Insight Tag, and more, all without touching your project again.
* **Full control from the GTM dashboard.** Add, update, or remove tags anytime without having to prompt the agent each time.
* **Understand exactly how visitors use your site.** Track clicks, form submissions, page views, and custom events with GTM triggers.
* **Test before anything goes live.** GTM's preview mode lets you confirm tags are firing correctly before you publish.

## What you need

Before you start, make sure you have:

* A **Google Tag Manager account**. Create one for free at [tagmanager.google.com](https://tagmanager.google.com)
* Your **GTM Container ID**. It looks like `GTM-XXXXXXX` and you'll find it at the top of your GTM workspace

## Add GTM to your project

Open the chat in your Macaly project and ask the agent:

```
Add Google Tag Manager to my site. My container ID is GTM-XXXXXXX.
```

The agent adds the GTM script to your project in the right place, both the `<head>` and `<body>` portions, following Google's recommended setup.

<Tip>
  Replace `GTM-XXXXXXX` with your actual container ID from your GTM dashboard.
</Tip>

## Verify it's working

After the agent adds GTM, you can confirm it's active:

<Steps>
  <Step title="Open GTM Preview mode">
    In your GTM dashboard, click **Preview**. Enter your Macaly project's URL.
  </Step>

  <Step title="Check the Tag Assistant">
    Google Tag Assistant opens in a new tab and connects to your site. You should see your container listed as **connected**.
  </Step>

  <Step title="Check for fired tags">
    Browse your site and watch the Tag Assistant panel. Any tags you've configured in GTM should appear as **fired**.
  </Step>
</Steps>

## What to do next

Once GTM is running, you manage everything from the GTM dashboard:

| Task                    | Where to do it           |
| ----------------------- | ------------------------ |
| Add Google Analytics    | GTM dashboard → Tags     |
| Add Meta Pixel          | GTM dashboard → Tags     |
| Track button clicks     | GTM dashboard → Triggers |
| Track form submissions  | GTM dashboard → Triggers |
| Add conversion tracking | GTM dashboard → Tags     |

<Info>
  **GTM vs adding scripts directly.** If you only need Google Analytics and nothing else, you can skip GTM and [add GA4 directly](/en/integrations/google-analytics). GTM is worth it when you plan to use multiple tracking tools or want to manage tags without returning to the chat.
</Info>

<Info>
  **Cookie consent.** GTM tags often set cookies that track visitor behavior. If your site has visitors from the EU, UK, or other regions with privacy laws, you are responsible for ensuring a cookie consent solution is in place before GTM tags fire.
</Info>

## Good to know

* GTM doesn't slow down your site when set up correctly. The agent follows Google's async loading recommendation
* You can use GTM's **built-in variables** to track page paths, click URLs, form IDs, and more without any extra code
* If you need the agent to fire a custom event (like a successful booking or purchase), just ask. The agent can push events to GTM's data layer
