The TrafficGuard (TG) site tag uses cookies to identify users across browsing sessions. While the default configuration works for most setups, you can customize these parameters to suit your specific tracking or privacy requirements.
Parameter | Example value | Format | Description |
cookie_domain | auto, | string | Used to specify individual sub domains where cross sub domain tracking is not desired. By default, the TG site tag has automatic cookie domain configuration enabled. |
cookie_expires | 600 | integer | Long term cookie expiration time in minutes. Default value is 365 days (8760 hours). |
cookie_prefix | Any string value that fits cookie name. | string | Used to add a prefix for all cookie names used in js_tag service. |
To change any of these values, update the tag.
For example:
<!-- TrafficGuard Start -->
<script>
var dataTrafficGuard = dataTrafficGuard || [];
dataTrafficGuard.push(['property', '{property-id}']);
dataTrafficGuard.push(['event','pageview','{"cookie_domain":"landing1.trafficguard.ai","cookie_expires":8750,"cookie_prefix":"_test"}']);
(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-->
Cookie domain
By default, the TG site tag automatically detects your domain. To restrict tracking to a specific subdomain, update the config for your property to specify a value for the cookie_domain parameter.
Cookie prefix
If you need to distinguish TG cookies from other scripts, use a cookie prefix, which will be prepended to cookies set by the TG site tag.
Cookie expiration
On each page load, the cookie expiration time is updated to be the current time plus the value of the cookie_expires field.
If you set the cookie_expires value to 0 (zero) seconds, the cookie turns into a session-based cookie and expires once the current browser session ends.
