How To Add Google Analytics In WordPress Site

How To Add Google Analytics In WordPress Site

Do you have a WordPress site??? Up and running??? Great!!

It is a high time to see how users interact with your website. Where do they land? Which page do they quit in a short span? Which page hold them for long? ,etc. This data insight is valuable to any webmaster. You have more scope for improving, thus, welcoming a swarming traffic to your website.

Google Analytics is a web tracking service offered by Google. It reports the number of active visitors, sessions on your website, user demographics, interest, source of origin etc.

You can either create a custom dashboard for your perusal or can export analytics reports in various formats.

Importance of Analytics

The webmasters need data insights to see how their website reach the audience. What is the traffic incurred by their website? How many internet users find it useful or entertaining? Every webmaster from any niche aims for higher traffic. To optimize the website with visitor’s perspective, the negative and positive areas should be looked upon. Analytics provide this information of visitor’s interaction with the website.

Bluehost Hosting Discount

Analytics will help you to know who are visiting, from where they originate and what in your website they enjoy. You have no other way to measure traffic without insight information.

Also Read: How To Find The Tracking Code From Your Old Analytic Account

Why Google Analytics for WordPress Website

The best feature of Google Analytics is ‘IT IS FREE‘. I find it most reliable. It provides accurate data.

You may be thinking why Google Analytics for WordPress? Apart from offering great features and making it easy to incur insight reports, WordPress have wonderful, reliable and easy to implement plugins. You don’t need to be tech-savvy to learn and understand the user’s activity report.

How Google Analytics works for WordPress

To implement Google Analytics you are required to add a javascript snippet to your site. Once this code is placed you are ready to collect data. When a visitor lands on your page the tracking mechanism starts and it is a session on your page.

This single snippet of strip functions for every page across the website in a similar manner.

Most Important data provided by Google Analytics that every webmaster craves for is:

  • Pageviews– number of pages a visitor traverse
  • Sessions– individual visitors on the website
  • Source of origin– from where the visitor came
  • Bounce rate– percentage of the users who left immediately
  • Session time– how long they stay
  • Page per session– how many pages they visit
  • Conversion– The actionable they completed


How to Install Google Analytics on WordPress? (4 Ways)

There are few different ways you can install Google Analytics on WordPress. These are briefed further. But, before you do so, you are required to a have a Google account. If you have well and good, else you need to sign-up on

Once you have the Google account handy, visit Login with your Google account credentials.

Set up your Google Analytics account by following prompts that comes by. Once you are done creating an account for your site. You need to find tracking code to paste in your website.

  • Click on “Admin” tab
  • Select an account from “Account” column.
  • Click on “Tracking Info” under property column.
  • Under Tracking Info select “Tracking Code“.

How to find Tracking Code in Google Analytics

When you click on “Tracking code“. A new window will prompt on screen with a code snippet. Copy the highlighted code.

How to find Tracking Code in Google Analytics


Analytics Code Installation Methods

There are many ways to install the code on your website.

Methode 1: Manually Adding Google Analytics code

If you can handle codes well, I would recommend Installing the code manually.

# Login to your WordPress website. Go to website dashboard. Open EDITOR under APPEARANCE menu.

# On the right side of the screen, find ‘header.php‘ file in the list of templates. You can also highlight the file name by pressing CTRL+F and search for the file.

# Paste the tracking code under <head> tag and before </head> tag.

Manually adding Google Analytics code

# Click on ‘UPDATE

# To confirm whether you were able to make it properly, Go back to Google Analytics account. Refresh the page to see the data recorded under REPORTING tab. It may take up to 48 hours for the data to show in the Analytics pane.

# If you don’t receive the data you can click ‘SEND TEST TRAFFIC‘. It will test by making a visit to your website.


Methode 2: Adding Through WordPress Plugins

This is the best method for a beginner who is not a code savvy. WordPress offers numerous WordPress plugins for google analytics. Say, Google Analytics by MonsterInsights, Yoast SEO, WP Statistics, WP Power Stats etc.

Also Read: How to Install a WordPress Plugin – Beginners Guide

I use Google Analytics by MonsterInsights plugin and would recommend others to go for this.

how to add Google Analytics by MonsterInsights plugin

#1. Download the desired plugin from WordPress plugins directory.

#2. Activate the plugin.

#3. In your WordPress Dashboard, Look for ‘Settings‘ beneath ‘Insights‘ tab. Click on ‘settings‘.

How to add Google Analytics by MonsterInsights

#4. Now you need to connect your Google Analytics account to the plugin. There are two ways of doing it.

Authenticate your Google Account:

# To Authenticate your Account, Go to General tab Under ‘general settings

# Find a button stating “Authenticate your Google Account”.

How to add Google Analytics by MonsterInsights

# On clicking it, it will directly connect you to analytics once you allow.

Enter UA code manually:

# You can manually add UA code into the plugin. Simply check the box prompting to “Manually enter your UA code“.

How to Enter UA code manually in MonsterInsights

# Now open your Google Analytics account.

# Look ‘Property’ tab under “Admin” tab. Tracking Info » Tracking Code. Copy the UA code from there and place on your website page where it prompted to paste UA code.

How to Enter UA code manually in MonsterInsights



Methode 3: Adding Through Google Tag Manager (GTM)

This tag manager let you access all sites in one plane. You can add Google Analytics through GTM. See how:

# Login to Google Tag Manager. Under “Admin” tab in GMT, create a new account.

# Setup or add a “new container“. Select “web” and create.

How to add google analytics through google tag manager

# When you create. You will be shown a code for the container.

How to add google analytics through google tag manager

# Add this code in the <body> tag in the source code of every web page you want to track. Or WordPress users can simply install this plugin WP Google Tag Manager and put your GTM code which you can find in that code container window, highlighted in the image above.

# Now you need to select a tag type for your container. Under “WORKSPACE” tab, select “tags” from the left sidebar menu.

How to add google analytics through google tag manager

# Untitled Tags » Choose Tag Type » Universal Analytics.

# At last, configure your tag by adding your Google Analytics UA code.

How to add google analytics through google tag manager


Methode 4: Adding Through WordPress Theme

# Mostly, The WordPress themes allow you to add header and footer script.

# Add the code obtained from GTM to into your blog.

# Go to Appearance » Theme Options. Look for header and footer script. Paste the tracking code there.

How to Add Google Analytic Through WordPress Theme

# You are done doing it.

Also Read: How To Track Gmail Messages with Google Analytic

You are done with integrating Google Analytics into your WordPress website. Now You can start collecting insight data for your perusal. Navigate Overview and Audience section under-“Reporting” for tracking visitor’s behavior.

How To Add Google Analytics In WordPress

Google Analytics once implemented properly will help you measure your website performance and user engagement level.

There are few more methods other than above 4 mentioned. But adding more methods will make this post complicated. So I will explain other skipped methods to add Analytics code in my other articles. I would recommend you to add Google Analytics code using the manual method as I find it easy and can avoid adding one more plugin just to add analytics code.

Share your recommended methods to add Analytics code in the comment section. Also, do let me know which method you find easy to implement. If you find this tutorial helpful and easy to understand. All I can ask you to share it on your social networks.


Alok Rana founder of LoudTechie. Like to share his blogging experience and resources with readers. Offering best money making blogging opportunities to new bloggers. He covers how to blog, SEO and marketing.

Click Here to Leave a Comment (Only Content Related Comments Will Approve) 5 comments
Pooja Gupta

Hey Alok,

Thanks for this tutorial.

i have been using two methods to install Google Analytics, one is through MonsterInsights Google Analytics Plugin and secondly is through the backend code. I have never heard about the remaining two methods.
But now i will try to install the Google analytics through above-mentioned approaches.



    Hello Pooja,

    There are much more ways to add Analytic code into WordPress but I have just presented few easiest and most common methods here. Thanks for your feedback on it. Keep visiting for more updates like this.


Nice blog,
Thanks for the Post of “How To Add Google Analytics In WordPress Site”
The post is really important and helpful for new bloggers. I like your tips.
Have a good day.


Dear Alok
Thanks for writing about google analytic tool
I have a web site which is create by wordpress and the using of google analytic tool is very important for a web site.
Your post is full of information
I m happy to read your post
and want to get your next post
Best of luck


    Hey Jute
    Adding Google analytics into your WordPress is like a premium pack for free. Analytics is essential for any blogger or site owner. And I have tested some other analytics alternatives such as Histats. But for me, Analytics deliver a real stats.


Leave a Reply: