fbpx

How to install Google Analytics to WordPress site?

It’s great that you understand the importance of Google Analytics, and want to add it to your WordPress site.

In case you have not been able to install it in the past successfully. Or maybe you want to verify if what you did was correct or not, in this blog post, I’ll show you all the possible ways to add Google Analytics to WordPress.

But before that, let’s understand Google Analytics.

What is Google Analytics?

Google Analytics is a free tool from Google, which helps you measure your website traffic. It tracks your website activity, and creates various reports that help you understand the behaviour of your website visitors. It also provides valuable insights that can help you to build a business strategy.

Set up Google Analytics account

Note: Ignore this 1st step if you already have a Google Analytics account.

1. Go to Google Analytics, and sign in with your Google Account. If you haven’t signed up for Google Analytics yet, you will get an option to signup.

Google Analytics Signup

2. You will get an option to create an account. Enter your account name there.

GA Create Account

3. Below this, you will see 4 checkboxes with options, leave them as is, and click on “Next”.

4. Next, you will get 3 options to select, of which you need to select “Web”, and click “Next.”

GA Select web

5. Now add the “Website Name”, “Website URL”, Select Industry, and Country. Click on “Create”

6. As soon as you click on create, you will see the popup with Google’s Terms of Service with 2 sections. One for Terms of service and another for additional terms for data shared with Google.

Select the checkbox in both the sections, and click “Accept” to move forward.

7. You have now created your Google Analytics account. 

GA Tracking Code

You will now be redirected to the Tracking code screen where you will find the Tracking ID and tracking code.

Keep this ID, and code safe with you. 

Add Google Analytics to WordPress

There are 2 ways you can add Google Analytics to your WordPress site.

  1. Using the WordPress plugin
  2. Using Google Tag Manager 

My preferred method is to use Google Tag Manager. These days you always need to add multiple code snippets to your website, and using Google Tag Manager, it will become easier to add various snippets.

Note: In case you are not using WordPress or you have any other CMS(content management system), you can copy the code given in the last step for Google Analytics, and paste it on your website code. If it’s a static site, paste it in the head tag in HTML code. 

And if you have any other CMS, look for a file editing option or plugin for that CMS to add Google Analytics code snippet.

Let’s take a look at the 2 different ways of installing the Google Analytics code.

Using the plugin to add Google Analytics

There are plenty of plugins available to add the Google Analytics code snippet, and many of these plugins have the facility to show the data from Google Analytics to your WordPress dashboard. This way, you don’t have to login into Google Analytics all the time.

I recommend using Google Analytics by MonsterInsights. 

Let’s go step by step on how to add the code snippet using this plugin.

Go to Plugin> Add New and search for “Google Analytics MonsterInsights.”

You can see the first plugin appears. Click on “Install Now”, and once installed “Activate” it.

You will see the setting wizard from MonsterInsights as below.

MonsterInsights
  • Select the category of your site, and click on “Save and Continue”.
  • In the next step, it will ask you to connect it to Google Analytics. (It will also ask you to purchase PRO version which you can ignore)
  • Click on “Connect MonsterInsights”
  • You will be redirected login page of Google Analytics if you are not logged in. If you already logged in, then all you will have to is grant the access your Google Analytics account.
  • Once connected, it will show you all the accounts you have. You can select your website’s Google Analytics account from Dropdown, and go ahead.
  • After this, it will show you some settings, and ask you to install WP forms plugin. You can continue the step further and lastly finish the installation.
  • You will be redirected to the plugin dashboard as you are now connected to your Google Analytics account.

You can further explore this Plugin and set up a few new things as well if you want. This is an excellent plugin to get better conversion from your blog or website.

Use Google Tag Manager to add Google Analytics

If you have not set up Google Tag Manager yet, first you will have to sign up your Google Tag Manager. In one of my previous series, I have gone into detail on how to set up Google Tag Manager.

Let’s go through the steps.

Step 1: 

You will need the Tracking ID from your Google Analytics to add to the Google Tag Manager.

For that, go to your Google Analytics account > Admin > Property > Tracking Info.

Click on Tracking Code to get the tracking ID.

Tracking ID would be something like UA-XXXXXXX

Copy it.

Step 2:

Go to Google Tag Manager, click on “Add New Tag” from your dashboard or go to the Tags menu > Click “New” button on the top right corner.

It will open a popup that will allow you to configure the Google Analytics Tag.

Name your tag, “Google Analytics.”

Click on tag Configuration > Select “Google Analytics: Universal Analytics”

Add GTM tag screenshot

Next, you’ll see the options like the below screenshot.

Check Mark “Enable overriding settings in this tag”, and add Tracking ID in the text box which will appear after selecting the option.

GTM Tag Configuration screenshot

Next, click on the triggering option, which will open another popup. Choose ”All Pages” to track all the pages on Google Analytics

GTM Trigger Screenshot

Once done, click the Save button on the top right corner.

You have successfully added Google Analytics Tag into Google Tag Manager.

Step 3:

Now you have a tag, and you need to publish the container.

Click on the submit button on the top right corner.

GTM Submit screenshot

After submit, you will see the submit changes popup as below screenshot.

GTM Publish Screenshot

Enter the version name and description and click on the publish button on the top right corner.

Congratulations, you now have a live Google Tag Manager account.

Step 4:

You can add your Google Tag Manager code snippet to WordPress, or you can use the Plugin called “Google Tag Manager for WordPress.” Install the Plugin and make the necessary settings to add Google Tag manager code into the WordPress site.

Here is the full guide about adding Google Tag Manager to the WordPress site.

That’s it.

It is this easy to add Google Analytics to your WordPress site.

Google Analytics is an essential part of your website. You can track your visitors and get great insights on how to scale your business further. You can plan your future strategy based on the data you get from Google Analytics.

I recommend adding Google Analytics to your WordPress site from day one.

So, what plugin are you using to add Google Analytics to your WordPress site? Leave a comment below so that I can explore new plugins as well.



Subscribe to my blogDon't miss the latest SEO, Digital Marketing and wordpress tips.

3 thoughts on “How to install Google Analytics to WordPress site?”

  1. Yes, your detail has helped me to setup my website for analytics, i was facing the same issue, but everything is now working well. Thanks for your support, subscribed your blog..

    Reply
  2. Thank you for the well detailed instructions, very useful. We have 2 tracking code for the same website. So how do we add more than one Google analytics code?

    Reply
    • Thanks.
      Create 2nd tag in Google tag manager. Use custom HTML tag type to add 2nd code. You can add both tags this way.

      However, I do not suggest this as both will give you same data. And it adds up extra time to load your page.

      Reply

Leave a Comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

This site uses Akismet to reduce spam. Learn how your comment data is processed.