Tracking across Domains and sub domains

HI Everyone,

I’m trying to consistenly track a user across domains and subdomains. I’ve read documentaion that is available on this but i have one question;

When i have the following code on the main domain in the main Javascript tracking tag as given by the admin screen on the Matomo web app;

_paq.push([‘setCookieDomain’, ‘*www.example.com’]);

What is the equivalent code that goes on the subdomain (lets call it www.checkout.example.com)?

  1. _paq.push([‘setCookieDomain’, ‘*www.example.com’]); (this seems to fail as it cant set this on the subdomain)
  2. _paq.push([‘setCookieDomain’, ‘*www.checkout.example.com’]); (am i now setting two cookie domains which defeats the purpose of this?)
  3. do i set then all to _paq.push([‘setCookieDomain’, ‘*.example.com’]) and remove the www
  4. something else!

EDIT - also we have a checkout on recharge which is https://checkout.rechargeapps.com/
what would be the setCookieDomain we would need to place on this domain?

Thanks and sorry for the daft question,
Steve

Has anyone used the setCookieDomain code before?