Data is the foundation of making good decisions. Without good actionable data, you can’t make decisions on your marketing spend, content tracking, User Experience (UX), SEO, and on and on.
It’s important that you get this right since it is the foundational bedrock of everything that comes afterwards.
Say what you will about Google’s tracking and privacy issues. I won’t disagree with you. BUT if you’re running a website, you have to use some of their products if you want to scale to any level at all. Today I’m going to talk to you about setting up tracking on your website the *correct* way.
But first. Here’s the things that you shouldn’t do when setting up tracking.
- Don’t rely on WordPress/Jetpack analytics or any service except for Google Analytics. Why? It’s free, best in class technology, easy to use, and it’s estimated that 85% of websites use it.
- Don’t use Monster Insights or any 3rd party to implement Google Analytics (GA), Google Tag Manager (GTM), or verifying Google Search Console (GSC). Why? See below.
- Don’t install GA on your site. GTM should be installed on your site and let GTM implement GA. Why? GTM can build a data layer better allowing you to track absolutely everything on your site without dev work.
- Don’t install marketing tags or anything else directly on your site. Allow GTM to implement. GTM allows you to implement and test a lot marketing tags and event tracking in real time without having to worry about building a test environment.
There is one caveat to the above rules. If you’re setting up GA for Shopify, you want to let Shopify implement your GA. Shopify builds an “enhanced e-commerce” data layer that is difficult to build in GTM, so you should just let Shopify do it. This will be explained in further detail below.
Table of contents
- Create a Google Tag Manager Account
- Create a Google Analytics Account
- Install Site Kit by Google
- Connect Site Kit to GA, GTM & GSC
- Implement Everything via GTM
- Implement Basic Google Analytics Tracking
- Implement Page Scroll Tracking
- Implement Link Click Event Tracking
- Implement Social Pixels/Marketing Tags
- Learning How Your Martech Stack Works
Create a Google Tag Manager Account
While the front end is impressive, the back end is more so. The back end’s User Interface allows you to *almost* replace your front end developers when it comes to tracking/tagging. It’s a click and build way to add a data layer, event listeners, triggers, etc to your site without coding. It does the coding for you.
These events and triggers will allow you to capture more data to give you more insight to your marketing initiatives.
Go to https://tagmanager.google.com to create an account and container. Click “Create Account”. Do this with an email that you’re going to have as long as you have the site and will be used for GA and other things.
1 email can have many accounts and 1 account can have many containers. Here’s what my person setup looks like.
Create a Google Analytics Account
Go to https://analytics.google.com and click “Start Measuring”. Follow the screens below.
Be sure, on the second image below, to click “Create a Universal Analytics property”. Google is trying to push GA4 when the product isn’t ready yet. Even my own Google reps readily admit that GA4 isn’t ready to be a replacement for Universal Analytics. Yet for some reason, their UI is wanting you to bypass Universal Analytics.
Create both accounts right now but don’t bother even looking inside GA4 at the moment. Just let it collect data so you have the historical data when it is useful.
Step 3 is just Google collecting information so it doesn’t matter what you put.
Install Site Kit by Google
Now that you have GA and GTM, it’s time to install the Site Kit plug in. This is the official plug in from Google for WordPress. It’ll make sure that the code is implemented on your site correctly.
Connect Site Kit to GA, GTM & GSC
Now that it’s installed, it’s time to connect everything. Go to Site Kit’s settings and connect your GA, GTM, and Google Search Console. You likely don’t have a GSC yet so it will walk you through setting it up. Make sure you set up your GSC the same way that the rest of your site is set up in terms of URL structure.
Be absolutely sure that you tell Site Kit to not insert the snippet for GA. We’ll be using GTM to implement the snippet.
Implement Everything via GTM
There’s a million and one things you can track on your website utilizing GTM. Below, I’m going to show you how to set up basic Google Analytics, page scroll tracking, affiliate link tracking, and social pixels.
Implement Basic Google Analytics Tracking
This is arguably a little more difficult compared to having Site Kit implement it. However, it’ll be the foundation of being able to track more advanced things like page scrolling, affiliate link clicks, videos watched, etc.
Basic GA & GTM for Shopify
As I said above, Shopify sets up the enhanced e-commerce data layer and funnels for you, so you should go with their install method. You should also install GTM so that you can implement pixels(marketing tags) and events that will be used to better track your audience.
Keep this tab open. We’ll come back to this.
Now go to your Google Analytics account that you created earlier. Go to admin in the bottom left. Under properties, click “tracking info” then “tracking code”. You’ll see a code that looks like “UA-XXXXXXXX-1. UA stands for Universal Analytics. Leave that tab open.
Now log into Shopify in another tab. Under “Online Store” then “Preferences”, you’ll find a box for Google Analytics. Implement your UA code from Google Analytics OR the gtag.js script from Google Analytics in the below box. Click save.
Done! Now you have GTM, GA, and enhanced e-commerce set up on your Shopify site. (Don’t forget to actually turn on enhanced e-commerce in the GA settings…) Below we’ll get to some event tracking. It’s the same as WordPress, so bare with me while I go through getting the basics set up for WordPress.
Basic GA for WordPress
You’re going to find your Universal Analytics code just like the Shopify section but you’ll be implementing this code in GTM.
Create a Google Analytics Variable
You should create this variable no matter what platform you’re on since it’ll be used in all other tags. Click on “Variables” on the left then “New” under “User-Defined Variables”. Build out the variable in the picture below. Input your Universal Analytics tracking code in the red box. Then save. Note that you will have no references to the trigger yet. It will be blank.
Create Universal Analytics Tag
Click on “Tags” then “New”. Set up the Tag Configuration and Triggering.
Click “Save” then “Publish” in the top right hand corner. “Publish” makes what ever changes you did in GTM live on your site. As soon as that GTM JS loads, it will inject whatever code or changes onto your site.
For this reason, you should always “Preview” your changes with Google Tag Assistant to make sure everything is working properly. Test it out for fun but this is a simple tag that hopefully you don’t screw up.
GA4 For All Platforms
Setting up GA4 in GTM is just like setting up Universal Analytics in the “Create Universal Analytics Tag” section above. The difference being you need to go into the GA4 property in GA and get a Measurement ID instead of a Universal Analytics ID.
Go to your GA4 property -> Data Streams -> Click on or create Data Stream -> copy Measurement ID in top right
Go back to GTM and click Tags -> New -> Set up like below and “Publish” when done.
Implement Page Scroll Tracking
Why track page scrolling? I could write an essay on the subject but to be short, you want to know what your users are doing on your site. If a page has a high bounce rate, are they leaving immediately or scrolling to the end before they leave? Do they even get to see your CTA or is your CTA not working?
Page Scroll Tracking Variable
Go to Variables -> “Configure” in the built in variables section -> Make sure “Scroll Depth Threshold” and “Scroll Depth Units” are checked and save.
Page Scroll Tracking Trigger
Go to “Triggers” on the left -> “New” trigger -> Set up like below. Note that your “References to this Trigger” will be empty at the moment.
Page Scroll Tracking Tag
Go to “Tags” on the left -> “New” tag -> Set up like below. Once saved, “Submit/Publish” the container.
Implement Link Click Event Tracking
If you’re running an e-commerce site, you can skip this one. This is *mostly* utilized for measuring outbound links to affiliates or for lead generation purposes. Although, I have implemented this on every single link click on my site to really get granular on whether users are clicking on links that expand a popup box or change the option of a default product.
On this site, I have all affiliate links getting redirected through a bowtiedopossum.com/go/affiliate URL. I do that for a few reasons.
It’s prettier. I actually use the plugin called “pretty links”. It also makes it easy to set up a a trigger that only looks for links that contain “go”. This way, I’m not tracking outbound links to Google, WordPress and other external links.
Link Click Trigger
Go to “Triggers” -> “New” trigger. Below is how I have it set up but if you want to track all outbound links, look at the second picture. Again, you won’t have references to this trigger yet and I’m not going to walk you through the GA4 event in this article. It’s similar though.
Link Click Event
Go to “Tags” on the left -> “New” tag -> Set up like below. Once saved, “Submit/Publish” the container.
Implement Social Pixels/Marketing Tags
Your experience may vary depending on the marketing tag that you want to implement on your site. I’m going to show you how to install the Reddit tag on one of my Shopify stores, but all of the Tags come down to 3 basic steps.
Variable – Your unique ID for the marketing tag. You create a variable so you don’t have to type it in every time you want to use it. Instead of “kjlsdlfsd-1” it’s “Reddit ID”. Tags reference this variable.
Trigger – What *Event* do you want the tag to fire on. Pageview, Add to Cart, Purchase, etc.
Tags – Where you want to send the data to.
Marketing Pixel Variable
Go to Variables -> “New” in the User-Defined variables section -> Set up like below and save.
Marketing Pixel Trigger
Go to “Triggers” -> “New” trigger -> Set up like below and hit save. Note that this is for purchase.
Marketing Pixel Tag
Go to “Tags” -> “New” tag -> Set up like below and hit save then “Submit/Publish”. You should likely be setting up a pageview tag which is image #2.
Learning How Your Martech Stack Works
Now that you have everything setup, you should check out the guides on The Basics of Google Search Console and The Basics of Google Analytics. They walk you through how to get the settings correct in the UI (User Interface) and they basics of how to use them.
Lastly, here’s some things that you should know about your stack.
- GTM can inject any code on your website. Even malicious code. Be very careful who you give access to.
- Read the documentation of your tools and go through every setting in your tools.
- Don’t know what something means? Not like “I vaguely know what it means”. If you don’t know *exactly* what something means, Google the hell out of it. It should take you months to fully understand 50% of the capabilities of the above tools. I’ve been at it for years and I’m only at 90%.
- Data is great but the context of the data is what makes it meaningful.
- Google Analytics and Google Tag Manager are not as simple as people believe. They’re enormously powerful if you *really* know how to use them.
- You cannot make good decisions without analyzing accurate data. You cannot analyze accurate data unless you have accurate data. You cannot have accurate data unless you put the tools in place correctly.
When you finally decide to get smarter about all things digital and get your first second income stream built to make that WiFi Money. You need to sign up for my Substack below. Start with the article on Your Path to WiFi Money.
If you're looking at how to start your own website, I've created an easy guide for that too.