How to Install Google Analytics on WordPress Website


How to Install Google Analytics on WordPress Website 

Google Analytics is a free web analytics tool that keeps you updated about the number of visitors, their location, their age, etc. 

To have access to the information, you can add a snippet of code on your website. 

Google Analytics collects the data:

  1. Who are your visitors – It provides their basic information: Age range, location, interests, etc.
  2. Where your traffic comes from – Mobile, Desktop, Social Media, etc. 
  3. What they are looking for – Type of content.
  4. Where/Why they leave – The pages they visited, bounce rate, etc.
  5. How much time –  Duration of their presence on your website. 


Why is Google Analytics important for WordPress?

Google Analytics keeps you updated about the number of visitors, age range, gender, etc. All this information will help you in designing the next marketing strategy and your content. Google Analytics keeps you informed – if a certain webpage is doing well or visitors are leaving quickly. With this data, you can prepare an informed strategy and make some changes accordingly. Google Analytics keeps you informed about the behavior of the visitors: What they search for; How much time they are spending, etc.     


First Create Google Analytics Account:- 

You should have a Google Account to create a Google Analytics account. 

Note: Make a separate business Google Account for business.

  1. Go to
  2. Sign up and fill in all the required details: account name, website name, URL, Industry category, etc. 

(Note: As you are creating Analytics account for WordPress website, choose “Web” under “What do you want to measure?”) 

  1. Accept terms.
  2. You will be able to see your Tracking ID. In case if you miss, go to the Admin and then the Tracking info section. Click on the Tracking code.


How to add Google Analytics to WordPress 

There are two ways to add Google Analytics to WordPress easily:-

First Method – Using Plugin

  • There is a “Plugins” tab on the dashboard on the left side. Select it. Click on “Add New”.
    google analytics wordpress plugin
    Click on “Plugins”
  • You can write “Google Analytics” in the search bar. 
  • When you find it, click “Install Now”, so it can be downloaded. After it’s completed, Activate it. 
  • Now, connect it to Google Analytics. 
  • You will find “Insights” on your dashboard. Click and Go to the “settings” menu and Select “Authenticate with your Google account”. You will be presented with a Google Analytics page. You have to sign in to your Google Account (the one you are using to track.) 
  • You will be presented with a small tab therein Google Analytics will ask for your permission to access your Google Account.  Click “Allow”.
  • Select the profile you want to track. Complete the connection.


Second Method – Without Plugin

This is a little risky method. Even a small mistake can break your website. It’s better to backup WordPress. If it goes wrong, you will be able to restore it. 

  • First copy the Google Analytics tracking code. 
  • To find the Google Analytics tracking code, login to your Google Analytics account. 
  • Go to Admin, and Select “Tracking Info” under the “Property” section. Choose “Tracking code”. You can see the tracking code. Copy it.
How to add Google Analytics to WordPress
Copy the tracking code.


To add the Google Analytics tracking code, you need to edit the header.php file. See the instructions below:

  • Go to “Appearance” on the WordPress dashboard, then “Editor”. 
How to add Google Analytics to WordPress
Click on “Editor”
  • Go to the Templates section, and select the header.php file.
  • Scroll down and find the closing </head> tag, and paste the tracking code before it. 
  • Click “Update File”.

You have done it! 

If you are still wondering, Which method is better? 

Let’s talk it out.

Adding plugins can affect your site load time. You need to choose well-coded plugins, so it does not affect your site speed. If you are still in doubt, how many plugins you can add to avoid its disadvantage. you can see: How Many Plugins are Too Many?

You might have a question; Which is the best Google Analytics plugin for WordPress? Scroll down to find out.

  • MonsterInsights 

You can have all the information in WordPress. You can check the MonsterInsights dashboard to see all the information about visitors. 

This plugin is lightweight. It does not affect site load speed. 

  • It has forms addon and EU addon and features like Google Analytics universal tracking. 
  • You can track the number of things: file downloads tracking, call-to-action button tracking, etc. 
  • You can know visitors’ behavior on your website, how they came to your website, and what keywords they used.
  • You can track the Google Adsense Ads performance with the help of Ads Addon.


  • ExactMetrics

          It’s a free plugin. You can see the Google Analytics reports in the WordPress admin area. 

  • You can check the reports like bounce rate, organic searches, and many more.
  • You can track the events, for example, affiliate links, etc.


If you choose to go without a plugin, you have to be careful.

You can’t make a mistake that can break your website, and you will have to backup WordPress. But with plugins, just some clicks would work.

If you miss adding Analytics tracking code to the new theme and add it later. you will miss the data. That’s not the case with plugins.

If you think you can handle it. Go for it! 



How useful was this post?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 4

No votes so far! Be the first to rate this post.

Check Also

SEO analysis tools

Important SEO Analysis Tools

5 (2) There are many free & premium tools available over the internet to analysis …

Leave a Reply

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