Setting Up Google Analytics

Create a Google Analytics Account

Before you do anything, the first step in setting up Google Analytics is to get a Google Analytics account. This needs to be linked to a google account (any gmail or google linked email will do). Go to If this is the first time you have accessed Google Analytics you will be presented with this screen:

Setting Up Google Analytics

Step 1: Sign up to google analytics

Clicking signup will take you to the setup (for this guide we will not go through the mobile app setup but the process is very similar). Enter a name for your website. This can be whatever you like, we recommend using your company name here eg for Nike, use “Nike”. This makes it easier to find accounts when you have more than one as they are listed in alphabetical order.

Next select your Industry category. (From our analysis, this is how Google auto-picks your “industry vertical” in its benchmark reports). It’s not a big deal what you pick but I’d recommend you try and be somewhat accurate here.

Then choose your timezone.Step 2: Account Setup>

Google Analytics Code Snippet - gtag.js

Once done you’re done you are presented with the Google Analytics (GA) Code Snippet including an Account ID already populated for you. Here is what the code snippet will look like: gtag.js code snippet

In August 2017, Google introduced a new version of the GA Code snippet called gtag.js. This is actually completely different to the old code snippet. Instead of just being for Google Analytics, gtag.js covers all of Google’s products. The “old” Google Analytics code snippet

Examples include Adwords Conversions and DoubleClick Conversions. In that sense, gtag.js is quite similar to Google’s other product Google Tag Manager (GTM). In fact if you have GTM already installed on your site, you do not need to install gtag.js. The key line in the snippet is “config”. Here is what the code snippet might look like for GA and Adwords:

window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'UA-1234567-8');
gtag('config', 'AW-1234567-8');

Installing Google Analytics to your Website

Once you have your account ID you are ready to install GA on your website. There are two approaches:

  • Installing through GTM
  • Installing directly to your website

Installing GA through GTM

This is by far our preferred approach. With GTM you can access a whole different tag management environment and put in whatever tags you like, including google analytics. Having GA run through GTM means you can manage and update it through the one central tag. You change the tag once, then hit publish - to update across your website. An example might be if you want to add a custom dimension to GA. This is straightforward with the GA tag template in GTM.

Follow the steps in our Setting up Google Tag Manager Guide> to get GTM up and running on your site! Then come back here to finish the steps to installing GA.

Creating a GA Tag in GTM

This is actually very easy. GTM comes with a stack of inbuilt tag templates, one of which is Google Analytics. All you need to create the Tag is the GA account ID that you created above.

Go to First thing to do is to> create a google analytics settings variable, we call ours: GA-ID. Click on Variables.

Step 1: Click on Variables

While you are here we recommend you turn all the preconfigured built in variables in GTM. Click Built-In Variables > Configure

Step 2: Add Built-In Variables

Then select everything. Step 3: Select All Built-In Variables

Now create the google account id variable. Scroll down and click New (User-Defined variable).

Step 4: Add a new User-Defined Variable;

Scroll down and select Google Analytics settings variable

Step 5: Choose a Google Analytics settings variable template;

Enter a name for the variable - we call ours “GA-ID” you can call it whatever you like. In the Tracking ID box, type in your Google Analytics Account ID, click Save.

Step 6: Type in your GA account ID

In GTM now click on New Tag

Step 7: Now create a new tag

Then click Tag Configuration and select the Universal Analytics tag type. (Classic Analytics is the old version of GA which has reduced functionality compared to the newer Universal Analytics. There is really no reason to choose Classic Analytics unless you have older GA version events/tags hardcoded on the website)

Step 8: Click Tag Configuration and choose the Universal Analytics tag template

Enter in a name for your GA pageview tag. We call ours: GA - Pageview Tag. For tracktype select Pageview. Now for Google Analytics settings - choose the variable you already created - in our case above this would be GA-ID.

Step 9: Choose the variable you already created “GA-ID”

Then choose Triggering and select “All Pages”. This means we are setting the tag to fire on all pages. You can choose to create different triggers if you wish (eg only fire on certain pages) but for the GA tag we want this to fire on all pages.

Step 10: Add in a trigger for your tag to fire on “All Pages”

Your tag should now look like this:

Click Save. Now in the main area click on Preview. This will allow us to test the tag as if it was on the website, to see if it is firing and working correctly.

Step 11: Click Preview - to enter GTM Debug mode

Now go to your website and refresh the page. A new GTM debug window should appear. In the list of tags that have fired you should see the “GA - Pageview Tag” you just created. Excellent! You can click into the variables and datalayer tabs for extra info if you wish. The summary window to the left shows all the events that fired on your site, sequentially. You can click on each one to see what tags fired at each event.

Step 12: Go to your site, refresh the page and see if your new tag fired

Now go back to GTM, cancel Preview mode and click Submit.

Step 13: If the tag is firing in debug mode, leave this mode and click Submit

You will be prompted to add in any extra descriptive info you want here. So type in something like “GA pageview tag created”, and click Publish.

Step 14: Finally publish your container

And thats it! You are done!

Installing GA directly to your website

Ok there are a few micro-steps to get through to install GA/GTM. But it really is worth it. The alternative is to hard code the gtag.js code directly on to your site. You would do this if:

  • you did not want GTM on your site (some websites are ultra conservative about tools that allow you to inject code on to your site),
  • There is no in-built plugin for GA in your Content Management System (CMS).
  • You are a sadist …jokes 🙂

So how do we manually get code onto every page of our website? It is going to differ by platform. This is how we would do it in wordpress:

Go to Appearance > Editor and then open up your Theme Header file.

Paste the GTM code directly after the opening <body> in this file - simialr to the image below, taken from Monster Insights:

For more detail go here:

Obviously the exact method will depend on how your website is managed/created, but the concept will be the same.

And thats it… PHEW!

If you have any questions, do drop us a line. We are a business that works in this area, but we are still able to address any minor queries you might have. Alternatively if you have training or implementation work in relation to anything web analytics or digital marketing - drop us a line we’d love to help out!

More about Tribalism:

Here are some of the Implementation Services we offer:>

A guide to the various Training Sessions we run:>

A few of our client case studies:>