Skip to main content

Installing the TG site tag with Google Tag Manager

Written by TrafficGuard Support

Introduction

Using Google Tag Manager is the easiest way to install TG site tag. Follow these steps to set up the tag using our verified community template.


Watch the setup (2 min)

Prefer to see it before you do it? This short walkthrough takes you through installing the TG site tag in Google Tag Manager — from adding the template from the Community Gallery to choosing the right trigger for fastest protection.

The step-by-step instructions below cover the same flow if you'd rather read along or refer back later.


Add a new tag

  1. Log in to your Google Ads account and select the website you want to add the tag to.

  2. Navigate to Tags > New and create a new tag.

3. Click Tag Configuration and select Discover more tag types in the Community Template Gallery.

4. Search for and select the TrafficGuard Site Tracker Tag. Alternatively, you can add it to your workspace from this page.

5. Retrieve your TrafficGuard (property) ID: Log in to your TrafficGuard portal, and copy the unique ID for your site.

ℹ️ Where you find your TrafficGuard IDs depends on your account type:

  • Enterprise accounts: Go to Property settings and select your specific Property ID.

  • Subscription accounts: Go directly to your Account settings and select TrafficGuard ID.

6. Enter ID: Paste the ID into the tag configuration panel in GTM.

7. Advanced settings: Ensure the Tag firing options are set to the default: "Once per event".


💡 Tip

To combat the natural GTM delay, choosing the right trigger is vital for speed:

  • Page view (recommended): Fires as soon as the browser begins loading. Use this to ensure TrafficGuard starts protecting your site as early as possible.

  • DOM ready: Waits until the HTML structure is loaded. Use this only if your tag needs to "read" specific text or elements on your page.

  • Window loaded: This is the slowest option. It waits for every image and script to finish. Avoid this for TrafficGuard, as it allows bots to interact with your site before the protection is even active.


8. In the Triggering section, select All Pages.

9. Click Save, then click Submit in the top right corner of GTM to publish your changes.
​​


💡 Tip

Why GTM integration can feel slower than direct TG site tag integration?

When you integrate a script directly into your website’s HTML, it is one of the first things the browser sees and executes.

However, when using GTM, the browser must first load the GTM container, process the instructions inside, check which triggers are met, and then fire the TrafficGuard script. This "middle-man" process adds a slight delay.

If your GTM container is cluttered with many tags, this delay becomes more noticeable as the browser waits for the GTM queue to clear before reaching the TG site tag.


📝When using the TG site tag from the Google Community Template Gallery, you may see a warning about "injecting potentially unsafe scripts".


Don't worry, this is a standard Google security notice for any template that uses "Injects scripts" permissions. Because TrafficGuard must monitor traffic to protect your site, it requires access to the page to identify bot behavior. This warning simply confirms that the tag has the necessary permissions to perform its security functions.

Did this answer your question?