Are you familiar with the Chinese proverb that says: “The best time to plant a tree was 20 years
ago. The second best time is now.”?
You may be wondering what that has to do with the context of this conversation. Well, trees
are like data sets in that they take time to grow. So, if you aren’t deploying tracking codes on
your website now you need to so when the time comes for analysis, optimization, and paid
advertising, you have the data you need.
In this article I’m going to review the essential codes every site needs to deploy, as well as the
ones that are optional but nice to have.
Before we begin:
Two of the biggest difficulties and barriers to entry with deploying tracking codes on your
1. Installing the codes
2. Managing the codes
Now, even if you have a developer on your team, constantly asking them to update codes and
coming up with a system for tracking the pages they’re on is a nuisance. Sure, in the beginning
all you need to really do is install the codes in the <head></head> of your website, but as you’ll see, you’ll want to have different tracking codes on specific pages you want to monitor, track or
Have no fear, Google has come to the rescue.
The Google Tag Manager (GTM) is the perfect way to easily deploy and modify tracking codes
for your website or application. Oh, and it’s free.
The tag manager is a single code that you or your developer will install in the <head></head> of your site. Then from within the manager you can add of the codes you want on your site.
This is great for many reasons, but here are a few you may find convincing:
1. Only one code on your site helps with site speed
2. Quickly add, pause, delete, or modify any code anywhere on your site from one place
3. You don’t need a developer and can deploy codes across multiple environments
(staging, dev, live)
Here’s a great article on how to easily install tracking pixels using the Google Tag Manager.I recommend you bookmark that article for when you’re ready to get it setup.
I won’t be getting into details about the GTM and best practices in this article, but feel free to
email me anytime at firstname.lastname@example.org and I’ll help you out. That being said, I will reference
how to deploy tags as if you are using the tag manager.
Note: If you’re using Shopify, I recommend using their functionality for installing the Facebook
Pixel and Google Analytics codes. Found at Online store > Preferences
Now to the good stuff…
There are a number of tags you will want to deploy on your site. Your CRM, email service provider, and conversational marketing tools will likely all have their own tags for you to use, but for the purposes of this article I’m going to discuss what I consider the “core” stack of codes everyone needs.
The Core Analytics Stack – did I mention they’re all free?
The core codes everyone needs are essential for analytics, audience segmentation, CRO (conversion rate optimization), and paid advertising.
In order to keep this article concise, I won’t be going in depth on how each tools work nor how to use them, so I’ve included additional reading at the bottom of each section.
Note: All tools in the core stack are free. I do mention some paid tools for your reference.
#1 Google Analytics – Universal Analytics
Google Analytics is perhaps the most important—yet often underappreciated—tag to have on your site. The tool is the best way to give you a holistic view of all the organic and paid traffic visiting your site. This information is unbelievably valuable in not only understanding who your users are, but how they flow through your site and engage with your content.
The data is useful for tracking the effectiveness of digital campaigns, yes, but it’s also immensely valuable in tracking offline events. For instance, if you attend a conference or sponsor a direct mail campaign, tracking the influx of visitors from those locations will help you understand your impact.
Now let’s get started…
Step 1: Create a Google Analytics Account
To setup Google Analytics visit analytics.google.com and setup an account.
You’ll then want to fill in your account and website information, as well as specifying your industry and time zone.
After you accept the terms you will see your tracking code.
Step 2: Add Google Analytics to the Google Tag Manager
Go to your Google Tag Manager dashboard and click on the “Add a new tag” button. Alternatively, you can click “Tags” in the sidebar and then click “New” in the top right.
Next you will need to configure the tag as well as the triggering event.
The triggering event is essentially when you want the Tag Manager to fire the tag to pass data along. For this, we’ll want the code to fire on “All Pages” so that every page sends data to Google Analytics.
For the tag configuration, you’ll want to select “Google Analytics – Universal Analytics.”
On the next screen you’ll want to leave the “Track Type” as page view, and then you’ll want to create a “New Variable” under the “Google Analytics Settings” dropdown.
This variable is your Google Analytics ID (beginning with UA-, not the entire tracking code). You set it as a variable that way you can easily reference it for any future tags you setup that use that Google Analytics account.
Also, go ahead and check the box under “Advertising” to enable display advertising features.
Once you save that and the variable is selected. You’ll need to select the “Triggering” event as “All Pages.”
Now you’re done configuring the tag! Name it, save it, and then publish the container. You’re good to go!
- What is Google Analytics, and why is it important to my business?
- Google Analytics for Startups: The 10 most valuable, most overlooked Analytics features.
#2 Google Ads – Remarketing
Now that you got the first one out of the way with Google Analytics, setting up the rest will be a breeze!
The next tag you’ll want to setup is for Google Ads (previously Google AdWords). The Remarketing tag is important for building and segmenting the audiences that you can advertise to (or exclude) within the Ads platform on Google Search, YouTube, and the Google Display Network.
If you aren’t sure what the channels above are or if you will need to advertise on them, trust me, you will.
Step 1: Create A Google Ads Account
Before you jump ahead and create your account, it’s important to note that Google will try to get you to setup a campaign before giving you access to your account. Follow my instructions below to avoid this.
Visit https://ads.google.com while logged into the same gmail account you used for Google Analytics. You’ll notice the screen is asking you about your main advertising goal. Ignore this and see below.
You’ll see some blue text that reads “Experienced with Google Ads?” Click that.
Next you’ll see that Google still wants you to setup a campaign. Underneath the campaign types you’ll see some blue text that reads “Create an account without a campaign.” Click that.
Almost done, confirm the details on the next page and then click “Explore Your Account” on the last page.
You’re in! Now click on the wrench in the top right that reads “Tools” and then select “Audience Manager” underneath “Shared Library.”
On this screen you’ll want to either click “Set Up An Audience Source” in the middle of the screen or click “Audience sources” in the left-hand sidebar.
On the next screen you’ll click “Set Up Tag” under “Google Ads tag.
Bonus: Link your Google Analytics and YouTube accounts here.
Next you’ll tell Google the type of data you want to collect. I recommend going with the second option and then selecting your business type(s).
From here you’ll select “Use Google Tag Manager” and then copy the conversion ID and hit “Continue.”
Now head on over to the Google Tag Manager and create a new tag. For this you’ll want to select Google Ads – Remarketing and have it trigger for all pages.
Save and publish, you’re done! If you head back over to the audience manager inside Google Ads you can create custom audiences based on the pages people visit, actions they take, etc. That’s outside of the scope of this article but see some reading below.
- Google Ads: What Are Google Ads & How Do They Work?
- 10 Common Mistakes When Setting Up Audiences In Adwords
- 4 Advanced AdWords Audience Targeting Tactics
#3 Facebook & Instagram—Pixel & Line of Business
All right, now we’re moving from one giant to another. The Facebook Pixel collects data to track conversions from Facebook ads, optimize ads with machine learning, build targeted audiences for future ads, and remarket to people who have already engaged with either your website, Facebook page, Facebook posts, or Instagram page.
In this we’re going to cover: setting up your Facebook Business Manager, your Facebook Pixel, and your Facebook Line of Business.
As a quick aside, the Line of Business is Facebook’s effort to provide a holistic view of attribution across your sales channels. Essentially, this means allowing advertisers to understand how their Facebook ads affect their Google ads, YouTube ads, etc. and visa versa.
With the Line of Business you can connect you pixel and other ad sources (google search, display, taboola, etc.) and it begins tracking the attribution of your ads. This is not something that is easily done, so bravo Facebook.
Step 1: Create A Facebook Business Manager
While you don’t need a business manager to run ads on Facebook, I highly recommend creating one. There are benefits to doing so, like setting up your Line of Business, managing and running ads for multiple pages and ad accounts, etc.
First, visit https://business.facebook.com/, click “Create Account” in the top right. Sign-in with your Facebook account and then meet me on the other side!
Step 2: Create and Setup Facebook Pixel
Once inside, feel free to setup all your settings, I won’t be covering that here. But once you’re ready, click the hamburger menu icon in the top left, hover over “All Tools >” and then click on “Pixels” underneath “Measure & Report.”
Next up click “Create a Pixel.”
Then name your pixel (name of your business), add your website URL, and click “Create.” Now it’s time to setup your pixel. You’ll have the option to connect it automatically through the Google Tag Manager, or install the pixel manually.
If you use Shopify, you’ll want to grab your pixel ID and add it to the “Preferences” section inside of your store.
Feel free to use the Google Tag Manager setup, but you can also follow the instructions below for doing it manually.
If you’re setting up the pixel manually, you’ll want to copy the entire pixel code on the next page and make sure “Automatic Advanced Matching” is enabled.
Now with that code head over to the Google Tag Manager to create a new tag. This time you’ll want to select the “Custom HTML” tag type.
Note: Tracking events (view content, lead, subscribe, checkout, purchase, etc.) with the Facebook Pixel is very important. By just installing the pixel you won’t be tracking these events until they are setup with trigger. You can do this yourself but there are plugins out there that make this easy. With Shopify it automatically tracks the standard events for you.
Now paste in your code, set it to trigger on all pages, name it, save it, publish it and you’re good to go! The Facebook Pixel is now live and tracking users on your site. Download the Facebook Pixel Helper chrome extension to verify your pixel is installed correctly.
Step 3: Setup Your Line of Business
Now that your pixel is setup you’ll want to create your Line of Business. Your Line of Business needs to be setup to start collecting data for attribution. You likely won’t be using this for a while if you’re just getting started, but you’ll be ahead of the game just by doing it.
Click on the hamburger menu icon again and select “Business Settings.”
Under “Accounts” select “Line of Business” and the click “Add.” From here you’ll add your business name and click “Create Line of Business.”
Once created, you’ll select “Add Assets” and then assign the pixels and ad accounts associated with that line of business.
You can come back to this in the future to assign more assets.
Now in the top right click “View in Attribution.” Confirm some settings and then activate your line of business.
From inside the attribution dashboard, click “Settings” in the top navigation.
Next you can add more pixels under “Data Sources” or other 3rd party Ad Platforms under “Ad Platforms.” Click on “Add a Platform” under “Ad Platforms” and connect anything else you’re using.
Feel free to come back to this in the future as you get more setup.
Phew! That was a lot, thanks for hanging in there. I promise it will all be worth it.
The Facebook Business Manager is how you manage ads on Facebook, Instagram, and the Audience Network (think Google Display Network). It’s an extremely powerful tool that allows you to show ads to millions of people with only a few clicks and all from behind your computer.
If you’re interested in learning more about running Facebook ads, feel free to contact me and check out the additional reading below. Otherwise, let’s move on to the last of the core codes!
- How to Use the Facebook Attribution Tool to Measure Your Marketing Impact
- The Perpetual Traffic Podcast
- Facebooks Ads Conversion Tracking: Should I Use Standard Events or Custom Conversions?
- How to Use Event Tracking in Facebook Analytics: Event Source Groups
#4 Hotjar – CRO
CRO stands for conversion rate optimization. It’s self-explanatory to a degree, it’s about using qualitative and quantitative data to test and optimize your web pages to improve the number of people taking the desired action of the page (conversion).
Desired actions can include purchasing a product, signing up for a service, or clicking on a link.
CRO is important because it increases the value of existing website traffic and users without the need for additional marketing costs, which can in turn reduce customer acquisition costs (CAC) and increase revenue per visitor (RPV).
I recommend using Hotjar because you can start collecting meaningful data in the form of heatmaps, clickmaps, scrollmaps, funnels, and session recordings all within their free plan. If you are managing multiple sites I suggest signing up as an “Agency” because you can create and manage multiple web properties from within a central account.
Step 1: Create A Hotjar Account
Visit https://www.Hotjar.com and sign up for free.
Step 2: Create A Hotjar Account
After you’ve added all of your account details you’ll need to setup your site an organization. Put the URL for the website you’ll be deploying Hotjar on.
Step 3: Setup Hotjar Tag in Google Tag Manager
To get Hotjar working on your site while deployed via the Tag Manager, you’ll need to grab you Site ID. The Site ID is in the top right of the panel that gives you the tracking code.
Now with the Site ID copied, head over to the GTM and create a new tag. Click the search icon in the top right and type in Hotjar.
Google has a predefine tag for Hotjar that makes it easy to install. Select the tag and paste in your Site ID.
Set the tag to trigger on all pages, name it, save it, publish it.
You’re all set! Hotjar is now ready to be used on your website.
Step 4: Setup Heatmaps and Session Recordings in Hotjar
Once you’re done, verify the tag is installed correctly and then setup Heatmaps on your key pages and enable visitor session recordings.
Feel free to play around with the other features, but definitely enable recordings and heatmaps.
You’ll want to use quantitative data (Google Analytics) alongside qualitative data (heatmaps, session recordings) to formulate hypotheses for improving the conversion rate of a page. Try and be scientific about it, it’ll help!
#5 Bonus: Other Helpful & Recommended Tags
You made it! You’ve successfully deployed the Google Tag Manager as well as the 4 core tracking codes. You can rest assured that when the time comes for you to start performing analysis on your site and driving traffic with paid ads, you’ll have the initial infrastructure laid to be successful.
Now, I want to be honest, those codes are essential, but they are only the beginning.
I encourage you to continue your education and reach out with any questions. Also, I’ve included a list of additional codes you may want to deploy on your site.
Take a look and best of luck with your business!
Highly Recommended Tags
- Google Ads Conversion Tracking
- You’ll set these tags up once you define conversions inside of your Google Ads account
- Conversion Linker
- Go ahead and enable this within your Google Tag Manager. You don’t need to sign up for anything, it just helps Google track conversions.
Other Social Platforms
- LinkedIn Insights
- This is used for running ads on LinkedIn
- Twitter Analytics
- This is for running ads on Twitter
- Pinterest Analytics
- This is for running ads on Pinterest and measuring engagement
- Snapchat Pixel
- This is for running ads on Snapchat
Other Display & Retargeting Platforms
- Yahoo Gemini Dot Tag
- This is for running ads on the Verizon-Yahoo network of websites
- Another native and display network with affordable, targeted traffic
- Great for paid syndication of blog posts on native and display
- Good for dynamic product retargeting ads
- Perfect Audience
- Same as Adroll but slightly different network
About the Author
Robert Schmidt is a professional problem solver and Fractional CTO, specializing in workforce software automation and digital marketing. He is Co-Founder at Alice.Design and a Zapier Certified Expert.