How to Add Google Analytics in WordPress

      Comments Off on How to Add Google Analytics in WordPress

In this post, our main focus is how to add google analytics in wordpress. Before adding Google Analytics in WordPress, we need to create the Google Analytics account. Then we get the google analytics code that will be added in wordpress.

What is Google Analytics

Google Analytics is a service from the Google to track the user behaviour and traffic. We can also identify poorly performing blog pages, how long user stayed on the page and their geographical position, how many users come from social networking sites like facebook or twitter.

As a blogger, our main aim is to get the huge organic traffic from the Google search engine. We need to identify from where our potential traffic is coming and how they interact with the blog pages.

And you know, what happens if we get a huge amount of organic traffic to our blog post. It will definitely give us potential benefit in terms of business.

Create Google Analytics Account

For creating Google Analytics Account, we should have a Google account. If you are not having then create a google account first.

Now go to the Google Analytics sign up page. Click on sign up button.

Google Analytics Sign up Page

You will be redirected to google sign in page where you will enter Google account details i.e. email id and password to login to google analytics account.

Google Sign in for google analytics

After that, you have to choose between mobile app or website. So choose a website and enter the details as given below.

Google Analytics Setting up Account

After filling the information click on get tracking id button.

Google Analytics Get Tracking ID

Accept Google terms and service for the Google Analytics account.

Now you will see the tracking id and website tracking code.

Google Analytics Tracking ID and Code

We have successfully setup the google analytics account and received the tracking id and code.

What is Google Analytics Property Tracking ID

Google Analytics property tracking id is a string like UA-000000-1. The first set of number -000000 tell the account number and second set -1 is property number.

Google Analytics Tracking ID


This tracking id tells the Google analytics service to which account to send the tracking details.

What is Google Analytics Tracking Code

This complete string UA-000000-1 is included into the Google Analytics Tracking Code snippet. Analytics code is simply a javascript code that should be added to the website or blog pages before the </head> tag.

Google Analytics Tracking Code

Once added this google analytics tracking code we can easily monitor different statistics like the total number of visitors, traffic sources, bounce rate, behaviour flow,  geo-location of visitors and lot more other information.

By this information, we can improve our blog pages which having low traffic and get the idea about the posts having good user traffic. If you are in blogging then adding Google analytics is the most important part that will give you boost when you come to know that how many users visited the blog post and how they are behaving with the blog post.

Now Add Google Analytics in WordPress

There are different ways to put the tracking code in the wordpress blog. We are adding the tracking code to the wordpress theme header. That is very simple to everyone and new to blogging.

We can also add the google analytics to wordpress using a theme like MonsterInsights. But we have added google analytics to wordpress without plugin.

Simply go to wordpress admin panel then go to appearance and then to the editor.

How to Add Google Analytics in WordPress

Now at the right side of the admin panel, you will see the section Templates. Under the templates click on the theme header(header.php).


By clicking theme header, header.php is open in the wordpress admin panel.

Now copy the google analytics tracking code and paste it just above the </head> tag and then press update file button.

Add Google Analytics in WordPress

So finally we added the google analytics in wordpress blog.

It’s time now to see whether we are getting the statistics from this tracking code we added to the wordpress.

How to Check the Google Analytics is Running with WordPress

Login to google analytics with your google account. And now go to the browser and visit your blog. As soon as you enter the URL of your blog google analytics starts showing the activity in analytics.

Google Analytics Showing Active Users

To view the real-time user on the blog, on the left side expand the real-time button and click overview.

Google Analytics providing tonnes of information that will help the blogger to improve the blog in every aspect.