Google Analytics is a free online tool designed to give you a deeper understanding as to the behavior of your website visitors and customers.
What is Google Analytics?
If you are reading this article then I am going to assume you are already aware of how integrating Google analytics into your website will be of benefit, but perhaps are a little daunted as to how you can add the arguably essential tool to your own WordPress website.
I should start by saying that analytics can be added to any website regardless of the technical infrastructure or platform, but in this tutorial, I am going to be specifically showing you how to install your analytics tracking code into the WordPress and WooCommerce theme Flatsome, which thankfully is incredibly easy.
How To Get Your Google Analytics Tracking Code
To begin with, you will need to create a free Google Analytics account from which you will be taken through a series of very simple steps to add your website.
After creating your analytics account you will need to select ‘Create Property‘ from which you will be asked whether you would like to track Web, Apps, or Apps and Web, lets select Web as we will only be wanting to monitor our website traffic.
Next, you will be asked to enter your website name, URL, Category, and Time Zone, very important here to ensure you change ‘HTTP’ to ‘HTTPS’ if your website has an SSL certificate of which it really should do in today’s digital world!
Finally, you will be taken to a screen displaying your unique tracking code (I have blocked out my tracking details in the image below). You will now need to add this to every page of your website so that you can start watching the information flow in, don’t worry, we will explain how you can do this easily next.
Each Google Analytics account can have up to a maximum of 50 properties added of which each can have 25 views.
How To Add Your Google Analytics Tracking Code To Flatsome
For the inexperienced, this is quite a scary process, Google has now given you a big block of code which is hard to decipher, and are requesting you add this to the end of your head tag, what on earth does that mean!? Do not fear, it is far easier than you might think!
In simple terms, the head tag is a small coded area positioned at the very top of your web page invisible to users where scripts and styling files are usually loaded before your website content body. In this case, it means Google can load up its tracking scripts well before the page is even made visible to a visitor so that is ready to do its thing!
Thankfully you will not need to get your hands dirty with code here as the Flatsome theme offers an easy to access text input field of which the contents are injected into the head tag for you, let’s take a look.
After logging in to your WordPress admin dashboard, at the very top of your screen in the admin bar you should see the ‘Flatsome‘ menu item, from there navigate to Flatsome > Advanced > Global Settings.
You should then be taken to a page with a large field titled ‘Header Scripts‘, simply copy and paste the code from Google Analytics to this field and select ‘Save All Changes‘ from the bottom of the page and you are done! See I told you it was easy!
Important to remember here that if you have any caching plugins installed on your website that you will need to clear those for your new changes to be reflected and work correctly.
I hope you have found this tutorial useful, as you have seen, Flatsome makes it incredibly easy to add the Google Analytics tracking code to your website without any complex file changes. It is worth noting that this process will work for header scripts of all kinds, so if you ever find another service that requires the same then simply add their code under the analytics code above.
If you have had any problems adding the tracking code to your website then please let me know in the comments below and I will try my best to help!
Buy Me a Coffee?