How to Install Google Analytics using Google Tag Manager

Google Tag Manager (GTM) is a tool that helps implementing scripts and managing tracking tags on a website. It is very easy to implement Google Analytics by yourself with GTM.

Before Starting

In order to install Google Analytics using Google Tag Manager, you first need to install Google Tag Manager to your website. Google Tag Manager is basically a system that once installed, it allows you to add whatever script you want to add your website without writing any code or asking any implementation from anyone. The best part is, it allows marketing people to work without getting bound on technical implementation in order to improve marketing scripts. You can follow this tutorial from Google in order to install GTM in your website.

Adding Google Analytics using GTM

We will simply deploy Google Analytics through Google Tag Manager by going over to the tags section and click on new.

Google Tag Manager Tags Section

Then we will give this a name. That is our Google Analytics pageview tag and we want to deploy this on all pages.

Google Tag Manager New Tag Section

Choose the Google Analytics - Universal Analytics option.

Google Tag Manager New Tag Options

As a track type we will choose pageview tag and we will configure our Google Analytics settings variable.

Google Tag Manager Track Type

Then we need to go on new variable and enter our tracking ID. You can find your tracking ID in your Google Analytics account, Admin > Tracking Info > Tracking Code.

You can leave the cookie domain on auto and give a proper name to this variable. It could be like that in below, or if you have multiple Google Analytics accounts you can enter your account ID as the name.

Google Tag Manager Tracking ID

Now we need to choose a trigger and this is where our Google Analytics code gets deployed. We want to deploy this tag on all pages so we can just choose the default All Pages. After selecting the trigger, you can save these all.

Google Tag Manager Triggering

Go to the preview debug mode to see if you have implemented your Analytics All Pages tag correctly.

Google Tag Manager Preview Debug Mode

Go back to our page and reload it. We should be able to see in the preview debug mode whether Google Analytics tags have been fired. It should be the same on every pages.

Google Tag Manager Summary

Google Tag Assistant

Google has developed a Chrome extension that allows you to see and debug GTM installation on a given page. You can download the extension here.

Google Tag Assistant

After installing the extension, we can check if our Google Analytics code was deployed correctly.

Google Tag Assistant Check Deployment

At this point, we have a pageview that is fired and we can also check our Google Analytics account in the real time reporting to see whether the data is coming through.

Google Tag Assistant Check Fired Pageview

Once you made sure that your data is correctly deployed through Google Tag Manager, we need to go to the last step of publishing the changes by clicking the Submit button. You can describe what you have done and give a name to the Version such as “Google Analytics code implementation”, and then click on the Publish button.

Google Tag Assistant Submit Changes

Now we will be able see our Google Analytics tag even without the preview mode.

What now?

At this point, you should have a working GTM installation on your website, which would allow you to install various scripts such as Google Analytics, Facebook Tracking Pixel and many other marketing codes without implementing anything from the technical side, which allows you to have a freedom without being bound by engineering part. After you successfully install Google Analytics using Google Tag Manager, you can give our top 5 useful Google Analytics reports a look to get started with Google Analytics.