How To Install Google Analytics On Your Website

install google analytics

Google Analytics is a powerful tool. It allows you to gain insights into how users are using your website. In this blog post, I’ll take you through how to install Google Analytics on your website.

There are two ways to install Google Analytics on your website that I will cover in this blog post.

Set Up Your Google Analytics Property

I’m not going to cover this in too much length in this blog post as it’s pretty straight forward and I have my property set up already.

If you don’t have a Google Analytics property set up already, head to analytics.Google.com and create an account. You’ll then want to set up a property for your website.

It’s pretty self explanatory and Google takes you through the basic steps you need to take.

Get Your Google Analytics Tracking Code

Once you have your property set up, you’ll need to grab your Google Analytics code. This is the code that you put on your website to give Analytics access to your website to track.

The first step is to go to your admin settings, which is located in the bottom left corner (icon is a small cog). You’ll then be presented with a screen like this.

Under your property menu, click ‘Tracking Info’ (1) and then click ‘Tracking Code’ (2).

You’ll then be presented with your tracking code. There are two parts we need to note here, with each one needed for the two types of install.

I’ve blocked out my personal tracking data for security reasons, but to break it down for you, you’ve got:

Tracking ID – you’ll need this for our Google Tag Manager installation method
Global Site Tag – you’ll need this for manual install

Install Google Analytics Manually

To install Google Analytics manually, you’ll need to copy your Global Site Tag.

You’ll then want to copy and paste this code as the first item into the <HEAD> section of every web page that you want to track. You can send this to a developer to do if you aren’t able to do it yourself.

The other option is to use a plugin like Head, Footer and Post Injections. Once you’ve installed the plugin on your WordPress website, head to Settings > Header and Footer.

You’ll then be presented with the plugin screen, which I’ve included below. Place your Google Analytics tracking code in the Head section, which I’ve highlighted below.

Click save and you’re done! You’ve installed Google Analytics on your website!

Install Google Analytics via Google Tag Manager

The second option – and the recommended option – is to install via Google Tag Manager. Doing so allows you greater control over the tracking of events and user activity on your website.

Head to tagmanager.google.com and create an account and property. Install your Google Tag Manager using a plugin like GTM4WP or by using the code injection plugin mention at the start of this article.

On the left side menu, click variables.

Once there, you’ll want to scroll down to ‘user-defined variables’. Click ‘add new’ and configure your custom variable as shown below.

Give your variable your name – e.g. ‘GA Variable’
In tracking ID, paste your Google Analytics tracking ID.
Click save

Creating Your Page View Tag

To register a page view on your analytics tracking, you need to create a page view tag. To do this, click on tags in the left-side menu. Then click ‘add new’ in the top right.

You’ll then want to set your tag up as follows:

In tag type, select ‘Google Analytics: Universal Analytics’
Under track type, select page view
Under Google Analytics Settings, select the Google Analytics variable you just created.

Head to the ‘triggering’ section and click in the box to add a new trigger. Select ‘all pages’.

Debug Your Google Analytics Install

There’s a super handy Google Chrome extension that allows you to debug your Google Analytics and Google Tag Manager install. It’s called Tag Assistant and you can install it here.

Once installed, head to your website and click the Tag Assistant button in your toolbar. It looks like this.

Click ‘enable’ and then refresh your page.

If all is installed properly, your tag assistant will be able to read the Google Tag Manager and/or Google Analytics tags. It should look like the below.

I hope that was helpful in installing Google Analytics on your website. Be sure to get in touch if you have any questions.

Leave a Reply

Your email address will not be published. Required fields are marked *