How to add Google Analytics tracking code to your website
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. It is not intended for advanced coders who might just want to add the code directly to the website files.
Step 1: Locate your Google Analytics code in your Google Analytics account.
Go into your analytics account and navigate to Admin -> properties -> Tracking code. The code to copy and paste into your website is in the website racking section and starts with <script> and ends with </script>
Step 2: 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:
The right way to add tracking code is by using a plugin. This is because if you add the code in your theme and you decide to switch themes at a later date, you will lose your code settings and you will have to remember to add the tracking code again to your new theme.
However, plugins can sometimes slow your site down and you need to keep them updated.
So, if you want to use a plug in I’m not going to recommend any one in particular. It is easy enough to search in the WordPress plugin repository and look for a plugin that has a good rating, has been updated recently and has had lots of installs. Follow the instructions given by the plugin for installing the Google Analytics code.
If you want to use your theme, look in your theme settings for a place to add code to the header section. Look in your theme documentation for this.
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 3: 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.
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.
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 set up your analytics. I will shortly have a masterclass to show you how to do this.
Register your interest here and I will notify you when it is available.