digital marketing | MTLB

Google Analytics for WordPress

Google Analytics is the gold standard for web analytics tools. This Google product is extremely useful for WordPress websites. When you add Google Analytics to WordPress, you get invaluable insights about the audience interaction with your website. This information helps you understand your audience better, know what works on your site and what doesn’t, and make well-informed business decisions. However, many WordPress users often struggle to add Google Analytics to WordPress. They fail to find answers to questions such as ‘Where to put Google Analytics code in WordPress?’ and ‘How to setup Google Analytics on WordPress?’ among many others. In this article, we will try to answer all such pertinent questions and enable you to use Google Analytics with your WordPress site.

Benefits of using Google Analytics

Before we tell you how to setup Google Analytics on WordPress, let us have a brief overview of the benefits and applications of Google Analytics.

Google Analytics covers a whole range of vital information such as:

Location: Google Analytics helps you identify the geographical location of your visitors.

Content: You can also identify the blogs and pages of your site that are most popular with your visitors.

Session duration: With Google Analytics, you can find out the amount of time your visitors spends on your website and on a particular page.

Social overview: If you are running a social marketing campaign or have shared new posts from your WordPress site on platforms like Facebook and Twitter, Google Analytics helps you identify the number of visitors that you have acquired from these sites.

Benchmarking: Google Analytics compares the numbers generated by your website (number of direct visitors, bounce rate, pages viewed per session, paid search campaigns, etc) against the industry average to give you an idea of how you fare against your peers.

These are just a few of the many metrics that Google Analytics tracks in real-time. Besides, this Google product is based on a ‘freemium’ model; so even smaller businesses and websites can enjoy its benefits without paying a single dime. There is virtually no reason to not add Google Analytics to WordPress.

How to setup Google Analytics on WordPress?

There are a number of ways by which you could use Google Analytics with your WordPress site but plugins are one of the easiest and most widely used tools to add Google Analytics to WordPress. The following 4 steps are all that you need to take for the purpose.

Step 1: Create your Google Analytics account

To take advantage of this Google product, you’ll first need to create a Google Analytics account. Visit for the same and enter a few basic details (whether you need to track a website or a mobile app, your account name, etc.). Once you are done with this, you will need to accept the terms and conditions; after which, you will obtain the all-important ‘UA tracking ID’.

Step 2: Use a WordPress plugin

Visit the WordPress dashboard and click on ‘Plugins’. In the next screen, click on the ‘Add new’ button that you will find at the top. When the plugin screen loads, you will find the search bar on the right. Enter ‘Google Analytics’ in the search bar and press Enter. You will then see a long list of plugins in front of you to choose from. ‘MonsterInsights’ is the most popular of all plugins as it is the most actively maintained plugin among its ilk. More than 2 million WordPress sites (including Microsoft, Bloomberg, Subway, and PlayStation) currently use this plugin. Other dependable options include ‘Google Analytics Dashboard for WP’ (with more than a million active installations and a solid 4.5/5 star rating) and ‘Google Analytics Counter Tracker’.

Install and activate the one that you find most relevant to your requirements.

Step 3: Configure the plugin

Once the plugin has been installed and activated, you will need to configure it to so that it can communicate with your Google Analytics account. This step is completed through 5 different sub-steps.

  • Visit the ‘Plugins’ page and click the ‘Settings’ link
  • Click on the ‘Authenticate with your Google account’ button on the main page of the plugins settings
  • Click ‘allow’ on the pop-up window that will ask for your permission to connect with your Google account
  • Copy the code that you will see on the next screen and paste it into the highlighted box in the WordPress tab. Click on ‘Save authentication code’
  • Finally, the settings screen would refresh and include a drop-down; where you shall choose the Google Analytics property that you created in step 1. The tracking ID and the UA code created in the first step must match. Verify if they do and click on ‘save changes’.

You have now successfully added Google Analytics to your WordPress site!

Step 4: Test Google Analytics

This step isn’t a part of the setup process but we strongly recommend that you take it so as to ensure that you have installed and set up Google Analytics properly. The easiest way of doing that, particularly for a brand new website, is found through real-time analytics.

On the Google Analytics admin screen, click on ‘Reporting’ right at the top. This will take you to the section with tracking data. You will find ‘Real-time’ on the left menu of that section; clicking on which will expand the sub-menu. Click on ‘Overview’ on this sub-menu.

Thereafter, visit your website through a different browser and browse through a couple of pages. If you have managed to add Google Analytics to WordPress properly, your visit would be registered and real-time analytics would show exactly one visitor on your website (you won’t expect visitors on a brand new website, would you?).

If you don’t see a visitor on your website, try opening your site in another browser or click ‘Re-authenticate with your Google account’ in the plugin settings.

Alternative methods for adding Google Analytics to WordPress

If you wish, you can also add Google Analytics to WordPress without a plugin. The following steps should help you do just that:

  • Login into your Google Analytics account and choose the website you need the tracking code for
  • In the left taskbar, click ‘Admin’, ‘Tracking Info’, and ‘Tracking Code’; in that order.
  • Copy the tracking code that you find under the ‘Website Tracking’ section
  • Now log into your WordPress dashboard. Navigate to ‘Appearance>>Editor’. Click on the header.php file below the ‘Templates’ section.
  • Paste that tracking code that you have just copied before the closing </head> tag
  • Click on ‘Update File’. You have now managed to add Google Analytics to WordPress without a plugin.

With this method, though, you need to be extremely familiar with codes to execute it properly. We would advise you to seek an expert’s assistance if you want to take this route.

Final word

As you must have observed by now, the entire setup process is quite simple and cost-free. Now that you know how to install Google Analytics on WordPress, you can start tracking your visitors with immediate effect and enjoy all the benefits that it brings to you.

Add Google Analytics to WordPress site for the best interests of your business.

Share this: