This blog post is intended as a very quick and simple guide to explain how you can add the Google Analytics tracking code to your website and do some basic configuration. It is not intended for advanced coders who might just want to add the code directly to the website files.

Step 1: Sign up for a Google account

You need an account on google before you can open a Google analytics account.

Follow this guide here >> how to open a Google account.

Step 2: Sign up for a Google analytics account

Go to the Google analytics home page and log in with your Google account.

Step 3: Add an account

You need to add an account to your Google analytics dashboard, this account will represent your website. Follow the instructions here >> Add an account to Google analytics.

Step 4: Locate your Google Analytics code in your Google Analytics account.

Go into your analytics account and navigate to Admin -> properties -> Tracking code.

Google Analytics Code Location

Google Analytics Code Location

The code to copy and paste into your website is in the website tracking section and starts with <!– Global site tag (gtag.js) – Google Analytics –> and ends with </script>

It will look similar to the code below (except you will have your UA number not X’s.

<!– Global site tag (gtag.js) – Google Analytics –>
<script async src=”https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXXXX-1″></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag(‘js’, new Date());

gtag(‘config’, ‘UA-XXXXXXXXXX-1’);
</script>

Step 5: Add the tracking code to your website.

Depending on how your website has been built you will need different instructions. I have placed the most common instructions below.

If you have WordPress: 

There are several ways to add your tracking code to your WordPress website.  A passion of mine is making sure WordPress websites run as fast as possible and that means relying as little as possible on plugins. So, I’m not going to suggest a plugin. Some plugins charge you a premium to see the data in your dashboard, data that is free if you just know where to look in Google analytics!  I offer analytics coaching so get in touch if you want to learn it in a no fluff, plain English way.

There are three ways I recommend adding the tracking code to your WordPress website – all a without a plugin.

  1. Bit technical -> Use Google Tag manager. This isn’t hard but does require you to have a bit of confidence with the tech.
  2. Very technical -> Add it in the header of your child theme. You need to directly access your theme files to do this so it needs a little technical skill. Open up the header.php file of your child theme, find the opening <head> tag and place your code just after it. 
  3. Not very technical -> Add it directly to your theme if you can. You will need to consult your theme documentation or ask the developer where can you add Google analytics tracking code. I use the Divi theme and the code is placed on the ‘Divi Options -> Integration’ tab where it says ‘Add code to the < head >’

Please note: If you add the code in your theme then you will have to do it again if you ever change themes.

Using Google tag Manager is my preferred method because it keeps your website code much cleaner, it’s easier to find and maintain, there is a slight speed benefit and you don’t need to add the code again if you change themes.

If you have a WIX website:

Follow these instructions https://support.wix.com/en/article/adding-your-google-analytics-code-to-your-site

If you have a Square Space website:

Follow these instructions https://answers.squarespace.com/questions/83857/where-do-i-put-google-analytics-tracking-code

Step 6: Confirm the tracking code is sending data.

Once you have added the code to your site, you need to confirm your analytics dashboard is receiving data.

Go to Admin -> properties -> Tracking code.

Look for the status near the top of the page.

Google Analytics Tracking No Test Data

Google Analytics Tracking No Test Data

Hopefully you will see a message saying “receiving traffic”. If you do not, click the send test traffic button. If your code is installed correctly you should see 1 active user appear.

Google Analytics Test Data Confirmation

 

If it still isn’t receiving data after sending test traffic verify the code you posted is exactly the same as provided and you haven’t missed out the <script></script> tags.

Once your code installation is verified you will need to configure your analytics account.

Step 7: Create a master view, a test view and leave ‘All Data View’ as your back up data view

When you first open your Google analytics account you will be provided with one view called ‘All data view’. Your website data is displayed in a view, you can have multiple views so you can manipulate the data in view depending what it is you are analysing. E.g you may want to only see data from England.

You need to add filters to your views to get the data you want, but filters can irreversibly corrupt your data if you don’t set them right. So, it’s best practice to apply filters to a test view first, then when you are happy your data isn’t corrupted you apply the filter to your main view. But, just incase something goes wrong you always need a backup data view. I recommend keeping the original ‘All data view’ as the back up, that means never applying any filtering to it.

SHARING IS CARING

If you have enjoyed this article and found value in it, please consider sharing it with someone who would benefit it. Not only will it help them but it will help me too. Thank you. 

DON'T FORGET TO SUBSCRIBE TO THE BLOG!

Share This