Site Tracker Tag - cookie parameters

The Site Tracker Tag uses cookies to identify users across browsing sessions. This page explains how to customise the cookie settings.

 

Parameter name Example value Description
cookie_domain auto,
1.trafficguard.ai, 2.trafficguard.ai

Used to specify individual sub domains where cross sub domain tracking is not desired.

By default the Site Tracker Tag has automatic cookie domain configuration enabled. 

Format: string 

cookie_expires 600

Long term cookie expiration time in minutes. 

Default value for these cookies is 365 days (8760 hours).

Format: integer 

cookie_prefix Any string value that fits cookie name.
”_test” → cookie name will be “_test_cookie” instead of _cookie

Used to add a prefix for all cookie names used in js_tag service.

Format: string 

 

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 Site Tracker Tag has automatic cookie domain configuration enabled. 

To turn off automatic cookie domain configuration, update the config for your property to specify a value for the cookie_domain parameter:

Cookie prefix

To avoid conflicts with other cookies, you may need to change the cookie prefix, which will be prepended to cookies set by the Site Tracker 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.