Should there be multiple _ga tracking cookies for a gtm UA tracked property containing multiple subdomains? - cookies

If example.com contains multiple subdomains and all of it resides in a single UA property, assuming subdomain tracking is properly set up in gtm (IE cookieDomain is set to auto and the root domain is on the referral exclusion list for google analytics), should more than one _ga cookie exist on page load when visiting subdomains?
For example, my gtm snippet is included across all subdomains and it fires a pageview UA tag properly and I visit status.example.com, should I see a _ga cookie with an example value of GA1.3.605803990.1475857272 with the status.example.com domain scope and a _ga cookie with an example value of GA1.2.1926999794.1476293458 with the example.com domain scope?
Or should there always be one _ga cookie fixed at just the root domain? I'm trying to determine why my google analytics is still reporting self referrals for both my root domain and subdomain.

If you want to track your domain and subdomains within a single property there should be a single _ga cookie. To make sure there is just one cookie the cookie domain should be set to "auto" when you create the tracker
ga('create','UA-XXXXXXX-X','auto');
which will make sure the cookie is set at the highest possible 'level'. If you get the code from the GA property settings the "auto" setting should already be in there, if you create the tracker via Google Tag Manager you need to explicitly set this via the "set fields" option where you set the field name to "cookieDomain" (GTM has an autosuggest feature that will help with the field names) and the value to "auto".

Related

Trying to read a cookie on a different cookie domain using Google Tag Manager

My cookie domain is .mywebsite.com
I also have cookies stored on the domain www.mywebsite.com
I am trying to get Google Tag Manager to "read" a cookie on "www.mywebsite.com" in order to pass to Google Analytics.
Is this possible?
Using the cookie variable, GTM is not able to read the cookie name.
If the cookie has the http-only attribute, you can't read it using JavaScript and/or GTM.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies?retiredLocale=de

Getting user cookies from apps script

Is there an alternative to this javascript:
document.cookie
which can be run inside apps script?
Context:
I'm using Google Analytics Measurement Protocol and is trying to collect __utmz cookie values from inside apps script functions to apply them to:
UrlFetchApp.fetch('https://www.google-analytics.com/collect...............') requests.
That __utmz cookie is being assigned at http://chrome.google.com/webstore/detail/.... page.
You don't need cookies: If users click a link from domain A to domain B you should add the _ga parameter that you get from linkerParam to the link. Then on domain B you should set allowLinker to true for GA to read the value of the _ga parameter and use it to identify the user as being the same as on domain A.

Application insights setAuthenticatedUserContext with API on another domain

I have Application Insights configured on both the front and back-end of my website, which operate on different sub-domains (let's say www.mydomain.com and api.mydomain.com).
The cookie containing the user information set by setAuthenticatedUserContext is stored by AI with the cookie domain set to www.mydomain.com. When I make a call to api.mydomain.com the cookie is not included, and therefore the credentials I set are not associated with any AI data logged by the API.
My API has Access-Control-Allow-Credentials set to true, and the front-end has withCreditials set to true on the XHR object.
Can I get AI to set a different cookie domain, or is there some other issue at play here stopping the user information reaching the API?
Update: I notice Google Analytics sets a cookie with the domain set simply to .mydomain.com, and this cookie information is included with calls to my API.
This is not currently supported but there is an issue opened on GH for it: https://github.com/Microsoft/ApplicationInsights-JS/issues/64
Please continue monitoring GH link, we will provide an update soon. Thanks!

How do I add domain to the jsessionid cookie in coldfusion?

We are using ColdFusion 9.0.1 and are having issues with the JSESSION cookie being shared between a domain and a sub domain. They are two different websites and we do not wish to share any session information between them.
How do I add a value to the domain field of the jsessionid cookie? I've seen some examples of people creating a second jsessionid cookie manually but I would rather stick to just one.
I don't think the domain is set on the cookie by default which should limit it to the same domain, perhaps someone has edited your jrun-web.xml file and hard coded a value (look for cookie-domain tag)? See http://livedocs.adobe.com/jrun/4/Programmers_Guide/techniques_servlet13.htm for more info.

Sub domain cookie security

Very simple question here. Knowing about cross domain cookie security, does the same apply to sub domains?
EG. Should I be able to read a cookie set on some.abc123.com from the sub domain of www.abc123.com?
Cookie domains are suffix matching, so cookies of www.abc123.com will not be sent on the site of some.abc123.com and visa versa.
To have cookies be sent on both domains you should use .abc123.com as the domain.
As an alternative set a cookie at the abc123.com level then set and read cookies from there.
see here
Setting cookies for multiple sub-domains