How to set up Google Analytics on your WordPress site

Share This Post

Are you worried about your website’s traffic? Struggling to keep your users engaged? Google Analytics is just the tool you need. If you have no idea about what that is, don’t panic! Cause I am going to discuss about what Google Analytics is, why it is important and how you can easily set up Google Analytics on your WordPress site.

Google Analytics

Google Analytics is a web analytics service provided by Google. It keeps a track and record of the visitors on your website. Along with its ease of use, Google Analytics also provides site owners a statistical graph, actions of the visitors, referrals and most importantly, conversion tracking. Since the majority of the websites are using Google Analytics, why shouldn’t you?

Why is using Google Analytics Important?

If you are using an e-commerce or a blog website, then using Google Analytics is a must. With the help of Google Analytics, you would have the idea of how your visitors think about your site.

For example, you can check the bounce rate of your site through this service. As a result, by following those visitor’s actions, you can be aware of what’s causing them to leave your site.

It’s very important to know about visitor’s actions as it would help you improve or tweak your site to decrease your bounce rate. This will lead to converting your potential customers into a converted one quite easily.

Besides, you can also check which page is viewed the most on your site. This would help you determine what kind of product or a blog, your users are attracted to most. So, this will make things easier for you to choose what you should bring or post on your website.

Key Features of Google Analytics Tracking

  • Conversion Tracking
  • Keywords
  • Referrals
  • Geo-Location
  • User Actions
  • Overall Report
  • Page Views

Most importantly, Google Analytics is a key to success for your company as it helps you to keep your users engaged.

Sign Up on Google Analytics

First thing you have to do is to go to the Google Analytics page and sign up for free.

You will have to fill up the following information on the sign up form. Just put all the right information and be careful about putting the right website URL. Just Click on Get Tracking ID after you are done.

After you are done signing up, you will be redirected to the Admin section and will receive your Tracking ID & Global Site Tag. These two are the key elements to set up your Google Analytics account to the WordPress site.

Modifying WordPress Theme

If you are comfortable with coding, then this is a great option for you. All you have to do is to insert the Tracking Code inside the header.php or functions.php  file of your Theme.

1. Modifying header.php file

Just simply navigate to wp-admin -> Appearance -> Editor. Look for the header.php file under the Theme Files section. Then simply paste the Tracking Code you have generated from your Google Analytics account before the </head> tag.

Don’t forget to click on Update File after you are finished adding your code in the file.

2. Modifying functions.php file

Another way you can add the Tracking Code is by modifying your theme’s functions.php file. All you have to do is to insert the following code and hit on Update File after you are done.

add_action('wp_head', 'wpb_add_googleanalytics');
function wpb_add_googleanalytics() { ?>
// Paste your Tracking Code here
<?php } ?>
Note: Please make sure to use a child theme. Cause otherwise all your changes will be overwritten each time your theme is updated.

Alternatively, you can also use the Insert Header and Footer Plugin to add the Tracking Code inside your header.php file.

Using Google Analytics Plugin

There are plenty of Google Analytics Plugin that you can use such as: GA Google AnalyticsAnalytics CounterAnalytifyGoogle Analytics Dashboard for WPMonsterInsights and more.

These Plugins are really easy to use and come up with advanced tracking features & reports.

For this article, I am going to brief you about the most popular Google Analytics Plugin, MonsterInsights. Along with its easy setup, it allows you to check a overview report of your website and track your visitors.

Key Features:

  • Ease of use
  • Overview Report
  • Advanced Tracking Features

Setting up MonsterInsights

Initially, install and activate the MonsterInsights plugin. Afterwards, you will have to navigate to wp-admin -> Insights-> Reports. In the General tab, Click on Authenticate with your Google account. 

Now, you will have to grant access to you MonsterInsights so that it can connect to your Google Account. Once the permission is granted, MonsterInsights plugin would then be authenticated with your Google Analytics account.

Next step is to switch to the Tracking tab and make changes as per your requirements. It’s very easy to navigate. So, don’t worry!

It might take few hours before you start seeing stats on your WordPress dashboard. So, please be patient. Afterwards, you would be able to view all the stats on the Reports section of the plugin.

Once everything is configured properly, all the sessions, pageviews, average session duration & bounce rate stats would show up along with other graphical charts under the Overview Report.

That’s how easy it is to configure Google Analytics on your website using MonsterInsights plugin.


Apart from the ways I have mentioned, you can also use any other methods if you want.

To wrap this up, I hope this guideline will help you to set up Google Analytics on your website quite easily. You can use any of these methods I have mentioned. However, my personal preference would be using a Plugin as it comes up with lots of advanced tracking features.

So, why not try setting up Google Analytics right now? Feel free to let me know if you face any problems in the comments section.

Liked what you read?

Subscribe & Get Email on Latest blog posts and offers!

Just want discount? Click & Subscribe here!

Leave a Reply

More to Explore

Core WordPress

Reasons Why WordPress is the Best CMS for SEO

Nearly two decades since its initial roll-out, WordPress evolved from a simple platform for bloggers into a household name in website development. In 2021, 455

email design with Elementor
Elementor Add-on

Design WordPress emails without writing code

WordPress is an amazing platform for creating a personal blog to even business sites. Millions of sites run on WordPress throughout the internet now. Throughout


Hey! we got few news for you!!

Build your emails with Elementor!

Elementor Pro user?
20% Discount on Ele Query Builder

What can query builder do?