rememberConsentGiven, setCookieDomain and mtm_consent

Hey all

I’m sharing a little bit of information which may help others: when using consent cookies across subdomains (a.example.com, .example.com, b.example.com etc), the command:

tracker.setCookieDomain(’.example.com’)

Must be called before tracker.requireConsent();

If setCookieDomain isn’t called before other tracker methods, browser cookies are not generated correctly; instead, cookies are created for the domain the user is currently on (e.g. a.example.com).

Cheers!

1 Like