How to Add Google Analytics to WordPress

Spread the love

Are you folks finding it difficult in adding Google Analytics to WordPress if so I will be guiding you on how to add Google Analytics to WordPress manually and using the plugin.

We will be teaching you how to add Google Analytics manually and using a plugin so just stay connected this is one of the very easy processes to get going.

By adding Google Analytics to your WordPress account you can do a lot of things like:

  • You can track how your audience behaves
  • Identify the traffic sources and the countries where the traffic comes from
  • Understand your audience better with Google Analytics integration to the WordPress website 
  • Observe the web pages and blogs, and know what type of content generates a lot of traffic 
  • Track the conversions and revenue generated
  • Improve your website user experience

This is one of the most important things which cannot be ignored.

I’ll be guiding you through the clear steps for adding Google Analytics in these different ways, but before that, let me tell you more about why you should install this Google Analytics.

Why do you need Google Analytics?

Google Analytics in a simple term is basically understanding how users are behaving on a website. It makes it easy to understand website stats and traffic.

Google Analytics has tools within the service that allows you to explore in-depth insights and assess the overall performance of your website.

You can enhance your website and serve the audience much better level.

Without Google Analytics it would be harder to analyze website and server audience.

Let’s dive into different ways to add Google Analytics to WordPress.

Create Google Analytics Account

Google Analytics is a free tool and all you need is a Google or Gmail account to sign up. Let’s get the Google Analytics configuration ready.

Step 1: Simply Visit, the Google Analytics account and click on get started today

You can sign in using your desired Gmail account.

Step 2: After that, click on the “Start Measuring” button to go ahead.

Now, you’re instructed to enter your account name. It can be your website name or any name you prefer.

Add your property name, and select your reporting time zone, and currency. Then click the ‘Next’ button.

  • After that, You can choose different options or all of the given options that meet your needs. When you’re done, just click the ‘Create’ button.

Once you click on the Create button, a popup window will open with Google Analytics’ terms of service agreement.

Simply click the checkbox for ‘I also accept the Data Processing Terms as required by GDPR’ and then click the ‘I Accept’ button.

build and shine

After you accept the terms, you’ll see a popup with options on which communication emails you’d like to receive from Google Analytics.

You Just click the checkbox for the updates you want to receive and then click the ‘Save’ button.

Step 4: Now you will be taken to Google Analytics Set up a data stream options

Well, As we’re setting up Google Analytics for a WordPress website, go ahead and choose the ‘Web’ as the platform.

After that, you’ll need to enter your website URL and Stream name.

You can now see your Stream URL, name, and Measurement ID.

If you click the ‘Global site tag (gtag.js) option, you’ll see the Google Analytics tracking code.

After all this setting is done now you can copy the tracking code so that it can be easy to setup on the WordPress site or you can leave your tab open so that you can revisit it once you have installed the code on your WordPress site.

How to Install Google Analytics in WordPress

There are various different ways of adding Google Analytics to a WordPress website but in this article, I will be discussing the two most used ways of adding Google Analytics.

Method 1: Insert Headers and Footers Plugin

In this method, you can use any plugin of your preference, but I’ll be showing you the Insert Headers and Footers Plugin.

The first one is the “Insert Headers and Footers” plugin. Here are the steps for it:

Step 1: Install the plugin.

Go to WordPress dashboard, then Plugins > Add New, and type in “Insert Headers and Footers” on the search bar.

Step 2: Copy and paste the tracking code.

Well, All you have to do is copy the tracking code from your Google Analytics dashboard and paste it into the plugin.

To set up Insert Headers and Footers plugin you need to visit the Settings » Insert Headers and Footers page.

Here you need to paste the Google Analytics tracking code.

Don’t forget to save your changes to store your settings. Finally, you have successfully installed Google Analytics on your site.

Install Google Analytics in WordPress Theme

Method 2: Insert Google Analytics in WordPress Theme Manually

If you feel adding more plugins wood slow down your website then you can go with this option adding Google Analytics manually to your WordPress theme.

This method is for people who are more familiar with the code.

It is a little bit risky because your code will disappear if you switch or update the theme.

Once you’ve copied the tracking code, Go to your WordPress dashboard and click on “Theme Editor” under “Appearance”.

Add code in header.php file

Just edit the header.php file in your WordPress theme and paste the Google Analytics tracking that code you copied just before the closing “</head>” tag. 

Don’t forget to update your changes and save the file.


Google Analytics is one of the most important for any website to track and analyze the data.

We have tried our best to explain how to add Google Analytics to WordPress

Do read the article carefully. If you have any doubt do ask me. You can Comment down below.

Do share this article if you find it useful. Your every share matters to us a lot.

Thank you, Keep Shining😍

Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *