How To Add Google Analytics To Your WordPress Website

What Is Google Analytics?

This detailed guide on How To Add Google Analytics To WordPress Website will explain the several different ways to install the software on your WordPress website.

Google analytics is a website visitor tracking software suite which can be installed onto websites in many different ways. It allows webmasters to track visitor interaction and behaviour data and use this to help improve website performance.

Google analytics allows webmasters to track and store data across hundreds of different variables including:

Why Should I Use Google Analytics?

There are several different website tracking software suites out there, but Google analytics is by far the most popular and most used across the web. This is because it is free to use, easy to setup and well trusted because it comes directly from Google.

Google analytics is the most powerful analytics platform that we at Red Box Website Design have used, and we have installed the platform on all our client websites since we launched.

Google analytics is very accurate in what it records and offers a very easy to use graphical interface which features simple graphs, charts and tables to display the data.

How To Add Google Analytics To Your WordPress Website – 2 Different Methods

There are several different methods to install Google analytics to your WordPress website so we will explain each one below.

If you want to jump to the most relevant method then simply click the link below to bounce to the relevant section, or read the whole article so you can install Google analytics like a boss!


How To Create A Google Analytics Account

You can not add the analytics code to your website without a Google analytics account – makes sense really as you need to login to view the data.

So head on over to and click the blue “start for free” button if you do not already have an account.

If you do have an account then click on the “sign in to analytics” link.

In order to have a Google analytics account you must have a email address – if you do not have this then you will need to register for one. We recommend having something like “” as you can create this for free and then it is separate than any other email accounts you may have.


Add A New Website To Google Analytics

Once you have logged in to your account you will see a screen similar to the screen below. From here you can add your first analytics account.

Click the blue “create account” button and on the next screen give your account a name, enter the website address, choose your business sector, pick your time zone and agree to the analytics account terms.

Once you have done this it will take you to a new screen which will show your new Google Analytics tracking code, along with your tracking ID.

You do not need these for now, we will come back to them. These codes are used to identify your website and are unique to your site.


1. Add Google Analytics Code To WordPress Website Via Plugin

Ok now we are getting into the heart of what this tutorial article is all about, thanks for staying with us.

There are many ways to add the analytics tracking code to your WordPress website but the best way we can recommend is via the MonsterInsights Plugin.

To add this to your website follow these steps:

Once the plugin has been installed it is time to set it up. You can do this by clicking on the new “Insights” link in the WordPress sidebar menu – this is usually right at the bottom of the navigation list.

Or you can navigate back to the main plugins screen, find the MonsterInsights plugin from the list and click the blue “Settings” link.

Once you have clicked either option you will be brought to the main MonsterInsights settings screen. From here you need to link your Google analytics account to the website.

Click on the blue “Authenticate with your Google account” button. Once you press this it will take you to a Google account login screen.

Choose your Google account and continue with the login process.

When this screen appears, click the blue “Allow” button. This will allow the MonsterInsights plugin to talk to your Google analytics account and sync the data between each other. Without this connection the plugin can not get the tracking ID or retrieve the visitor data, so make sure you click allow – it is perfectly safe to do so.


After you have allowed the connection you will see this screen. From here you can select which Google analytics profile you want to use on your website.

You may have lots of accounts to chose from it you run many websites, or you may only have 1 account. Either way you can search through your analytics account and choose the correct one.

Once you have selected the right account, click the green “Complete Authentication” button to complete the process.

Perfect you have now installed Google analytics on to your website! Take a bow.


Extra MonsterInsights Settings

With the free version of the MonsterInsights plugin there are not many other settings to apply, however if you do want to adjust some options then these are our recommendations.

Disable reports? – If you do not want to see the Google analytics graphs and charts within the backend of WordPress then you can tick this box and the plugin will not create any reports. The reports are pretty basic so we would recommend ticking this box and then login to Google analytics dashboard to see the more detailed level of reporting. But if you find this too confusing or complicated then you can leave this unticked and view the basic reports.

Automatic updates? – Enabling automatic updates may sound good as it saves you time and makes sure the plugin is always up-to-date, however this can cause problems. Updating WordPress plugins is always a risky job as you never know if there is going to be a compatibility error which could break your site. Generally the MonsterInsights plugin is pretty solid and shouldn’t break your site but we would recommend choosing the “None” option and doing any updates manually yourself.

Allow usage tracking? – This is to allow the plugin developers access to error logs and bug reports which can help with future development of the plugin. However if you are little worried about giving 3rd party developers information about your website and whatever else they maybe tracking you can leave this unticked. We would always NOT allow usage tracking.


Upgrade To MonsterInsights Pro

As with a lot of WordPress plugins there is a free version which does the basic stuff you need it to do, and then there is a premium version which is all bells and whistles. MonsterInsights is no different, and it too offers a premium version.

You can view the premium version here ->

Now there is a lot of differences between the free and premium versions as you can see from the comparison chart above. However the main benefit of having the premium versions are:

The only downside to the premium MonsterInsights version is that it is quiet expensive, as you can see from the price chart below.

In order to get the full package of every add-on you need to go for the “Pro” account. This account gives you everything the plugin has to offer and also gives you 50 site licenses, so you can use it on multiple sites at once.

You can compare packages here ->


2. Add Google Analytics To WordPress Website Without A Plugin

Adding Google analytics to a WordPress website without a plugin is very easy – if you know what you are doing. So this installation method should only be used if you are comfortable editing the code of your website. If you are not then do not attempt this as you may break your website.

The following guide presumes you have already done the above steps in relation to creating an analytics account and setting up your first website property. If not then jump back to the top of the page and complete these steps first.

But if you are knowledgable about basic html then this should be a breeze, so let’s get to it.


Grab Your Google Analytics Tracking Code

Login to your analytics account via this link -> and you will land on your main dashboard.

Navigate to the website you are working on by clicking on the website name the top left hand corner of the screen. If you have more than 1 website in your account you will be able to search through them to get to the correct property.

Once you are viewing the correct website property click on the “admin” link in the bottom left hand corner of the screen.

This opens up a screen with a lot of options on it and it can be quiet confusing. We won’t go into the details of how best to setup and customise your Google analytics account in this blog, but there are a lot of powerful options you can use to get better data and results.

We are looking for the tracking info section on this page as this is where the installation code is located, so find this link and click on it, and then from the drop down links select “tracking code”again.

From the next screen you can see your tracking ID and website tracking code. We want the piece of code in the middle of the screen so go ahead and highlight all the javascript code and copy this to your browser clipboard.


Login To Your Website Dashboard

Now there are many ways to add this code to your website:

We are not going to run through them all, we are instead going to show you the easy option which is adding the code via the backend of WordPress through the code editor.

So once you are inside your website dashboard navigate to the “Appearance” menu tab from the sidebar, and then click on the “Editor” link.

Here you will be taken to a code editor within WordPress – it may bring up a warning saying “Are you sure you want to edit these files?” – you can say yes.


Add The Google Analytics Tracking Code To Website Files

Now if you created the WordPress theme or you know what you are doing in relation to setting up a child theme, then you can carry on with the the tutorial. If you did not create the them and do not know how to create a child theme or edit the files we would suggest stopping here and installing the MonsterInsights plugin we mention above…

Navigate to your header.php file (or if you have named it something different for some reason navigate here instead) and open this file in the WordPress editor.

Find the piece of code that looks like this </head> and then paste the Google analytics tracking code in BEFORE this code and click the blue “update file” button to save the changes.

You have now installed Google analytics on your WordPress website without using a plugin! Congratulations. Wow that was easy!


Final Wrap Up

So there you have it a detailed guide as to how to add Google analytics to WordPress website.

If you find this guide useful then please click the share icons below and spread the word.


  Article written by Rob Mackley -
Small Business Web Expert, Founder of Red Box Web Design and creator of the pay monthly website package RED BOX ALL-IN™


If you would like a chat to see if one of our pay monthly websites can help you, please drop me an email to arrange a call.


Tom Page


We are delighted with our new website from Red Box. The team listened to our requirements and came up with new a modern design that not only looks great but also does a fantastic job promoting our products and business to our customers. We would have no hesitation in recommending…

5 Star Pay Monthly Websites Rating

Victoria Follows

Hand Morgan and Owen Solicitors

As a firm of solicitors we wanted our website to have a presence online in order to generate revenue and introduce new clients and business. The brief for our website was to revamp the design which in turn would improve and increase the number of visitors and enquiries we receive.…

5 Star Pay Monthly Websites Rating

Julie James

AJW Property

Our Property Website was out of date and non-mobile friendly, we approached Red Box as we had previously had work carried out by them to our complete satisfaction. Again Red Box have created another wonderful modern website for us at a very reasonable price and we would have no hesitation…

5 Star Pay Monthly Websites Rating

Before you go...

We have something very special to offer you for FREE!

Each week we send our customers helpful content with advice about marketing their business. As you've shown interest in Red Box, we'd like to offer you FREE access to these weekly emails.

Enter your details below to join our free VIP list.

We promise to NEVER share your email address with anyone