I'm stucked on copying google analytics tracking code issue. It looks like Google Tag Assistant doesn't consider the code I copied from the generated GA tracking JS for the site.
The site is in http://www.orchid.co.nz/
I added the codes on the header. This should work correctly like what I'm doing with the other sites I worked with. However, this one is weird. I can't figure what's wrong.
Anything I missed?
This error is caused by Cloudflare as it implements rocketscript to speed up the web load speed. Disabling the cloudflare will fix this but you don't need to do that. There is simple code to make cloudflare ignore that particular javascript code.
Simply Change
<script type="text/javascript">
to
<script type="text/javascript" data-cfasync="false">
This is most efficent way..
Thanks :)
Not sure if this will fix the issue, but you are telling the browsers to parse the script as "rocketscript":
<script type="text/rocketscript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
....
I don't know what rocketscript is and I guess neither does the Tag Assistant. Try to change this to "javascript" or not to use a type attribute at all.
Here is a discussion about rocketscript, apparently this is part of some Cloud technology and requires a special plugin in Wordpress.
I see tracking calls in the network tab of the browser, so it looks like the problem might very well be purely cosmetic (altough chromes GA debugger extension does not pick up the calls, either).
it might be late but the solution for this is :
adding the option data-cfasync="false" in your analytics.js.
this has to do with cloudflare
Seee reference here
http://www.aodba.com/fix-redundant-hostname-warning-google-analytics/
The quick solution.
If nothing works with the code:
Turn off the feture.
Menü:
Speed ->Rocket Loader™ BETA -> Off
Related
I’d like to track certain Webflow events in Google Universal Analytics (using analytics.js) without the use of Google Tag Manager. The specific scenarios we are trying to track are:
PDF downloads
YouTube Video views from lightboxes, sliders and straight embeds
I added the JavaScript tracking snippet to the site-wide Head Code of my site, replacing the UA# with the real one.
<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXX-Y', 'auto');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->
Do I just proceed with setting up Event Tracking on a per element basis or do I need to create a tracker?
If you create new trackers they might overwrite configuration options for the first tracker (if any), so that is not only unnecessary but potentially harmful (unless you want to track to different properties, in which case you'd use named trackers that do not interfere with each other).
For your use case you need only the default tracker and then you send an event for the elements the user interacts with.
You might also consider using gtag.js over analytics.js, since Google now gives gtag.js as the default code; documentation is much worse than for analytics.js and there are some doubts that it is feature complete, but Google is unlikely to roll back so I'd say gtag.js is more futureproof.
Gtag.js has some of the advantages of GTM (consistency between tags via the datalayer) without its main disadvantage (arbitrary code injection - GTM has been describes as "XSS as a service"), so it might make sense to go that route now.
I have tried to make cross domain tracking work between my website and FastSpring for a month but can't find the problem. I tried lots of variations of the code an nothing seems to work.I also contacted FastSpring support but their answers didn't fix the problem
I suspect it may be a problem of my site using GaTracker while FastSpring uses GA but I really don't know. I checked with Google tag assistant and cross domain tracking sometimes work but not always, it's strange.
I'm trying to get it to work from this page:
https://frenchtogether.com/course/
window.ga = __gaTracker; __gaTracker('create', 'UA-43334717-1', 'auto', {'allowLinker':true});
__gaTracker('set', 'forceSSL', true);
__gaTracker('linker:autoLink', ['fastspring.com'] );
__gaTracker('set', 'anonymizeIp', true);
__gaTracker('require', 'displayfeatures');
__gaTracker('require', 'linkid', 'linkid.js');
__gaTracker('send','pageview');
Any idea what's wrong? Thanks
I'm using the Universal Analytics instead of Classic.
The snippet is
(function(i,s,o,g,r,a,m
){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-xxxxxxx-x', 'xxxx.com');
ga('send', 'pageview');
But the help pages I visited all referred to another kind of snippet. For example, this help page:
https://support.google.com/analytics/answer/2558867?hl=en&utm_id=ad
As a result, I don't know how to make changes to the above snippet to achieve what I want.
Is the difference in snippet code the result of using Universal vs Classic?
Enhanced Link attribution is not yet supported in UA (as are GDN integration/Demographics or Remarketings Lists via GA, even though the interface is already there). No clear timeline, but support is to come "soon".
Since Google plans a forced upgrade to UA for all accounts "soon" will hopefully be, ehm, sooner than later.
I want to use google analytics in my website, but I don't understand where I have to put the tracking code. I built my web page using Yii and php, and I am also using templates. I read the google page about the tracking code, and it says:
If your website uses templates to generate pages, enter it just before
the closing tag in the file that contains the the section.
I tried to put the tracking code before </head>, but it didn't work. Please, someone could help me? I don't understand what google means.
Thanks.
You should be placing it within your views, preferably before the </head> tag. When you say it didn't work, what is it doing? Did it throw an error - if so, what?
My event tracking isnt working on my Google analytic's. Below is the code that it gave me to insert into the webpage and below that is the snippet it told me to put. I am wanting to track the number of clicks onto a 'mailto' link from the website and I believe this is the best way to do it?
Can anyone tell me where its going wrong?
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-37080107-2', 'promat-durasteel.com');
ga('send', 'pageview');
This is the snippet: (it wont let me put the opening tag on this forum for some reason, but it is there in the coding!
href="mailto:info#sharpfibre.com" onclick="_gaq.push(['_trackPageview, '/Direct-Email-Enquiry-Link-Clicked’]);">info#sharpfibre.com
Please help!
Thanks
As far as I can tell you are mixing two brands of Google Analytics - the new "Universal Analytics" and the , ehm, traditional asynchronous tracking code. Pushing values to the _gaq-Array will not help you since Universal Analytics does not use _gaq (and even if it would you are tracking a (virtual) pageview, not an event).
You'll have to use ga('send') on the click event. Documentation for event tracking with the new GA code is here: https://developers.google.com/analytics/devguides/collection/analyticsjs/events