Track your WordPress visits using Google Analytics

Whether you're a webmaster starting their first website, or manage one or more large websites, it's important to know your visitors, how, when and why they interact with your website.

The largest, most trusted, and perhaps the most feature rich analytics system today, is Google Analytics, and that is our recommended WordPress analytics system.

Why do I need to know what my visitors are doing?

First of all, Google Analytics will tell you how many visitors you get, and it's important to know this, because you'll know if your website is getting traffic, and if the amount of traffic makes it worthwhile putting your time into content writing or creating new pages, articles and other content.

More importantly though, Google Analytics will tell you what pages your visitors are visiting, which pages they spend most time on, where your audience comes from (in terms of how they found your site, as well as what country they are from). All of this is useful, because you'll know for example, 62% of your visitors come from the UK and the article you wrote on dog grooming tips is your best performing article - you can now start tailoring your content to people in the UK who are interested in dog grooming.

Ok - so Google Analytics is useful - how do I get it?

Google Analytics is, as the name suggests, a service provided by Google - you can sign up for Analytics by visiting the Analytics Sign up page here.

You'll need to sign in using an existing Google/Gmail account, or if you don't have one, you'll need to create a new account to use for your Google Analytics.

Once signed in, you'll be presented with the option to add a new website, or a new application. Select the website option then fill out the short form. Be sure to select the correct protocol for your website (http or https) and enter the URL as set in your siteurl option in WordPress (so either or simply

Once you've filled out the form and clicked create, you'll be taken to a new page which provides your Google Tracking ID, and some code too, save the tracking ID for later in this guide!

How do I add the Analytics tracking code to my WordPress site?

There are dedicated plugins specifically for Analytics, such as the Monster Inisghts Google Analytics Plugin, however, our preferred plugin for adding this tracking code is the Insert Headers and Footers plugin.

The reason we prefer this plugin over any of the specific analytics plugins is simple - if you ever want to add any further code, such as Facebook's tracking pixel or even just some custom javascript, you're going to need another plugin on top of the analytics plugin. Using the Insert Headers and Footers plugin is a lightweight method and will allow you to add additional code to either your site header, or footer, without the need for anything additional.

Let's install the Insert Headers and Footers plugin.

Firstly, we need to navigate to Plugins->Add New

We'll use the search box at the top right to search for "Insert Headers and Footers" then click on "Install" and then, when the installation completes, "Activate".

Now the plugin is installed, let's add in our tracking code.

Ok, now we've got the plugin installed and set up, let's go ahead and paste our tracking code into the plugin - the code block you saved earlier.

We need to navigate to Settings->Insert Headers and Footers and then paste the code block into the header section.

Click on the save button and your tracking code will now be embedded in your website.

You should start to see data in Google Analytics within 24 - 48 hours, and you'll then be able to use features such as real time tracking to see what your web visitors are doing.

Look out for our up and coming guide on how to use Google Analytics to analyse and make the most of your traffic.

A Web Design Company based in Farnham, Surrey.
Copyright 2019 Pyxal Creative. Registered in England and Wales 12201331