Skip to main content

Installing the TG site tag with Google Tag Manager

Written by TrafficGuard Support
Updated over a week ago

Introduction

If you are using Google Tag Manager you can easily add our TG site tag.

Add a new tag

  • Login to your Google Ads account and select the website you want to add the tag to.

  • Create a new tag.

  • In the tag configuration, choose the "TrafficGuard Site Tracker Tag" from the Community Template Gallery.

  • Alternatively, you can add it to your workspace from this page.

  • From the TrafficGuard portal, copy your property's ID and paste it into the tag configuration panel.

  • Once the tag is inserted, toggle the Advanced Settings and the default tag firing option of "Once per event" is set.

  • 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.

  • In the new tag's triggering card, choose 'All Pages'.
    ​​

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.

Note:
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?