How To Add Google Analytics In WordPress Site

Alok // November 6, 2017 // 5 Comments

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?

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, the 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 audience interacts with their website. What is the traffic incurred by their website? How many internet users find it useful or entertaining? What bounce rate they are getting with their current traffic?

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.

Analytics will help you to know who is 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 thing about Google Analytics is 'IT IS FREE'. I find it most reliable. It provides accurate data.

For bloggers and marketers it is the most resourceful tool available for free. But not many users know how to make a good use of Google Analytics.

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 for analytics. You don’t need to be tech-savvy to learn and understand the user’s activity report.

How Google Analytics works with WordPress

To implement Google Analytics you are required to add a javascript snippet to your website. 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 Methods

There are many different ways you can setup Google Analytics on WordPress. Few of them are briefed further in this article. But, before you do so, you are required to a have a Google account. If you have one already, well and good, else you need to sign-up on

Once you have the Google account ready, 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 website. You need to find tracking code to paste in your website.

Follow the steps and the screenshots below:

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

When you click on "Tracking code". A new window will prompt on screen with a code snippet. Copy the highlighted code and paste it in your WordPress website using any of the method given below.

Google Analytics Code Installation Methods:

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

Method 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 find the file name by pressing CTRL+F and search for the file.

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

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.

Method 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.

#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'.

#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”.

# 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".

# 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.


Method 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 GTM, create a new account.

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

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

# 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.

# Untitled Tags » Choose Tag Type » Universal Analytics.

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

Method 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.

# 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.

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

Wrapping Up:

There are few more methods other than above 4 mentioned. But adding more methods will make this post complicated. So I will explain other left over methods to add Analytics code in my other article later on.

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 Google Analytics code via the comment section below.

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 with your friends and social networks.

About the Author Alok

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 loves to talk about how to blog, SEO, Traffic Strategies and Marketing.

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 loves to talk about how to blog, SEO, Traffic Strategies and Marketing.

Enjoyed this article?

Find more great content here:

September 12, 2021

WordPress is arguably the most user-friendly website creation

June 26, 2021

You may be smart, but your brain is

June 5, 2021

Are you interested in making money without leaving

Grow Your Website Traffic upto 200% in 30 Days
Get Traffic Hacks for 100 % Free & Also Get My FREE Traffic Strategy E-book worth 20$.
Your Privacy and Email is safe with us !!