Working on a web app where at step 2 the user leaves to her domain and comes back. The domain she leaves to is dynamically entered into our form (this step is required for an OAuth token flow).
So we're having that domain appear as a referrer and want to keep the original referrer in Google Analytics.
Used to be (with ga.js) you'd just pass utm_nooverride=1 in the callback URL coming back to your site, but we're using analytics.js.
Linker Params won't work because we can't dynamically control the callback URL.
So: Questions:
1) Does the excluded referrers list in GA for a web property allow regular expressions? It allowed *.sample.com to be saved, but I haven't tested whether it works or not yet.
2) Or is there an API call to our GA account we can make to add dynamic excluded referrer domains on the fly?
Any other way to solve this?
Long time no seen, funny to find you here.
Now for your question, I see 2 options,
The Referrer exclusion list doesn't support regexes. But it does exclude all subdomains. So if all the domains you are interested in removing are subdomains of something specifically you can remove only the top level domain and should be good. More Info
There's a trick you can use to force analytics.js to not send the referrer to GA if you don't want to. You can manually set the referrer to an empty string on that page. You can do it always or when it matches the user entered hostname. It would look something like this:
var hostname_to_ignore = 'site.com';
ga('create', 'UA-XXXXX-Y', 'auto');
if(document.referrer.indexOf(hostname_to_ignore) > 0) {
ga('set', 'referrer', '');
}
ga('send', 'pageview');
Not sending the referrer will keep GA from creating a new session and it should just continue the previous session if the last hit was less than 30 min ago. That's probably what you want. I didn't test this, it's possible that setting it to null or undefined is even better, I would try it out and check what the hits look like.
More Info
Related
A.S/ probably for another SE.com site: why "referer" is spelt with only r at Google's?
Anyway, here we go again with another occurrence of RefererNotAllowedMapError.
I couldn't find my answer in the existing Q&As.
Hypothesis:
I have a local website that includes a GMap.
It displays and works
fine provided I remove all restrictions on that key, from the Google
API console.
But the browser will receive a Google Maps JavaScript
API error: RefererNotAllowedMapError whenever I add a referrer
restriction, which seems to match the refering URL.
The referrer, where the map is being called form, is:
https://app.developr.online.local/projects?p=name-asc-0-20-1&a=createProject
Below is my GAPI KEY security configuration:
Below is the corresponding console output:
To be noted:
If I add a trailing asterisk when declaring the referer, validating that entry will clear it anyway. To me it means: "that's ok, we're covering trailing /* already.".
My question: what pattern should I enter as a referrer (2 r's) to have it recognised by GAPI security layer?
I've tried a few things, I didn't get a cigar.
Thank you.
how I can set-up trigger to fire only on Homepage? We´re using also UTM parameters so condition URL Path equals http://website.com is not working.
Thank you!
Create a JavaScript variable in Google Tag Manager to return the value of document.location.pathname
This variable will contain the value of the current URL path, without any URL parameters or fragments.
You can then set your homepage trigger to fire when the value of your JavaScript variable equals /
Pattern for a homepage usually would be ^/$. In human language it means “starts and immediately ends with /”.
As URL variable contains domain name and possible query parameters (that is what goes after ?), better to use Page Path (Make sure you have it enabled in your GTM Account, under Variables > Enabled Built-In Variables).
http://www.apasters.com/blog/regex-guide-google-analytics-tag-manager/
I need to incorporate my own parameters as part of url. (e.g. #student=DD&start=Date1&end=Date2). However, I am cerncerning about if I add my part to the url, will it mess up my google analytics tracking? Basically, now my url is something like -- MywebsiteUrl?userID=AAA#student=DD&start=Date1&end=Date2&utm_source=CC....
What url Google analytics will track? is my website url -- MywebsiteUrl, or ``MywebsiteUrl?userID=AAA#student=DD&start=Date1&end=Date2`?
Thanks in advance!
Google Analytics will treat query parameters as part of the URL. However it will not treat #student=DD&start=Date1&end=Date2 as having query paramaters. As far as (native) Javascript and the GA tracking code is concerned the URL ends after the fragment identifier (#).
So your complete example
MywebsiteUrl?userID=AAA#student=DD&start=Date1&end=Date2&utm_source=CC
you will get MywebsiteUrl?userID=AAA. If the userID parameter contains personally identifiable information you need to remove it to conform to Google's terms of service. You can use a filter or the exclude parameters-box in the view settings.
We have an instance of cross-domain tracking within Google Analytics with a single sign-on between sites. The sites are on GTM. The single sign-on generates a Google Analytics id such as (?_ga=1.18339449.1954186898.1485354375) which are appended to the end of page URL's.
Our preference is that the id's do not appear within page level reporting as GA treats each page as unique which in turn increases the chances of sampling. We've been unable to use the "Exclude URL Query Parameters" feature found within the view settings to remove the parameters from page level reporting.
I could not find blog or stack overflow posts specifically stating how to remove the id parameters from within Google Analytics reporting.
Is there a suggested alternative to prevent the id parameters from being appended to the sites page URL's?
If you aren't able to use the Exclude URL Query Parameters option to strip the parameter from the URL...that stinks. You might want to let Google know the feature isn't working as expected.
Another option is to use an Advanced filter with regex to strip the parameter from the Page. You can do this with the following settings:
Field A: Request URI
Pattern: ^(.+)\?_ga
Output To -> Constructor
Request URI
Pattern: $A1
This is a quick and dirty filter that will strip off all query parameters when _ga is the first parameter shown.
I want to be able to set the UTM variables manually
So instead of having a webpage
http://mysite.net/index.html?utm_source=source&utm_medium=inbound&utm_campaign=campname
I want to be able to set these with javascript. Looking through the documentation I couldn't find any set methods for these, only the set key methods.
https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingCampaigns
I have also tried
_gaq.push(['_trackPageview', '/index.html?utm_source=source&utm_medium=inbound&utm_campaign=campname']);
Although as far as I can tell this doesn't work. The only way I can now see of getting this to work will be to set these using a hash value:
ie:
http://mysite.net/index.html#utm_source=In+House&utm_medium=email&utm_campaign=Fall+email+offers
_gaq.push(['_setAllowAnchor', true]);
Is there a better way?
edit
Actually it seems there IS a way to do this using GA code!
previous answer
I've needed to do this in the past as well and I could not find any way to do it on-page. I believe the only way you can really do this is by reading GA's __utmz cookie and rewriting the cookie with the value(s) you want.
example:
This is what __utmz would normally look like on if you go to www.mysite.com with no url params (the numbers in the cookie will be different):
URL: http://www.mysite.com
__utmz cookie value: 97566023.1329384140.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
Here is what it would look like if you were to go to the URL with the values in the URL (the official way to do it):
URL: http://mysite.net/index.html?utm_source=In+House&utm_medium=email&utm_campaign=Fall+email+offers
__utmz cookie value: 97566023.1329384140.1.1.utmcsr=In House|utmccn=Fall email offers|utmcmd=email
And the cookie will have these values on subsequent page views, and you will see them sent to GA in the utmcc URL param in the request URL. So basically you can alter the __utmz cookie to the values you want. Would probably be more convenient to write a wrapper function to easily set it. Honestly, I don't know why GA doesn't provide a way to do this with a baked in wrapper function...