Skip to main content

Saving Cookie on Parent Domain

Written by Sasha Gerold
Updated over 3 weeks ago

By default, the tracking cookie is saved on the current domain where the click script is implemented.

If your user flow spans multiple subdomains (e.g. landing page β†’ checkout), you need to store the cookie on the parent domain to ensure tracking works correctly across all subdomains.

When should you use this?

Use this setup if:

  • Your landing page and conversion page are on different subdomains

  • You want to track users across multiple subdomains

Example:

  • Landing page: promo.yourwebsite.com

  • Checkout: checkout.yourwebsite.com

Step 1: Update the click script

Add the cidDomain parameter to your click script:

<!-- 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 -->

What to update:

  • Replace yourtenantid with your actual Tenant ID

  • Replace .yourparentdomain with your root domain

Example:

  • Use .yourwebsite.com for all subdomains of yourwebsite.com

Step 2: Update the conversion script

You must apply the same configuration when creating conversions:

<!-- 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 -->

⚠️ Important

  • The same cidDomain value must be used in both scripts

  • The value must include a leading dot (e.g. .yourdomain.com)

  • If not configured correctly, conversions across subdomains may not be tracked

How it works

  • The cookie is stored on the parent domain

  • It becomes accessible across:

    • All subdomains

    • The root domain

The cookie name follows this format:
​ trakdesk_cid_{tenantId}

Summary

  • Default behavior stores cookies per domain

  • Use cidDomain to enable cross-subdomain tracking

  • This ensures conversions are correctly attributed across your entire domain structure

Did this answer your question?