How to Setup Google Analytics for Any Website (Google Tag Manager Too)

How to Setup Google Analytics for Any Website (Google Tag Manager Too)

First step in getting started with Google Analytics is installing the tracking code on your website. It can either be a simple integration or a more robust one, up to your level of experience. 

For starters, here are the most basic guidelines of setting up Google Analytics. 

  1. Set up a Google Analytics account here. 
  2. Create a property in your account. A property will be your website or company name. Just to give you a frame of reference, this is most useful for agencies managing multiple websites. You will be using the property’s Tracking ID later in the installation process as this is the location you want data to flow into. 
  3. Create a view within the property. A property can have multiple views where each one is filtered differently. As data flows into the property, it will be “filtered” into the appropriate view you create. Let’s just do a simple one here with no filter. Best practice is to always do a clean view with no filter, and add additional views as needed
  4. Then, head to your account’s Admin settings on the bottom left of the homepage. 
  5. Under Property, click on “Tracking Info” > “Tracking Code”
  6. Copy your Tracking ID and insert replace "UA-XXXXX-Y" in the code below.

<!-- Google Analytics -->



(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),



ga('create', 'UA-XXXXX-Y', 'auto');

ga('send', 'pageview');


<!-- End Google Analytics -->

  1. You’ll then apply this code to every page of your website in the <head> section.

And you’re done. You’ll now have data rolling into your Google Analytics account for all page views. But if you’d like to customize your analytics even further, like track specific button clicks, Google Tag Manager will be your best bet. 

What is the difference between Google Analytics and Google Tag Manager? 

Google Analytics is the hub where all the data is stored, so you can generate reports about your website activity. Consequently, Google Tag Manager is the tool used to send that data more easily to Google Analytics with less code manipulation. You can either use them in tandem or just Google Analytics. 

The installation and maintenance process is what makes people use both.  

They both require the basic tracking code to be installed in the <head> of each page. Where it gets tricky is when you want to track more than just page views. This can include all types of events (aka engagement indicators).

Google Analytics requires you to insert individual code snippets for each event, wherever you’d like to track them in the website itself. But be wary, as this requires high maintenance to make sure details are not overlooked. 

Google Tag Manager is at an advantage here where most intermediate analytics can be setup through an easy-to-use interface. There are a few more additional steps to get the basic page tracking, but everything else is much easier through Google Tag Manager. Few clicks you’ve set up an event that occurs on similar pages, whereas this would have been done manually on each page if you only used Google Analytics. 

How to Setup Google Tag Manager

There are tons of documentation on specific Google Tag Manager needs, but I’ll give you instructions on how to get started. 

  1. Create a Google Tag Manager account. 
  2. Then, create an account within your Google Tag Manager account with your domain and selecting “Web” for your website. 
  3. After you’ve done that, it’ll give you a snippet to insert into the <head> section of every webpage. 

Now, let’s go back into your Google Tag Manager account. 

  1. Head over to Variables on the top left menu
  2. Click on “Configure Built-on Variables” and select all the variables. This is just good, so in case you need to refer to any default ones to create tags later, it’ll be easier. 
  3. Scroll down and click on “New” to create a variable for your Tracking ID (remember it’s in the Admin settings > Property > Tracking Code > Tracking ID) 
  4. Select “Variable Type” as Constant and paste your Tracking ID in. Label it “Tracking ID” or whichever is easiest for you to remember.

Once that’s set, go over to “Triggers” on the left menu.  

  1. You should see that you have a “Page Views” trigger already set up. If not, click on “New.” Select the “Trigger Type” as Page View and select “All Page Views.”

Lastly, head over to “Tags” on the left menu. 

  1. Create a New Tag and click into “Tag Configuration” box as a side panel will slide in. Select “Universal Analytics”
  2. Keep the “Track Type” as Page View
  3. Check off the box “Enable Overriding settings in this tag” and a text box will appear. Type in “{{Tracking ID}} and this will pull your tracking ID automatically. Now all the page view data will roll into your Property (Google Analytics website account) seamlessly. 

Again, this was a few more steps than just inserting the main Google Analytics tracking code on every page, but for future analytics implementation, it will be much easier. Trust me. 

The Basics on Creating Google Tag Manager Tags 

The same process as the page view tag applies to other tags you want to create. 

  1. Create the base, the Variable and tell Google Tag Manager what to look out for in the code (aka Data Layer). The basic variables are covered in the Built-In Configuration, but if you have a much more specific ask, refer to the additional resources below for help or “Google” it. 
  2. Filter out the base variable to identify the exact event you want to track ie a “Sign Up button.”
  3. Label the tag’s parameters to organize how the data will flow into your Google Analytics account. 

Additional Resources:

How to Add Google Analytics Events to Tag Manager

Google Tag Manager Video Tracking Guide

Facebook Pixel

Quick References to Install for Website Builders:

For the businesses that use website builders, here are a few simple steps on where to place the Google Analytics tracking code for simple page tracking. 

Adding Google Analytics Tracking ID to Wix
Using Google Analytics with Squarespace

Google Analytics Setup for Wordpress

Looking for more personalized help with Google Analytics or Google Data Studio?