Website Tracking

3 Ways To Install Google Analytics To Your WordPress Website

Once you created your WordPress website you, of course, want to track how many people are visiting your website. Google Analytics is the best option for this. It’s a free tool and very easy to use.

In this article, we break down 3 options that you have when implementing the Google Analytics tracking code to your WordPress website. To make things easier going forward, I highly recommend going for option 3 which includes Google Tag Manager.

Google Tag Manager (GTM) is a free tool that makes it easier to add and update tracking tags within your website. It’s recommended to use Google Tag Manager for all the tags on your WordPress website.


Option 1 (the easy way): Using a GA plugin


If you don’t have much experience with WordPress this might be an easy option. However, keep in mind that if in the future you want to track additional things in Google Analytics you might be unable to change the tracking code directly.


There are a bunch of WordPress plugins available that allow you to add the Google Analytics ID and automatically generate the tracking code.


For example, the GA Google Analytics plugin lets you add the Google Analytics code by just adding your Google Analytics tracking ID.


Screenshot of GA Google Analytics WordPress plugin.


To locate your Google Analytics tracking ID, login to your Google Analytics account and go to Admin > Property > Tracking Info > Tracking Code. The Google Analytics tracking ID looks like UA-XXXXXXXX-X.


Option 2 (the standard way): Adding the GA code using the “Insert Headers and Footers” plugin

Now, compared with the first option there’s not a massive benefit of using this option. It will give you a bit more flexible in case you ever need to change the tracking code.


However, if you go for option 3 you will still need to add the “Insert Headers and Footers” plugin (I recommend you using this plugin regardless!).


Insert Headers and Footers is a simple plugin that lets you insert the Google Tag Manager code easily into your WordPress site header and footer. This means there’s no need to edit your theme files and your codes will stay where they are even after you update your theme!


To install this plugin:

1. Login to the back-end of your website (www.yourwebsite.com/wp-admin).

2. Go to Plugins > Add New and then search for “Insert Headers and Footers”. Press “Install Now” in the “Insert Headers and Footers” square.

3. In the left hand menu, go to Plugins > Installed Plugins and then scroll down to find the “Insert Headers and Footers” plugin. Click on Activate.


Once you installed the plugin, you will have to go to Settings > Insert Headers and Footers in your WordPress dashboard. From here, you can add your your Google Analytics tracking code (not just the ID!) to the “Scripts in Header” section”.


Screenshot of Google Analytics tracking code in Insert Headers and Footers WordPress plugin.


Option 3 (the recommended way): Adding Google Tag Manager using the “Insert Headers and Footers” plugin


Now, Google Tag Manager is a great tool and I highly recommend every website to use it. If you don’t have a GTM account yet, please read our beginner article about Google Tag Manager first.


It will make your life significantly easier going forward and can help you to track things like forms without a thank you page.


If you haven’t done so already, please follow the steps from option 2 to install the “Insert Headers and Footers” WordPress plugins. Then, instead of adding the Google Analytics code place the GTM code in here.


Screenshot of Google Tag Manager tracking code in Insert Headers and Footers WordPress plugin.


Click save, en voilà: Google Tag Manager is live on your site.


WordPress Google Analytics FAQ


How do I add Google Analytics to WordPress?

There are different ways to add Google Analytics to your WordPresss website. Read our article for step-by-step instructions on how to do this.

What is Google Analytics?

Google Analytics is a free web analytics tool that can give you most of the information you need to optimise your website. It’s the most popular web analytics tool around and is known to be easy to use and reliable. Made for small and medium-sized websites to give them an opportunity to track, analyse and improve their online presence.

How does Google Analytics work?

Google Analytics works based on a piece of tracking code that is being placed on every page of your website.

What are some of the benefits of Google Analytics?

See where your visitors are coming from. See which pages your visitors have visited. See how long your visitors spend on each page. Track key conversion points on your site.

Author


Avatar

Jeroen Minks

With over 10 years experience in digital marketing, Jeroen helps businesses to get more results out of their online advertising budgets.