How to check If Google Analytics tracking works

Because I often get questions about Google Analytics tracking code from people using my Advanced Google Analytics plugin (Joomla! users), I decided to post some tips and tricks that will get users started with the basics of tracking code debugging.

Using these tips you can check if Google Analytics tracking code is properly installed and actually works.

Users that had manually installed the tracking code (e.g. through a theme file) can also use these tips to debug their tracking code.

Things to do before checking the tracking code

Before checking the tracking code, you should pay attention to Google Analytics filters, to page cache and to your Google Analytics plugins. Here is a short list of things to check before debugging the tracking code:

Clear the cache

If you’re using a cache plugin make sure the cache is cleared/emptied before debugging the tracking code.

Google Analytics Filters

As far as I know Google Analytics filters are applied at processing stage (as a part of configuration), so they shouldn’t influence the real-time stats. Anyway, for testing purposes, make sure you’re not using Google Analytics Filters or any other features that could block tracking for your IP. If you use filters you should temporary disable them from your Google Analytics account.

Google Analytics Plugins

If you use one of the above plugins or any other third-party plugin, make sure they are properly configured and no errors are reported.

AdBlock Plus and Privacy Extensions

If you’re using AdBlock Plus or other similar privacy extensions in your browser, make sure you disable them during debugging.

Check if the tracking code is properly inserted in your webpages

Go to your Google Analytics account, look for your Tracking ID (UA-123456789-1) and copy it (select it, right-click and copy).

Open a new window in your browser using the Incognito/Private feature. To open an incognito window in Google Chrome use CTRL+SHIFT+N; to open a private window in Mozilla Firefox use CTRL+SHIFT+P. We are using a private/incognito window to make sure we avoid any plugin filters that may remove the tracking code for logged in users or administrators.

Navigate to your website in the newly opened window and press CTRL+U to view the source of the page. Now press CTRL+F (to search in page source) and paste the Tracking ID.

If you can find it at least once, the tracking code is active and inserted in your webpages. You can now close the page source tab / window.

If you find the Tracking ID more than once, you should try to identify all duplicate tracking codes and remove them.

In WordPress, a tracking code snippet can be inserted in a webpage through:

To quickly debug tracking code duplicates you should switch to a default theme and disable all other plugins. Switch back to your theme and check if the tracking code gets duplicated. If not, continue to enable your plugins, one by one, while checking for duplicates, until you find the source of tracking code duplication.

Use the Real-Time feature to check if Google Analytics tracking works

In the first window, in your Google Analytics account, select the corresponding view and go to Real-Time -> Overview. While browsing through your webpages in the second window (the incognito/private window) check the Right Now chart from Real-Time stats.

If you have one or more active users on site, the tracking code is correctly installed and works properly.

Further debugging for Google Analytics tracking code

If you followed the above steps and still have issues on properly configuring the tracking code, you can start looking for possible JavaScript errors.

To check for any related errors you can use the Inspector feature from Google Chrome or Mozilla Firefox. To start the Inspector and check for JavaScript errors, switch to your incognito/private window, press CTRL+SHIFT+I, select the Console tab and press F5 to refresh the page.