# 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="https://38998153-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCL8wF0y1T2vLnm3yR2MW%2Fuploads%2FSOVKPbjPKSOfGvJfJO55%2Fweb_gtm-custom-html_170425.png?alt=media&#x26;token=8562afea-0052-4789-8f16-2a90ad28ba36" 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="https://38998153-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCL8wF0y1T2vLnm3yR2MW%2Fuploads%2F3PADgfb6EkzTFVE9OVzO%2Fweb_gtm-tag-config_170425.png?alt=media&#x26;token=ba676713-f34b-49fa-bd1b-6506065f9df7" 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="https://38998153-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCL8wF0y1T2vLnm3yR2MW%2Fuploads%2Fi1402AkYxWlOvtktXthf%2Fweb_gtm-trigger-config-1_170425.png?alt=media&#x26;token=08595667-bec8-46dc-8b3b-78e06900b3d4" 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="https://38998153-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCL8wF0y1T2vLnm3yR2MW%2Fuploads%2F4EmnShUnd8ZMR3vybRcb%2Fweb_gtm-trigger-config-2_170425.png?alt=media&#x26;token=f3e2b06a-21a9-4112-b955-45888b18422e" 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="https://38998153-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCL8wF0y1T2vLnm3yR2MW%2Fuploads%2FGg4nJSRFcdMwLTp70evS%2Fweb_gtm-release-tag_170425.png?alt=media&#x26;token=8f728fb6-8d78-404a-a1b3-1e3709366a51" 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](https://doc.batch.com/developer/technical-guides/how-to-guides/web/how-to-test-my-web-push-integration).
