Support » Everything else WordPress » Can't get google analytics tracking code to work

  • onandoffthegringotrail

    (@onandoffthegringotrail)


    Hi

    I have inserted the google analytics tracking code in full into every page and post of my blog but Google Analytics gives ‘Status: Tracking not installed’ on the ‘Tracking Info’ tab. What’s happening?

    My site is onandoffthegringotrail.com and the code looks like this:

    <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’,’//www.google-analytics.com/analytics.js’,’ga’);

    ga(‘create’, ‘UA-40******-2’, ‘onandoffthegringotrail.com’);
    ga(‘send’, ‘pageview’);

    </script>

Viewing 2 replies - 1 through 2 (of 2 total)
  • This should be inserted into the footer.php file or the header.php file of the theme, that way you don’t have to insert it on every post and page. I suspect something may be getting garbled by the content editor, since the script is causing a javascript error.

    Alternately, you can use a plugin: http://wordpress.org/plugins/google-analytics-for-wordpress/

    I do honestly recommend a plugin vs. adding code directly to the site.

    It’s simpler and effective. The plugins do not add weight to your website, and you don’t need to remember to copy over any code if you change themes in the future. I actually use the one recommended by @graphicsgeek on all of my sites.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Can't get google analytics tracking code to work’ is closed to new replies.