How To Add Google Analytics To WordPress

Share on facebook
Share on google
Share on twitter
Share on linkedin

Whether you own a business website or not, your success depends on the audience interaction with your website and this can be known from the traffic stats of your website. Google Analytics is such a program that provides you with this facility for free!

Google Analytics feeds you with information like who your audience are, where they come from, what were they looking for, when they entered, which is their favorite or the least favorite post when the traffic is highest or lowest and so on. The best thing is that this incredible tool is completely free and it’s very easy to use. You don’t need to mess up with your program as you can just set it in a program using a plugin. It is easier to configure in WordPress site than a hand-coded website.

In this article, you will be given guidance about how to add Google Analytics to WordPress site of yours and how to make sure it’s working properly.

Benefits of using Google Analytics

google analytics

To know how to install Google Analytics, we should first know about the benefits in details. This is important too because it gives you the idea about how a wide range of work Analytics does and in which cases you get the information and to what level.

You can set up goals in Analytics like file downloads, product sales, newsletter signups etc. and then compare your goals with website’s performance. This would give a wealth of information about your website and you can work on the optimization of your website with the help of the information provided. Besides, it gives you extensive data about:

Who visits your website:

This data is very useful for running websites. It feeds with information like the geographical location of your visitors, the language of your visitors, the browser that the visitors use, whether the visitor had flash support or JavaScript support or not.

You can customize your website and its content relying on the data given by this. For example, you can avoid uploading videos that need flash support if you see the most audience of yours don’t have flash support or maintain your website’s content resolution according to the resolution of your visitors and so on.

What do people do when they visit your website:

If you add Google Analytics to your website, you can find out where are the visitors going on your website, for how long they visit your website. Besides you can also find out which article/post of yours is getting maximum views and which post is not doing that good. You can find out the compatible content for your audiences in this way.

Most importantly you can find out the bounce rate (percent of visitors that exits your website on the first visit) and deal with it accordingly. You can optimize your views on your website and reduce the bounce rate by figuring the right content for your audience.

When do people visit your website:

There’s always a suitable hour for everyone when they access the net and browse for stuff. It is very important to analyze this suitable time for your visitors. Because your content will get maximum views if you can post your contents in that suitable time.

When do your users visit

You can get the information by using this tool we are discussing today. If you can’t post within that hour because of different time zone, you can always set up schedule posting on your website. Whatever you do, you need the information first and which you can get from Google Analytics.

How people find your website:

This section of Google Analytics gives you information about how the visitors are coming to your website. From search engines or direct link or referral link. It breaks down the information for the ease of the end users like you who can use the information to make the website more engaging.

If someone enters through search engines, the tool breaks down the information and shows what percent of visitors came from search engines and from which search engines they had come. This would give you valuable information about which search engine has got the highest traffic for your website.

Besides, it also breaks down information about the referral links i.e. from which page/ website they had been directed. Using this information, you can create an affiliation with that website or make a partnership so that both of the websites are benefitted.

You can make special contents for the visitors who visit your websites from another place. Suppose most referred visitors come from Facebook to your website; you can create separate content for Facebook users or design an extensive plan so that other Facebook users who haven’t visited the website can get to know about your website by online marketing or through other means. This makes your old visitors more integrated to your website at the same time create a chance to have a potential group of visitors from a very specific place (in this example, Facebook).

How do people interact with your content:

This marvelous tool allows you to see the interaction level of visitors on your website by breaking down information such as how many clicks were issued on your website and much more. It also figures which content had got how many clicks.

By using this user interactivity, you can work with your contents. You can act on your strategies that would work for your website. To put simply, you can avoid making the blind guess about making any decision about your content and website. Rather you can reply on concrete proof of data in front of you provided by Google Analytics.

This feature is bolstered by another marvelous feature which allows you to carry out an experiment about your content. You can run A/B split test for an experiment. This sort of technology allows you to compare two versions of the same webpage amongst one another so that you can choose the page that gives you the best performance and result.

So at the same time, you can conduct an experiment with zero risks and carry out the best outcome of that experiment with the help of the same tool.

How to Add Google Analytics to WordPress?

Go through the article and we promise, you will get to know about how to add Google Analytics to WordPress websites. You might think it’s hard to do, but in reality, it’s not. First, you need to have a Google Analytics account. We will discuss this process first then we will jump to the processes of adding this marvelous tool to your WordPress.


Create a Google Analytics account:

Creating a Google Analytics account is totally free; all you will need is a Gmail account. If you don’t possess one already create one which is totally free too. Then you can follow the process below to open an Analytics account:

STEP 1: First you need to go to the homepage of Google Analytics then you will see a screen like this below. Enter with your Google or Gmail account by clicking the “Sign Up”.

analytics signup

STEP 2: On the next screen you will find an account set up the screen. There you will have to choose between a website and a mobile app. Make sure you chose a website.

After that, you need to fill up the box of your account name. It will be the profile name for your Google Analytics account. Then you need to fill up the box by giving the information like Website name, website’s URL, industry category, country and the time zone you are in. You can select multiple website name and URL to keep track of more than one website from one account. It is preferable for many contexts.

Once you are done filling up this information, click “Get Tracking ID”. After you accept the Google Terms and Conditions provided, you will get a tracking ID starting with letters “UA”.

get tracking id

STEP 3: As we mentioned earlier in step 2, you will see a webpage like this where you will get the tracking ID and tracking code. Keep a copy since you will need to use it to install google analytics in WordPress site depending on the method. But don’t worry we will certainly guide you regarding where to put the Google Analytics code. It will be easier if you keep your analytics browser tab open as you will need to revisit the site many times once you have set it up.

tracking code

Now that we have set up a Google Analytics account let’s take a look now how to install it in a WordPress site.

Methods of adding Google Analytics to WordPress:

Today we will show you 3 methods to add Google Analytics to WordPress. You can choose your method according to your wish and once you are done you will get to know more about your own website! Let us check those methods out.

Install Google Analytics using Monstersights Plugin:

Since you have got a tracking ID after opening an account, you will now need to install the plugin which will automatically add the tracking code for you. We will recommend using Google Analytics for WordPress by MonsterInsights as it is the best Google Analytics WordPress plugin according to our opinion. You can maintain your site/s most actively using this method.

To add it in your site, find the “Plugins”, then “Add New button” and find the plugin named “Google Analytics Dashboard Plugin for WordPress by MonsterInsights”. Once you have got the plugin, click on the “Install Now” button. It will take place automatically then. After installing, click on the “Activate Plugin” to turn it on.

add monsterinsights

Configure The Plugin: Now that the Google Analytics plugin is installed and activated, you need to configure it to communicate with your Google Analytics account. To do that, click on ‘Settings’ on the Plugin page or else you can go to the menu bar on your left and find “Insights, then Settings”.

From there i.e. on the main page of the plugin settings, click on the button saying “Connect Monsterinsights”.

connect monsterinsights

Clicking that would open a pop up where you would be asked to choose your Google account. After choosing the account, monsterinsights will ask your permission for the connection. Click “Allow” to continue.

allow connection

After that, the settings will refresh and a new page would come up. Select the Google Analytics property you just created and the tracking ID must match with your UA code that you had created in the first step. Then hit the button “Complete Connection”.

complete connection

That’s it. Google Analytics has been set up in your WordPress site successfully. Let’s see how you can test it to make sure it’s working correctly.

Testing: There are many ways to test whether Google Analytics is working properly on your WordPress site. But the best and easiest way is “Real Time Analytics”. To test Google Analytics in this way, go to the admin screen of Google Analytics. There, click on the “Reporting” button at the top of the screen to see the Google Analytics with tracking data. In the left side, you will find a “Real-Time” option. Click it to expand the submenu, then click “Overview”.

If you have configured the Analytics for a brand-new website, you will most likely have 0 current visitors. So, you can’t check whether it is working correctly or not.

By default, Google Analytics by MonsterInsights does not keep track of the visits from the logged-in administrator or editor. Because if you keep track of your own visits, it will create some discrepancies in your analysis of the data you want. So, we recommend that you keep the settings as it is. Again, it would mean that if you visit your own website from the same browser, again and again, it won’t be counted.

For testing purpose, visit your website through another browser, give some clicks on any page or two. This would register your visit in the Google Analytics. If everything is working properly, Real-Time Analytics should show one visitor on your website.

If you still don’t see any visitor count, try again by opening the website in another browser or go to the plugin settings to “Re-authenticate with your Google Account” and try again.

Install Google Analytics Using “Insert Headers and Footers” Plugin:

This method is not as preferable as MonsterInsights method. Especially not for beginners. But it is a method no matter what so we will discuss about it briefly today.

You cannot do advanced tracking configuration in this method as you cannot see Google Analytics data in your WordPress dashboard.

To work through this method first, you need to install and activate the “Insert Headers and Footers” plugin. After activation, you need to go to settings. There you will see an option saying “Insert Headers and Footers”. Next, go to the headers section and paste the Website Tracking code. You will get this code from the same page where you had got the tracking ID in step 3 of “create a Google Analytics account”.

insert headers and footers

Click the save changes button to ensure this setting and that’s how you can install Google Analytics by this method.

Install Google Analytics in WordPress theme:

This method is for advanced users who have enough idea about the code. Often this method is known as “Manual method” as it is done within the code of the website. However, this method is quite unreliable as your code will disappear if you switch or update the theme. We usually do not recommend this method.

There are some ways for this method, but today we are going to show you one process for doing it.

Add code in the header.php file: You just need to edit the header.php file in your WordPress theme and paste the Website Tracking ID right after the <body> tag. To do that you need to go to your WordPress admin dashboard. Next, go to the “Appearance” option and you will see a section written, “Theme editor” Then search for “header.php” on the right side of your screen and click on it. There you will see a bunch of codes written. In that code, you need to paste the Website Tracking code after the <body>  tag. After doing that click on “Update File”. That’s how you can add the code in header.php.

theme editor

Viewing Reports on Google Analytics Website

Google Analytics can provide you with hordes of data collected from your stats. You can see all data by visiting your Google Analytics dashboard.

analytics dashboard

In the left column of the dashboard, you will find built-in google analytics reports. There are several sections and each section are divided into different tabs and clicking on them will expand the tabs to show more options. Some sections are as:

Real Time: This report will feed you with information like a real-time view of your website.

Audience: This tab will help you with information about understanding your users.

Acquisition: This report expresses the report about where your users are being generated from.

Behavior: This report summarizes what your users do after entering your website.

Conversion: This report shows you how you are doing against your targeted goals.

Making the Most out of Google Analytics

Congratulations! If you have gone through this complete article, you have already learned about how to open a Google Analytics account and how to make it work for your website. You can now capture valuable data about your users and make them work in favor of you.

Generally, Google Analytics works best in Google Search Console formerly known as Google Webmaster Tools. It allows you to see how your website is doing on the internet in case of search results. But that doesn’t necessarily mean that other console won’t give equal output. The methods we have discussed today would work just fine in any console you use and it would suffice your cause.

Besides, there are a number of popular Google Analytics plugins which work similarly. But make sure you do not use/install more than one Google Analytics plugin. If you do this, you could be tracking every visitor twice in your Analytics account. This would artificially inflate your visitors’ number and create a confusing situation. This would derail you from getting the actual image of your WordPress site.


Google analytics is an extremely invaluable tool with tons of incredible features. Some of them are very easy to use; others require some additional setup to use.

This tool is most useful to bloggers who wish to understand their audience and grow their traffic. So, it is ideal to set it up and use as early as possible. In fact, it should be one of the very first things that a blogger should impose to open a new blog. However, it is equally important for others who want to maintain their websites.

We hope this article about how to add Google Analytics to WordPress was of great help to you. We strongly recommend from our part that you should start using this excellent feature of Google right away!

This post contains affiliate links. It means if you click one of the product links and then purchase the product, we’ll receive a small percentage from the sellers’ end. No need to worry! You’ll still pay the standard amount. So, there’s no extra charge from your part.

Loved this article?
Are you in dire need of the best wordpress developing tutorials & digital marketing guide? Did you say you need the best hosting, theme & plugin reviews too? Well, look no more. Subscribe with us right now and never miss our exclusive weekly newsletters, guides and tutorials!
Share To 
Share on facebook
Share on twitter
Share on linkedin
Share on google
Share on pinterest
Yousuf Hossain

Yousuf Hossain

Yousuf Hossain is a young passionate full-time freelancer who loves his work as his life. He has a dream that one day people will not only know him by this profile but also by his name for his passion and dedication toward work.

Leave a Comment

Your email address will not be published.

Sign up for our Newsletter

*You can unsubscribe at anytime!

Pin It on Pinterest

Share This
Scroll to Top