Add Google Analytics to WordPress

Add Google Analytics to WordPress

Google Analytics is one of those tools that website developers throw at you as a tool you simply must use. You download it, you look at it occasionally, but you don’t necessarily understand exactly what it all means. All you know is that it’s full of graphs and percentages, and if the percentages are in green then that’s a good thing. To add Google Analytics to WordPress, you just need to follow a few steps.

Google Analytics is a tool designed by Google to look at the people visiting your website and then provide you with a breakdown of who they are. What did they search for in order to find your site? Which pages did they visit, and how long did they stay on our site? How many visitors did you have this week compared to last week?

By understanding this information, you have a great opportunity to tailor your website specifically for your regular audience, making sure the most popular pages are easily found and well optimised for different devices. You can also understand exactly which keywords are leading visitors to your website, allowing you to build your SEO around them.

When using WordPress, Google Analytics can be connected to provide you with seamless information at the click of a button – and here’s how to do it.

Get a plugin

Plugins are easy to use and highly regarded, especially in the world of SEO and Google Analytics. MonsterInsights is a popular one with both a basic package and a more premium option available, meaning no matter what level you are working at you will find a suitable analytics package. Once you’ve downloaded the plugin to your WordPress site, a menu called “Insights” will appear on your site.

Once you’ve completed the set up (through which you will be fully guided but the setup wizard) you can view analytics reports as often as you want, digesting the information into sections that work for you and are most applicable to your site and your audience.

Through Google itself

As a Google add-on, Google Analytics is, of course, available through the search engines own dashboard. To use this, you need to add a snippet of your site’s code to your google files, being careful not to destroy your own code in the process.

To do this, go into your WordPress theme’s manual code editing interface and find the header.php file. Paste the code from Google Analytics into this file after the ‘body’ tag and save the changes, before reuploading the file to your server.

Alternatively, you can update this through your WordPress functions file, which will automatically add the tracker to every page of your site. To do this, paste the following code into the functions.php file on your theme:

<?php

add_action(‘wp_head’, ‘wpb_add_googleanalytics’);

function wpb_add_googleanalytics() { ?>

// Paste your Google Analytics code here

<?php } ?>

This will then be live on your site, and you’ll be able to view your analytics reports as and when you need them.

How do I view the data?

We’ve referred a few times to the reports that will become available as a result of Google Analytics, but how do you view them? Give WordPress adequate time to update Google with your data before searching for the reports, as if you move too quickly the data will be out of date and useless.

To view the data, simply head to your Google Analytics dashboard and spend some time familiarizing yourself with what is available. You may find it useful to engage in different levels of activity week on week to see which is the most successful, before deciding on a long-term strategy moving forward. In the long-run, understanding your data can be a great tool for boosting sales and improving website traffic, so Google Analytics is well worth your time.