Skip to main content

Saving Cookie on Parent Domain

Sasha Gerold avatar
Written by Sasha Gerold
Updated this week

Tracking cookie is by default saved to the current domain where click script is present.

If you would be interested to save the tracking cookie to a parent domain, to be able to access it from different subdomains, then there is an extra function that needs to be enabled in the scripts to correctly move the tracking cookie and correctly retrieve it.

Below is the click script needed:

<!-- Trackdesk tracker begin -->
<script async src="//cdn.trackdesk.com/tracking.js"></script>
<script>
(function(t,d,k){(t[k]=t[k]||[]).push(d);t[d]=t[d]||t[k].f||function(){(t[d].q=t[d].q||[]).push(arguments)}})(window,"trackdesk","TrackdeskObject");

trackdesk("yourtenantid", "click", { _meta: { cidDomain: '.yourparentdomain' } });
</script>
<!-- Trackdesk tracker end -->

You will need to put your tenant ID in the script. Click here to see where to find your tenant ID.

You will also need to fill in your parent domain name. E.g. if your landing page is on checkout.yourwebsite.com and you wish to save the tracking cookie to yourwebsite.com, then you will use value .yourwebsite.com

Subsequently, you would need to create a conversion, you will need to make change as seen below:

<!-- Trackdesk tracker begin -->
<script async src="//cdn.trackdesk.com/tracking.js"></script>
<script>
(function(t,d,k){(t[k]=t[k]||[]).push(d);t[d]=t[d]||t[k].f||function(){(t[d].q=t[d].q||[]).push(arguments)}})(window,"trackdesk","TrackdeskObject");

trackdesk("yourtenantid", "conversion", {
_meta: { cidDomain: '.yourparentdomain' },
"conversionType": "lead"
});
</script>
<!-- Trackdesk tracker end -->

The cookie name in this case differs to a default name, and the script is then specifically looking for cookie trakdesk_cid_{tenantId}

Did this answer your question?