How Google Analytics and WordPress go together

Albert Einstein once said; “Imagination is more important than knowledge”.  That might be well for fundamental scientific research, but how do you actually do research on your website?  How can you establish how popular your website is in terms of traffic, which geographic location do these visitors come from? and what sort of devices do they use predominately?  All this boils down to knowledge.

Google Analytics can produce all this data.

This post is not necessarily about Google Analytics and WordPress, although I will explain how to incorporate Google Analytics into your WordPress site (or any site for that matter), it is more about Google Analytics  and why it is important.

 Why collecting data is important

Where do I start?  Google Analytics offers a broad range of metrics that are being monitored.  Setting up some form of data gathering on your website is not just about measuring sheer volumes.  It will also give you more detailed data about, for instance,  which pages are most visited, how well received new content is and if visitors really stay on your website or bounce off.  It will also give you valuable insight into the effectiveness of site optimization.  You could for instance optimize part of your website and see if that changes visitor’s behavior and traffic volumes before you sink more dollars into overhauling all your pages.

How does Google obtain all this info?

Simply, because you tell your website to do so.  How? Well your website has a unique ID that identifies your website with Google.  As soon as a user browses your website,  the tracking Javascript on your website gets invokes and a session information is established and information (such as Gender, geographic location, browser type etc.)  gets pushed out to Google.

This is the reason why some people would install plugins in their browser to prevent tracking from taking place.  Good for them, but not good for you as a webmaster, wanting to extract information out of your website’s visitors.

 How do you get your site to get monitored?

Let’s stick with Google Analytics. First thing you will need to set up is a Google account.  Next you will need to go to “webmaster Tools” (Google Apps).

Google analytics add site

If you already used Webmaster Tools previously, you will see the websites that you manage summarised. If this is your first time, ADD site (as per above).

Once you have added the domain you want to add to webmaster tool, it will prompt you to verify the site. Basically, this step ensures that you actually have access to the sites pages one way or the other. otherwise what would stop you from taking over

I prefer to verify using a meta tag on the home page, as per below:

Webmasters tool verification


This tag will need to be put into the head of your landing page. Once done, you can verify your site and at that stage Google assumes that you have direct or indirect access to the site in question. If you use the WordPress  Yoast SEO plugin, go to general settings

The Next step is to actually start collecting data from your website and, quite blatantly,  send em over to Google.  For this, a small piece of Java Script needs to be added to your website.  In fact, every page of your website.  So go back to your Google account and go to Google analytics .

On the main dash board, you will see what websites you manage, I obviously manage my own .


Google analytics dashboard Dogtel IT

That UA-XXXXXX tracking ID can be easily added to your WordPress site using a  a plugin like Google Analytics by Kevin Sylvestre. All this plugin really does it at the tracking ID to the head of each page on your WordPress site (together with some other Java code).

If this is the first time on google analytics, you will need to create, what is called  a web property . You can do this as follows. In google analytics. go to Admin> create new property. This will bring up the screen below:


web property Google analytics

get your tracking ID, remember this is that UA-XXXXXX number that I showed earlier, and add it to your Google Analytics plugin.

Further reading

Please have a look at Adria Saracino’s post on the meaning and importance of various metrics that are presented in Google Analytics.

For a good guide on Google Analytics, how to set it up how track and what NOT to track, go to: