# How to integrate Batch's snippet using Google Tag Manager?

## 1. Create a tag <a href="#id-1-create-a-tag" id="id-1-create-a-tag"></a>

Click on "New tag" and select "Custom HTML" as your tag configuration

<div align="center"><figure><img src="/files/uOrYSkpQYWCfhwrV8pnZ" alt="Two tag creation options are available: the first one is Custom HTML Tag, and the second one is Custom Image Tag."><figcaption></figcaption></figure></div>

Paste your Batch snippet in the HTML textbox:

<figure><img src="/files/ztH6LR83zyD3pArAIVAC" alt="This is the configuration screen for the new Custom HTML Tag. A section named &#x27;HTML&#x27; is available for inserting the JavaScript tag code."><figcaption></figcaption></figure>

## 2. Define a trigger <a href="#id-2-define-a-trigger" id="id-2-define-a-trigger"></a>

The snippet should be triggered on all your website's pages (Select "All pages" as a firing trigger) unless there are subdomains you want to exclude, in which case you should add exceptions.&#x20;

To add an exception to your tag triggers, you should create a new trigger that will be used as an exclusion trigger.&#x20;

If you want to exclude all subdomains, use the following condition:

<div align="center"><figure><img src="/files/yp3qPMRdX95UJSOsCxIz" alt="This is the trigger configuration screen for the HTML Tag, where you can choose the trigger type in this case, it&#x27;s a Page View."><figcaption></figcaption></figure></div>

If you want to exclude a list of subdomains, use the following conditions:

<figure><img src="/files/MLb1RqX9ykngwwX34k74" alt="Still on the same trigger configuration screen for the HTML Tag, we want the tag to fire on specific pages of the website. We’ve selected only three pages."><figcaption></figcaption></figure>

Once your exclusion trigger has been created, add it to your tag's trigger settings as an exception:

<figure><img src="/files/18DebQYYkNoQzgBSNub3" alt="We&#x27;re back on the main tag configuration screen, which provides a summary of the defined settings."><figcaption></figcaption></figure>

That’s it, when you are all set, release the new tag in staging or in production. Make sure you test your integration correctly by following the steps described here: [Testing my web push integration](/developer/technical-guides/how-to-guides/web/how-to-test-my-web-push-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.batch.com/developer/technical-guides/how-to-guides/web/how-to-integrate-batchs-snippet-using-google-tag-manager.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.
