Cookie domain in JS Tracker vs. collector

In the JS Tracker docs, it says:

If your website spans multiple subdomains e.g.

www.mysite.com
blog.mysite.com
application.mysite.com
You will want to track user behaviour across all those subdomains, rather than within each individually. As a result, it is important that the domain for your first party cookies is set to ‘.mysite.com’ rather than ‘www.mysite.com’. By doing so, any values that are stored on the cookie on one of subdomain will be accessible on all the others.

Set the cookie domain for the tracker instance using the cookieDomain field of the argmap. If this field is not set, the cookies will not be given a domain.

In the Clojure Collector docs, it says:

Setting the domain name can be useful if you want to make the cookie accessible to other applications on your domain. If we, for example, set up the collector on collector.snplow.com and did not set a domain name, the cookie will default to this domain. However, if we set it to .snplow.com in the Property Value against SP_DOMAIN property, that cookie will be accessible to other applications running on *.snplow.com.

How do these two parameters effect one another? I’m confused because I thought the Clojure Collector only sets the 3rd party cookie, not the first party cookie, and the whole point of the third party cookie is to be domain-independent.

Hi @dweitzenfeld - the way to think of the two cookies is as follows:

  • The JS Tracker’s cookie is always tied to the domain on which the JavaScript is executing
  • The collector’s cookie is always tied to the domain which is serving the collector’s response

The terms “first-party” and “third-party” are borrowed from online advertising and they are not always helpful here. Here are a few scenarios that could help:

Multiple TLD ecommerce business

  • shop.com, shop.co.uk, shop.de
  • Rely on cross-domain linking and collector cookie for tracking
  • Collector cookie set to .shop.com

Single TLD business

  • site.com, blog.site.com, forums.site.com et al
  • Use JS Tracker cookie set to .site.com
  • Collector cookie adds no real value here (unless you start doing off-site tracking e.g. for conversion pixels)

Advertising or analytics widget

  • Runs on a whole network of sites
  • Use collector cookie set to .getwidget.com
  • JS Tracker cookie adds no real value here
1 Like

Thanks @alex, this was very helpful.