A Complete Guide On How to Add Google Analytics To WordPress – Best of 2023


Are you willing to know how to add Google Analytics to WordPress? It is very important to know how your audience interacts with your website. And the best way to know your audience is via your traffic stats. So to find out the traffic stats on your blog, you need the Google analytics tool, which is available for FREE. 

Google Analytics is one of most powerful tools you can add to your toolbox for tracking your website activity. It is the most widely used tools.

In this article, we will illustrate what is Google Analytics, why is it necessary and how you can add Google Analytics with or without using a plugin.

Read Also: How to Track User Engagement with Google Analytics in WordPress

Google Analytics and WordPress

Google analytics and WordPress works excellent when paired together. It is a free website tracking service that reports website traffic, conversions and user behaviour etc. It is one of the most popular and effective website tracking service available.

Important features of Google Analytics:

  • Show you traffic your website receives.
  • Where that traffic is coming from.
  • And how visitors interact with your site once they arrive.

Google Analytics data can be exported in various formats. You can also create your own custom Dashboard that simply provides and updates the data you wish to see.

Importance of Google Analytics for Bloggers

After you start blogging your goal is to get more traffic and subscribers to your blog. Google Analytics help you make data-driven decisions by displaying you the stats that matter. By using this tool, you can keep an eye on:

1. Who are the visitors to your website?

This part of analytics answers the following questions:

  • What is the geographical location of your audience?
  • Which browser did the user use to visit your site?
  • And much other important information such as screen resolution, JavaScript support, Flash support, language and more.

When getting a custom design, this data is very useful to make sure that your site will be compatible with your audience.

2. When do people visit your website?

This data helps you to identify the hottest hour of your website. This is the best time when you should publish your post. Where, the articles posted by the admin of a WordPress site are called posts.

3. What people do when they are on your website?

It provides you with the following information:

  • Where is the user going to your website?
  • How long do they stay on your website?
  • And what is the bounce rate (the percent of users exit your site on the first visit)?

You can use this data to decrease the bounce rate and increase your page views. Here, pages are like posts. Pages can be managed in a hierarchical structure in WordPress.

4. How do people interact with your website content?

Google Analytics displays you what percent of the user clicked on which link on your site etc. You can also run A/B split tests to understand what works best for meeting your goals.

5. How do people find your website?

This section of the analytics displays you following results:

  • The source from where the user comes from. Sources:  Direct Links, Search Engines, Referral links from another site.
  • What percentage of your visitors came from each of these sources.
  • And which search engine got you the most traffic, Google, Bing, Yahoo, etc.

Here, the search engine is a service which allows all internet user to search for any content, query, and product throughout the world wide web. The data received from the above analysis will assist to breakdown referral sources and identify the sites you require to work with the most.

For example: If your top referral source is Facebook, then you need to have exclusive Facebook content to make your Twitter audience feel special.

Similarly, you should consider having a partnership with the website. If your top referral source is an external website.

Also Read: 10 Free Tools for Checking Vulnerabilities in WordPress Website

How to create a Google Analytics account?

Some of the Steps to be followed:

Step 1: Firstly visit Google Analytics signup page and then after enter your existing Google account information or create a new account.

google analytics signup page

Step 2. After you have signed-in with your Gmail account you will be prompted to a screen like shown below. And here you will signup for Google analytics with your Gmail account.

google analytics setup

Step 3. Select the website option from the two options given.

Step 4. Enter the following information on the next page:

  • Enter the account name and it will be the Google Analytics profile name for this website.
  • Website name
  • Website’s URL
  • Country
  • And the time zone
enter google analytics info

Step 5. Click on get tracking ID.

Step 6. Now you will see the Google Analytics tracking code. Copy this tracking code as it will be required later in your WordPress site.

tracking code

How to easily Add Google Analytics to WordPress?

So let’s have a look at the two methods:-

Method 1: Adding Google Analytics to WordPress with the use of Plugin

There are various ways to add Google Analytics to WordPress. Here we will describe you two methods to add Google Analytics to WordPress.

Select one that best suits your requirements.

1. Using Google Analytics WordPress Plugin(MonsterInsights)

MonsterInsights is the most popular Google Analytics WordPress plugin. It is the simplest and best way to add Google Analytics to WordPress. This plugin can be used by both beginners and experts.

This plugin has both a free version and the Pro version. If you want more advanced features like Ecommerce tracking, Ads tracking, Author tracking, etc then the pro version is useful. Otherwise, the free version will do your work and the process of setting them up is the same.

Steps to be followed:

Note: Once the plugin is activated, it will add a new menu item labelled Insights to your WordPress admin menu.

  • Visit Insights > Settings for configuring the plugin settings.
  • On this screen, click on Authenticate with your Google account button to connect Google Analytics to your WordPress site.
add google analytics to WordPress (MonsterInsights)
  • This will bring up a popup where a click on ‘Next’ to continue.
analytics authenticator
  • Now click on Click to get Google code button.

Another popup will show on your screen with the message:- “MonsterInsights would like access to your Google Analytics data”

  • After that Click on the Allow button to continue.
analytics account page
  • Just Copy the line of code in the pop-up screen.
  • Enter this code in the MonsterInsights popup and then tap on Next to continue.
enter tracking code
  • Choose the profile you want to track. You need to select your website here and then click on the next button to continue.

You have successfully installed and setup Google Analytics on your WordPress site.

  • Visit Insights > Reports page to check out a quick overview of your analytics data.
tracking reports

2. Add Google Analytics to WordPress Using Headers and Footers Plugin

This method is not as good as the above-mentioned method because you will not be able to do advanced tracking configuration, and you will not be able to view Google Analytics data in your WordPress dashboard.


  • Install and activate the Insert Headers and Footers plugin. 
  • Upon activation, visit Settings > Insert Headers and Footers page.
  • Here paste the Google Analytics code that you copied.
add google analytics to wordpress(header and footer plugin)
  • Click on the save changes button to store your settings.

Method 2: Adding Google Analytics in WordPress Without a Plugin

Before starting it just make sure to backup your WordPress theme. Where theme is a group of stylesheets and templates that are used to describe the appearance and display of a WordPress site. A WordPress theme changes the layout & design of your site.

Also, Templates are those files which control how your WordPress site will be displayed on the Web. These files draw information from your WordPress MySQL database and generate the HTML code which is then sent to the web browser.

As, MySQL, as an open source database management system to store and retrieve all of the website’s information, everywhere from the content of the posts and pages to the comments, usernames, and passwords of your website.

However, if something goes wrong, you can simply revert it back. So let’s get started:-

Step 1: Getting Your Google Analytics Tracking Code

First of all, log in to your Google Analytics account and select the website for which you require the tracking code. Tap on Admin in the left taskbar. Click Tracking Info in the property column, and then the Tracking Code.

Now you can get the tracking code under the Website tracking section. Just copy it.

Step 2: Adding the Tracking Code to the header.php file

For adding the Tracking Code to the header.php file Log in to your WordPress dashboard and then after navigating to Appearance » EditorNow tap the header.php file on the right-hand side just below the Templates section. Paste the tracking code you just copied from your Analytics profile after the <body> tag. And then click Update File.

Viewing Reports on Google Analytics Website

It is capable of showing you the data collected from your stats. To view, visit your Google Analytics dashboard and click on the reporting tab.

google analytics report overview

In the above image built-in, Google Analytics reports can be seen in the left column. The built-in report includes four tabs namely:

  • Audience tab: show reports guiding you to understand your users.
  • Acquisition tab: explore where your users came from.
  • Behaviour tab: summarize what your users do after they arrive on your website.
  • Conversion tab: display how well you’re doing against your goals.

Final Thoughts

Now, that’s a wrap for this post and we have described you to add it with our without the help of a plugin. You can select any of the above-mentioned methods to add Google Analytics to WordPress. So, select the method that suits your website the most.

We hope the above article will help you to add Google Analytics to WordPress.

If you still need help contact  our WordPress Technical Support Team. Please Dial +1-888-738-0846 (Toll-Free). We  have a team of good professional who can resolve all your issues related to WordPress.

Leave a Reply