Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Analytics Missing analytics.js script

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? enter image description here

like image 636
Jed Avatar asked Jun 12 '26 05:06

Jed


2 Answers

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 :)

like image 145
Parth Patel Avatar answered Jun 14 '26 20:06

Parth Patel


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).

like image 33
Eike Pierstorff Avatar answered Jun 14 '26 21:06

Eike Pierstorff



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!