Skip to main content

TrafficGuard (TG) site tag

Written by TrafficGuard Support
Updated over 3 weeks ago

The TG site tag is a client-side snippet that tracks, measures, and validates website page views and events in real-time.

Overview

By default, the tag captures session information and user behavior. While basic tracking is available for all plans, custom event tracking is available for Enterprise customers only.

Installation instructions

To begin tracking, paste the tag into the <head> section of every page on your website, as high as possible.

Option 1: Copy from Settings

Navigate to your Property or Account settings to copy your unique, pre-configured code.

Option 2: Use the template

Copy the code below and replace {property-id} with your unique ID.

  • Enterprise accounts: Use the Property ID found in Property settings.

  • Subscription accounts: Use the TrafficGuard ID found in Account settings.

TG site tag template

<!-- TrafficGuard Start -->
<script>
window.dataTrafficGuard = window.dataTrafficGuard || [];
window.dataTrafficGuard.push(['property', '{property-id}']);
window.dataTrafficGuard.push(['event','pageview']);
(function() {
var tg = document.createElement('script'); tg.type = 'text/javascript'; tg.async = true;tg.src = 'https://tgtag.io/tg.js?pid={property-id}';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(tg, s);
})();
</script>
<noscript><img src="https://p.tgtag.io/event?property_id={property-id}&event_name=pageview&no_script=1" width="1" height="1" border="0"/></noscript>
<!-- TrafficGuard End-->

Alternate installation methods

The TG site tag can also be installed via various third-party platforms:


Advanced documentation

Advanced features like custom parameters, cookie adjustments, and specific event measurement are covered in our advanced documentation below.

ℹ️Custom events are available for Enterprise accounts only.

Did this answer your question?