utag_main cookie and subdomains

Gold Contributor
Gold Contributor
We have a different product offering running in a subdomain of our main site. Say main.mytestsite.com -> Main site secondary.mytestsite.com -> Different product but uses subdomain We have a different tags/library/profile for main and secondary. The problem is the utag_main cookie needs to be different for each profile, otherwise anything stored in the cookie will collide. Advice on how to solve this problem? Thanks, Sriram
7 REPLIES 7

utag_main cookie and subdomains

Employee Emeritus
In "Publish Settings" there is a field for "Domain" (this is the cookie domain.) You can enter "main.mytestsite.com" for this value on your first profile. And then use "secondary.mytestsite.com" for your second profile.

utag_main cookie and subdomains

Gold Contributor
Gold Contributor
Thanks Ty. I missed a constraint: Can the domain field take wildcards? Main site is actually -> *main.mytestsite.* examples: main.mytestsite.com, secure.mytestsite.com, main.mytestsite.jp, secure.mytestsite.jp etc. This is a finite but largish list. and similarly Secondary site is -> *secondary.mytestsite.*

utag_main cookie and subdomains

Employee Emeritus
Using main.mytestsite.com should work also for www.main.mytestsite.com and www2.main.mytestsite.com (but the cookie would still be under "main.mytestsite.com" and this is a shared cookie.) The expectation is you would have a separate profile for "main.mytestsite.jp" "secure.mytestsite.com" does not match your pattern of "*main.mytestsite.*" Did you mean to say "secure.main.mytestsite.com"?

utag_main cookie and subdomains

Gold Contributor
Gold Contributor
You are right about secure.main.mytestsite.com. About different profiles for different locations, this would be a maintenance problem for us. Currently we have one profile which handles all domains (mytestsite.com, mytestsite.jp, and several other locales). In terms of cookies: main.mytestsite.com -> utag_main main.mytestsite.jp -> utag_main While I understand that these are different domains, it would be great if we could have just 2 profiles and have a cookie which is associated with each profile. main.mytestsite.com -> utag_main main.mytestsite.jp -> utag_main etc. secondary.mytestsite.com -> utag_main_secondary secondary.mytestsite.jp -> utag_main_secondary etc. Is there some way to do this? The alternative would be for us to create as many profiles as we have locales for one or both: main and secondary, which is something we would like to avoid.

utag_main cookie and subdomains

Employee Emeritus
In this special case, it may be easiest to do a utag.js template update to support the two domains in the same profile. At this point, please contact your Account Manager to connect you with a Solutions Engineer to build a custom code.

utag_main cookie and subdomains

Gold Contributor
Gold Contributor
Will do. Thanks, Sriram

utag_main cookie and subdomains

Employee Emeritus
Actually.. Try this code out in a "PreLoader" scope extension. This lets you programmatically set the utag_main cookie domain (without needing a template update to utag.js) // JS Extension scoped to "Preloader" var utag_cfg_ovrd = {}; utag_cfg_ovrd.domain = "main.mytestsite.com"; if (location.hostname && location.hostname.indexOf(".mytestsite.jp")>0) { utag_cfg_ovrd.domain = "main.mytestsite.jp"; }
Public