UTM source getting overriden with referral when going to subdomain - google-analytics

I have a site http://test.com. Potential customers are sent to that site with AdWords with a UTM source, so for example, http://test.com?utm_source=adwords. Now if the customers decide to register, they are sent to a page at http://register.test.com. I've configured Google Analytics to work cross domain using _gaq.push(['_setDomainName', '.mysite.com']);, but the problem I'm having is that my source gets lost and replaced with a referral to the original domain when I go to the subdomain's page. I tried adding a _gaq.push(['_addIgnoredRef', 'ekomobi.com']);, but that only causes my source to be set to (direct).
I will be trying to save the __utmz cookie's value and restore it on the other domain, but are there any other proper solutions to the problem of the UTM source getting overriden by the referrer on a domain change?

If you have cross-domain tracking correctly implemented, you should see the original utm parameter when you get to the register page. For cross domain tracking to work, BOTH top-level domain and subdomain must have _gaq.push(['_setDomainName', '.mysite.com']);,.

Related

Google Analytics track to Initial Referrer

A user clicks on a referring link to visit our eCommerce website, but does not yet place an order. Then the user goes back directly to our website at a later point and places an order. How can we set up in google analytics / tag manager that the initial referrer should stay the referrer for this user?
Example: A customer visited example.com and clicked on a link to our website. Then the customer bookmarked our website url. Then at a later point, the customer visits our website through the bookmark or through a Google search. How do we track that example.com was the original referrer for this customer?
Thank you for your help.
If the user returns with the bookmark, the previous source will automatically result as a consequence of the standard Google Analytics attribution model. While if accessed from organic search this will overwrite the previous source.
What you can do to save the first source is to install a cookie on the user's browser so that the first time it saves the source in a custom dimension, while if the cookie already exists it does not save it.

Manually setting the Google Analytics Client ID

I have a sub-domain that I am unable to put GTM or GA tracking code on. I have GA on the main domain.
I can retrieve the _ga cookie and get the Client ID but but if a user has not been to the main website they won't have one.
My question is:
Can I set a cookie called _ga (in the same format as GA sets it) and will this get picked up by GA if the user then goes back to the main website?
This article seems to be what you need:
Cookie Settings And Subdomain Tracking In Universal Analytics
https://www.simoahava.com/analytics/cookie-settings-and-subdomain-tracking-in-universal-analytics/

Universal Analytics and login redirect

As part of user flow on my site, user is redirected to a different domain that is not under my control, where he logs in and is then redirected back to my site.
Google analytics fail to correctly display the user flow, showing the callback URL as a new landing page, which is obviously wrong.
I am considering rewriting referrer on the callback page, but it seems like a very hacky solution to a common problem.
Is there a standard way to connect the flow after a redirect?
You must enter the domain of that site in the Referral exclusions list in the Properties settings.

_ga querystring, is this part of classic or universal google analytics

I help manage a site that had classic google analytics installed and it has recently migrated to universal analytics via Google Tag Manager.
Now when travelling to a subdomain google is appending the cookie information to the anchor, as a querystring value.
?_ga=1.94005085.150702697.1452253355
Apparently this has didn't happen with classic analytics, even though the set up is like this:
pageTracker._trackPageview(getPageUri(true));
pageTracker._setAllowLinker(true);
Does anyone know if the url will be changed when travelling to a sub domain on classic analytics with the above options?
This is down to how your cookies are setup. For hypothetical purposes assume that your website and subdomain are:
www.website.com
subdomain.website.com
These domains can share a cookie and therefore share the Google Analytics information however unless you specifically set the custom variable of cookieDomain to auto (with GTM tag setup: #3 Configure Tag > More Settings > Fields to set > + Add Field > cookieDomain | auto) you essentially have two distinct cookies for each domain.
I also presume you have then also setup "Cross-Domain Tracking" and included "website.com" within "Auto Link Domains" setting in GTM.
TL;DR: Updating your cookieDomain settings to utilise "auto" will force GTM to first attempt to set a cookie for .com (which will fail) and then attempt to set one for "website.com" (will work work) and your cross domain tracking won't be required.
Bonus info: However to add some context for your question the code pageTracker._setAllowLinker(true); allows the linker to be applied to URL's in Classic Analytics, you would still need to decorate your links with code such as below, if you didn't have this before your links wouldn't have included the linker code (and wouldn't have shared cookied if on different cookie domains/paths).
<a href="http://www.my-example-blogsite.com/intro"
onclick="_gaq.push(['_link', 'http://www.my-example-blogsite.com/intro.html']); return false;">
See my blog</a>

Google Analytics Referral Path Empty When Using Campaign URL Builder

A URL was generated using Google Analytic's (GA) URL Builder (https://support.google.com/analytics/answer/1033867?hl=en).
The URL includes the utm_source and other required params for GA.
When clicking on a link with this URL the Referral Path is not available. Instead only the Source shows with an empty Referral Path. The Source is set to the value of utm_source.
However, when visiting the page WITHOUT the custom URL via a link the Referral Path is set correctly.
Why does this happen? How can I fix this?
You cannot fix this. Referral Path is available for referral traffic. If you use campaign parameters you turn your link into campaign traffic (this is obviously some unusal use of the word referrer, but Google is thinking in terms of marketing channels instead of the technical definition).
The way around would probably be a custom dimension that stores the referring url.
First you'd have to create a custom dimension in the property settings - I'd go for session level, since the referrer that brought a visitor to your site does not change during the visit.
Then you check (in the source code of your website) window.document.referrer to see if originates from your own domain (in which case you dismiss it) or from another domain, in which case you set it as a dimenson. Basic example (not production code):
if(window.document.referrer.indexOf('mydomain') == -1) {
ga('set', 'dimension1', window.document.referrer);
}
(meaning: if the name of my domain is not a part of the string that makes up the referrer url; and this would be followed by your usual page tracking).
This will store the referrer regardless and you can select your custom dimension as a second dimension or use it in custom reports (of course for CPC traffic or dispay advertising you will get google.com or the adress of the adserver as referrer which isn't that helpful, but for your use case it should work).

Resources