Check your website against incorrect Google Analytics implementations

Incorrect implementation of Google Analytics can result in erroneous statistics giving a wrong perspective on the status of your website and of the actions to take to improve it.
The most common error must be the duplicate inclusion of Google Analytics. It can happen quite easily in WordPress when both the theme and a plugin ask for your Google Analytics tracking code.

If you are in hurry and have no time to read the details, you can quickly test your website for Analytics mistakes with the tool I made:

A duplicate inclusion mean that the code provided for Google Analytics like below appears 2 times in a single page:

<script>// <![CDATA[
            (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-XXXXX-X', 'auto');
            ga('send', 'pageview');

        
// ]]></script>

As a result, the function to report a page view is called twice.

ga('send', 'pageview');

This has 2 consequences:

  1. Double the number of pages viewed
  2. Drop the bounce rate

The bounce rate is the percentage of people viewing a single page before exiting the website. A high bounce rate may indicate that the user is not seeing any interesting or relevant link and decides to leave.

If your bounce rate is below 5%, you should check your site against a double inclusion of Google Analytics

When revamping a WordPress site for a customer, I noticed that the Google Analytics was included twice on the old website. I took note of it and added to my ToDo list to remove the duplicate code. I did realize consequences of this until I deployed the revamped site and that the miraculous 1~3% Bounce Rate of the site jumped to about 70% and that the Pageviews got divided by 2.

google-analytics-low-bounce-rate

Bounce rate jumping from 1~3% to ~70%

What happened became pretty clear: Including the Google Analytics code twice makes Google count each Pageview twice, thus dropping the Bounce Rate.

google-analytics-pageview-drop

Pageview divided by 2

It is not clear why the Bounce Rate was not 0%. Probably due to some loading errors or users exiting before both Google Analytics codes could run.

As a result, I developed a small tool to help people with limited technical knowledge to check their websites against various mistakes that can be made implemented Google Analytics.

Test your website now and for free:

14 Comments

  1. Kimm Boes October 1, 2014 9:33 am  Reply

    How do I know which GA code to remove?
    Thank you.

  2. Martin DENIZET October 1, 2014 1:44 pm  Reply

    Hello Kimm,
    According the GA instructions (Admin tab, Tracking Info, Tracking Code), the code can be included immediately after the opening of the body tag.
    If you cannot do that, you may check if there is an implementation within the head . You may want to remove it as the current trend is to get pages loading time to a minimum.
    Cheers,

  3. JanetGoingCrazy January 6, 2015 11:16 pm  Reply

    I am working on correcting this for a few clients and have noticed that if the blog started out on Blogger.com and then migrated over to WordPress. I cannot find the code twice on the WP blog because it is actually on the Blogger blog, but that redirects to the WP blog. Is there any way to make this stop double reporting?

  4. Jessica February 23, 2015 4:42 am  Reply

    Hi there,

    thank you so much for making this tool! My bounce rate fluctuates between 6-18% which seems really low to me. I checked my whole site for two codes and I can only find one. I even used this analytics checker and everything passed- it said everything was normal. I just feel like that bounce rate is not accurate. If you know anything else I should check for, I would love your input. Thank you!

    • Martin DENIZET February 23, 2015 6:06 am  Reply

      Hello Jessica,

      I found that there is an implementation of GA in the “SnapWidget” iframe but it does not run in the context of your website so that should not be the explanation. I used also a Chrome extension to debug GA and the only 2 calls I saw were from the normal implementation and SnapWidget.

      So to sum up: I don’t know.

      Note that GA events tracking will count as an interaction unless a specific argument is added. However I didn’t see a GA events implementation on your site…

      I’d suggest you to check the “behaviors” in GA reports to understand where people go if there are not bouncing. It’s probable that you could see them reloading the same page which could the result of a faulty link/image (though I didn’t see evidence of that 🙁 ).

      Cheers,

    • Rob Carson April 2, 2016 9:10 am  Reply

      Check and see if the Yoast SEO plug-in is the culprit. I added the code where the theme provided. But then after a Yoast SEO upgrade, it asked me for the code. I thought entering the code there just allowed the plug-in to provide the analytics information inside the WordPress site but now I know differently. I didn\’t discover this until a Google Analytics support rep informed me that the code was there twice.

  5. shaneonabike May 16, 2015 1:42 am  Reply

    Hey!

    Thanks for pointing that out! I tried your tool but was unclear what the Accounts and PageViews was referring too… I got a warning on them and just wanted to make sure that I could repair them 😉

  6. Kylie December 3, 2015 8:20 am  Reply

    How do I fix the fact that it\’s giving me a warning for pageviews and account, but I\’ve just set up Yoast Google Analytics on my site? Is this because I\’m using Yoast, or totally unrelated?

    Thanks, and thank you for your awesome tool!

  7. hello December 23, 2015 3:56 am  Reply

    Hi there,

    Our website has been having a very low bounce rate since was redesigned and trying to get to the bottom of it.

    According to your checker it is loading twice. How do I work out the problem? I can see in the source code that it has the script twice, though each with a different UA number – if the number is different would it still cause the double tracking?

    Any insights would be appreciated!

    • Martin DENIZET December 23, 2015 4:32 am  Reply

      Hello,
      You indeed have GA implemented twice (2 tracking codes, linked to 2 different accounts). It might be the reason for an abnormally low bounce rate.
      It is possible to implement GA twice without issue but I’m not familiar with the good practices of doing so.
      You should find the information you need to check your implementation there: https://support.google.com/analytics/answer/1032400?hl=en

      Cheers,

  8. Elly February 2, 2016 12:33 pm  Reply

    Hey there! I am having some problems! I have asked my developer, and she said that I do not have the code on twice, but I want to make sure! I only have one plugin installed for wordpress, and I don\’t believe I have it coded in the theme ( I really don\’t know how to check?)

Leave a Reply