Want to set up Google Analytics on your self hosted WordPress blog, but not sure how? In this tutorial I show you how to set up a Google Analytics account, where to put the tracking code on your website and how to check if Google Analytics is working on your blog.
What is Google Analytics?
Google Analytics is a fantastic free tool that can help you track and analyse your website traffic. It offers a whole host of statistics which show how your website is performing.
You can use it to track how many visitors and page views you are getting, how many views each individual blog post is getting, and which are your best (and worst) performing blog posts.
You can view this information over any time period you wish (today, last 30 days, last year etc.) and compare these figures to any other time period you choose (e.g. this month vs last month, this year vs last year).
You can also find out information about your readers and discover how your readers find and interact with your blog.
But before you can use this wonderful data, you first need to set up a Google Analytics account and put a small piece of tracking code onto your blog. This is what Google will use to collect all the information it needs in order to show you all the statistics about your blog that will enable you to track your progress and grow your blog!
How to set up a Google Analytics account
To set up a Google Analytics account, go to google.com/analytics and click START FOR FREE. (If you already have an account, click SIGN IN TO ANALYTICS).
You will be prompted to set up your account. Complete the information it asks for and click GET TRACKING ID. Copy the tracking code.
If you already have an account, but haven’t yet set it up properly, you will need to go to ADMIN in the bottom left hand corner. In the PROPERTY column, select CREATE NEW PROPERTY from the menu. Complete the information it asks for and click GET TRACKING ID. Copy the tracking code.
If you already have your website set up as a property in Google Analytics, or if you want to find it again in the future, you can get your tracking code by going to ADMIN in the bottom left hand corner. In the PROPERTY column, select your website and then choose TRACKING INFO => TRACKING CODE. Copy the tracking code.
Where to put the tracking code on your website
There are basically 3 ways of adding your tracking code: you can add it directly into your code (don’t do this unless you know what you are doing!), you can use a plugin, or you if you are using a Genesis theme, you can add it into your Genesis theme settings (this is by far the easiest way!).
Let’s look at each of these in turn.
1. Using Genesis
If you are using a child theme built on the Genesis Framework*, then you are in luck – adding your Google Tracking Code is SUPER EASY! This is one of the many, many reasons why I recommend using a Genesis theme on your blog (there are also many SEO benefits).
To add your tracking code using Genesis, log in to your WordPress dashboard and navigate to GENESIS => THEME SETTINGS. Scroll down to where it says HEADER AND FOOTER SCRIPTS and paste your tracking code into the box marked HEADER SCRIPTS. Then click SAVE CHANGES and you are done!
2. Placing your tracking code directly into your code
DO NOT DO THIS UNLESS YOU KNOW WHAT YOU ARE DOING! If you do something wrong here, you can crash your entire site – if you decide to use this method, proceed with caution and make sure you do a backup of your site first.
Log in to your WordPress dashboard and navigate to APPEARANCE => EDITOR. Now click the header.php file on the right-hand side below the TEMPLATES section. Paste the tracking code you copied from your Google Analytics profile just before the closing </head> tag. Then click UPDATE FILE.
3. Using a plugin
If you are not confident in placing code into your theme files and you do not have the Genesis Framework, then the best way for you to place your Google Analytics tracking code onto your website is using a plugin. There are many plugins that you can use to do this, but one that seems particularly good is the Monster Insights plugin. You can find details on how to do this on the Monster Insights website => How to connect Monster Insights to Google Analytics.
I have not used this plugin myself as I have the Genesis Framework, so I cannot personally recommend it, but from a quick bit of research into this type of plugin, this one seemed the best to me – there is both a free version and a premium version.
Please note, it’s really important that you only have the Google Analytics tracking code added ONCE to your website. If you have it more than once on your website, you will get very bizarre and inaccurate statistics. So, before you use one of these methods it’s important to check if it is on there already. If it is, you don’t need to do it again!
How to check if your Google Analytics is working
Once you have installed the tracking code on your site, check to see if it is working. Go to Google analytics and go to REAL TIME => OVERVIEW in the menu on the left. If the tracking code is correctly installed, you will be able to see visitors to your website in real time.
Congratulations on setting up Google Analytics for your website! Now it’s time to discover how to actually use Google Analytics in my Beginner’s Guide to Google Analytics.
How to start a self-hosted WordPress blog
How to choose the right niche for your blog
How to choose the perfect blog name
9 essential things to do before starting a blog
How to choose the right host for your blog
Don’t miss a thing!
Pin this post to read later
*This blog post contains affiliate links, this means if you click on a link and go on to buy the product I recommend, I will get a small commission, but you will not be charged a penny more – thanks in advance!