Playbook
minute read
Completed [date]

Project: GTM

Learning Objectives

What you’ll be doing

  • Creating a Google Tag Manager account
  • Configuring GTM
  • Adding GTM to your site
  • Add pixels using GTM

Who is this project for?

This project is meant for students that do everything themselves, has no coding background, and/or has limited access to engineers. We'll show you the quick way to set up conversion tracking on simple websites and landing pages. You'll set up GTM yourself from scratch: configure triggers, add tags, and verify everything is working.

Don't worry if you don't get everything right the first time around (that's normal). Phase 5 will show you how to debug and verify the setup.

Phase 1: Setup

If you haven’t already, you’ll need to create a GTM account. Head to the GTM website. Create an account and create a container.

There’s a snippet of code you’ll have to put on your site. Add it to the codebase yourself, or ask your engineers to add it.

Phase 2: Create variables

Once the account is created, you’ll want to configure the variables and triggers you’ll be using to add all the tags to your site.

We’ll do this configuration in a bit of a weird order: built-in variables, triggers, and finally user-defined variables. You’ll need the built-in variables for the other two, and it’s easiest to spec out the user-defined variables after doing defining the triggers.

2a. Built-in Variables

As a reminder, these are variables that GTM generates automatically, but you still need to tell GTM to create them.

  1. Go to Variables tab in GTM
  2. Under Built-In Variables click Configure
  3. Select all those you’ll need. We generally enable:
  4. Everything under Pages
  5. Everything under Clicks
  6. Everything under Forms
  7. And Event under Utilities
  8. Exit
  9. You can now use these variables throughout your tags and triggers

2b. User-Defined Variables

As a reminder, user-defined variables are things like email addresses and first names that change every time someone comes to your site. You want to dynamically pass them from your site to GTM.

Google Ads Conversion ID

As an example of a static variable, we’ll configure your Google Ads Conversion ID to be used for every Google Ads conversion event.

  1. Go to Variables tab
  2. Click New under User-Defined Variables
  3. Name the variable Google Ads Conversion ID
  4. Start Variable Configuration and choose Constant
  5. To do this, open a new tab. Then…
  6. In your Google Ads account, click the Tools, Billing, and Settings menu (the wrench).
  7. Select Measurement: Conversions, which opens to the Conversion Actions table.
  8. Select the name of the conversion that you want to use from the Name column.
  9. Expand the tab for Tag setup to view the tag details.
  10. Select Use Google Tag Manager card.
  11. Copy the Conversion ID. (See Google’s help for more step-by-step)
  12. Paste the value of your Google Conversion ID into the space in GTM.
  13. Hit Save

Dynamic variables

Dynamic variables go beyond the scope of this project and will require an engineer's input. If you'd like to add dynamic variables, see Conversion Tracking > Project: Delegate to Engineers.

Phase 3: Add Google Analytics

Now you’ll want to add GA to every page of your site, and to record every page view.

Initial setup

  1. Head back to the GTM Tags dashboard. Hit “New.”
  2. In “Tag configuration”, click Google Analytics: GA4 Configuration
  3. Name it GA – Page View
  4. Add your Measurement ID
  5. Expand Advanced Settings
  6. Set Tag firing priority to something really high, like 1000, because you want this firing before everything else. That way, GA boots up before any other code runs on the page — and you don’t lose tracking.
  7. Make sure Tag firing options is set to once per event (you don’t want to record duplicate page views)
  8. Add a trigger for All Pages
  9. Save

Events/Conversions

  1. Create a Tag for each event
  2. Use Google Analytics: GA4 Event
  3. Set the appropriate Trigger for that event
  4. Name it in a format like GA4 – [event]
  5. Enter the event name (from the list of approved event names)
  6. Set any additional parameters (ex: revenue)

Phase 4: Adding pixels and tools

Some of the channels and third-party tools have useful integrations that make them easier to add to your site. It also means you don’t have to touch any code. We'll first add Google Ads and Hotjar.

4a. Google Ads

Instead of adding code manually, I definitely recommend using the Google Ads integration since it hides away code you’d have to write, and it’ll always be up to date with the latest changes Google makes.

There are three kinds of Google Ads tags you need to add to get it all working:

  • Conversion Linker
  • Conversion Tracking
  • Remarketing

4a - i. Conversion Linker

The Conversion Linker tag is an oddity that you need to add for Google Ads conversion tracking to work properly.

Basically, it helps store data from the visitor’s click from a Google Ads ad, and without it, conversion tracking for Google Ads won’t work.Add the tag and set it to trigger on All Pages.

4a - ii. Conversion Tracking

Create one of these for each conversion event.

You'll need to do:

  1. Create a Tag for each event
  2. Use Google Ads Conversion Tracking
  3. Set the appropriate Trigger for that event
  4. Name it in a format like Google Ads – [event]
  5. Enter the Conversion ID variable
  6. Add the corresponding Conversion Label
  7. Set any additional parameters (ex: revenue)

4a - iii. Remarketing

Adding a remarketing tag allows you to manage remarketing lists in Google Ads. These are lists of people who did something specific on your site, like visiting a page or subscribing to your newsletter.

We’ll be using these later when we set up ads.

  1. In new tag configuration, click Google Ads Remarketing
  2. Enter the Conversion ID variable
  3. Configure the rest (ping us if this isn't clear)
  4. If this is for a general site visit, leave Conversion Label blank and set the trigger to All Pages
    1. If this is for a specific conversion event, add the corresponding Conversion Label and then set the trigger to the corresponding event.
  5. Save and repeat for every other event you wish to create a remarketing list for.

4b. Hotjar

You’re going to be using Hotjar for heatmaps and user recording (which we strongly recommend to learn how users are using your site). Add it in using the built-in integration.

  1. Make an account on Hotjar if you don’t have one yet.
  2. In GTM, in new tag configuration, click Hotjar.
  3. Name it Hotjar
  4. Add your Hotjar Site ID
  5. Trigger it on All Pages
  6. Save!

4c. LinkedIn, Quora

LI and Quora have their own native integrations with GTM. You'll just need to supply your Partner ID for LinkedIn, and your Pixel ID for Quora. You can find those on their respective platforms in your account.

  1. In new tag configuration, search for LinkedIn or Quora
  2. Supply your ID
  3. Set the Triggering to All Pages
  4. Name your tag LinkedIn – Base Pixel or Quora – Base Pixel
  5. Save!

4d. Custom: Facebook, Pinterest, Snapchat, other

Some channels don't have a native GTM integration, so we'll need to install their pixels manually. Open your doc from Conversion Tracking > Project: Conversion Events ****where you had copied over all your ad channels' pixels.The process is the same for all of them: set up a custom tag, and have it fire on every page. Let's do FB as an example.

  1. In GTM > Tags. Click New
  2. Click Tag Configuration, and choose Custom HTML
  3. Copy/paste the pixel code snippet you have for the ad channel. For FB, it would look something like: <!-- Facebook Pixel Code --><script> !function(f,b,e,v,n,t,s) {if(f.fbq)return;n=f.fbq=function(){n.callMethod? n.callMethod.apply(n,arguments):n.queue.push(arguments)}; if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; n.queue=[];t=b.createElement(e);t.async=!0; t.src=v;s=b.getElementsByTagName(e)[0]; s.parentNode.insertBefore(t,s)}(window, document,'script', '<https://connect.facebook.net/en_US/fbevents.js>'); fbq('init', '9999999999999999'); fbq('track', 'PageView');</script><noscript><img height="1" width="1" style="display:none" src="<https://www.facebook.com/tr?id=781779825551730&ev=PageView&noscript=1>"/></noscript><!-- End Facebook Pixel Code -->
  4. Under Triggering choose All Pages
  5. Name your Tag {{Ad Channel}} – Base Pixel (e.g. FB – Base Pixel, Pinterest – Base Pixel, etc)
  6. Click Save
  7. Repeat for all your other ad channels

Phase 5: Add triggers, verify, and publish

We'll now add the triggers to detect when people click a specific button, submits a form, or views a key page. When those triggers fire, we want to report that event to the ad channels and analytics platforms we had set up earlier.

Before you begin, download the Chrome Extensions below. We'll use them in the video to verify if all the pixels and events are firing properly at the end.

Watch the video tutorial in Conversion Tracking - Advanced > Video: GTM Tracking.

Common mistakes

  • When setting up triggers based on a CSS Class or ID, make sure you input the exact value (no quotation marks, case sensitive).
  • Multiple triggers firing? Make sure the CSS Class or ID you chose to identify your form/button is unique to that element. It's best to use the element's ID if it's unique. If not, try using Click URL as the trigger instead of a CSS Class or ID.
  • Page path vs Page URL: Page path returns only the relative path of the page  (/about) whereas Page URL returns the entire address (www.yoursite.com/about)
  • Form submissions: When setting up the trigger, make sure you're basing the CSS/ID off the form itself and not a submit button that happens to be part of the form element. In the video, we're basing the trigger on Clicks, but basing it off of a Form Submission trigger is just as valid.
  • When verifying events from your GA4 dashboard, please note that it can take 24 hours before events will appear. Once you see the event, don't forget to toggle it on as a conversion event.

Next steps

Congratulations! If you've run through all the verification steps and published everything successfully, then you've completed the Conversion Tracking module. You're good to move on to the next module in the course.

Open search