Tagged: x
-
AuthorPosts
-
July 22, 2016 at 4:43 am #1098394
Steve CParticipantI am having issues with the Google Analytics plugin bundled with X. When I use Google Tag Assistant to see if the code is running correctly it displays issues with the code ‘Missing analytics.js script’.
I have been advised that it may be best to try and hardcode the analytics into the site. Is this possible or would you be able to check what the issue is please?
My site is http://eyetooth-art.co.uk.
Let me know if you need anything else form me.Thanks,
SteveJuly 22, 2016 at 6:22 am #1098478
LelyModeratorHello Steve,
I can see that this is your code:
<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','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-71663374-1', 'auto'); ga('send', 'pageview'); </script>Please check this thread:http://stackoverflow.com/questions/28209156/google-analytics-missing-analytics-js-script
Hope this helps.
July 22, 2016 at 6:37 am #1098490
Steve CParticipantThanks for the reply, after seeing reading the link you provided I think this may have something to do with CloudFlare. I have contacted them and will wait to see what they say.
Do you think it would be worth adding the code into the themes core template file?July 22, 2016 at 8:34 am #1098591
DarshanaModeratorHi there,
Sure, you can check with CloudFlare first. Also you can try purging their cache.
Alternatively, you can setup a child theme (https://community.theme.co/kb/how-to-setup-child-themes/) and then add the anlytics code as follows into your child theme’s functions.php file.
add_action('wp_head', 'add_google_analytics_code'); function add_google_analytics_code() { echo "<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','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-71663374-1', 'auto'); ga('send', 'pageview'); </script>"; }Let us know how it goes.
Thanks! -
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1098394 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
