Skip to content

Google Tag Manager

George Haberis edited this page Jan 2, 2024 · 4 revisions

We use Google Tag Manager for managing a number of third party tags on the support site. Google Tag Manager (GTM) is a free tool provided by Google that allows website owners to manage and deploy various types of tags on their websites without having to modify the site code directly. Tags are snippets of code or tracking pixels that collect data and send it to third-party tools, such as analytics platforms, advertising platforms, or other marketing tools.

Benefits of using Tag Manager include:

  • Granular consent checks for each tag.
  • Tag configuration accessible to non-engineers.
  • Tag version history is available through the GTM console.
  • GTM preview mode is available, which is useful for debugging.

Active Tags in GTM

Name Description Type Triggers Exception
AdWords Conversion Linker Conversion linker tags are used to help tags measure click data so that conversions are measured effectively. Deploy a conversion linker tag on any page where visitors may land after they click an ad or promotion. AdWords Conversion Linker All Pages - DataLayerReady (Custom Event) vendorConsentsLookup - Google Ads
AdWords Conversion Tracking - Paper Google Ads conversion tags help to build reports that show you what happens after a customer clicks on your ads. Google Ads Conversion Tracking Paper Checkout - SuccessfulConversion (Custom Event) vendorConsentsLookup - Google Ads
AdWords Conversion Tracking - Guardian Weekly Google Ads conversion tags help to build reports that show you what happens after a customer clicks on your ads. Google Ads Conversion Tracking Weekly Checkout - SuccessfulConversion (Custom Event) vendorConsentsLookup - Google Ads
AdWords Conversion Tracking - Single Contribution Google Ads conversion tags help to build reports that show you what happens after a customer clicks on your ads. Google Ads Conversion Tracking Single Contribution - SuccessfulConversion (Custom Event) vendorConsentsLookup - Google Ads
AdWords Conversion Tracking - Monthly Contribution Google Ads conversion tags help to build reports that show you what happens after a customer clicks on your ads. Google Ads Conversion Tracking Monthly Contribution - SuccessfulConversion (Custom Event) vendorConsentsLookup - Google Ads
AdWords Conversion Tracking - Annual Contribution Google Ads conversion tags help to build reports that show you what happens after a customer clicks on your ads. Google Ads Conversion Tracking Annual Contribution - SuccessfulConversion (Custom Event) vendorConsentsLookup - Google Ads
AdWords Remarketing Enable basic remarketing to re-engage with potential customers by adding your website and app visitors to remarketing lists Google Ads Remarketing All Pages - DataLayerReady / Client side page load (via gtm.historyChange) vendorConsentsLookup - Google Ads
GA Base Tag Google Analytics tag Google Analytics: Universal Analytics All Pages - DataLayerReady / Client side page load (via gtm.historyChange) vendorConsentsLookup - Google Analytics
GA Event Google Analytics event tracking Google Analytics: Universal Analytics GAEvent vendorConsentsLookup - Google Analytics
Twitter Universal Website Tag Twitter Universal Website Tag Twitter Universal Website Tag All Pages - DataLayerReady / Client side page load (via gtm.historyChange) vendorConsentsLookup - Twitter

Managing User Consent

Logic for pushing events sits in the googleTagManager.ts module. On page load we interrogate a users consents via the CMP, based on their consents we set the value of vendorConsentsLookup to be a comma delimited string of vendor names (eg. "google-analytics") that have had consent granted to them. This variable vendorConsentsLookup is pushed to Google Tag Manager (GTM), and will look something like "google-analytics,twitter,bing".

In GTM we set a conditional check for each tag that must be met for the tag to be enabled. We have the ability to use a regular expression as part of this condition. For each tag we can therefore query vendorConsentsLookup in GTM using a regular expression. Eg. For Google Analytics to run we check the condition vendorConsentsLookup.match(new RegExp("(?:^|,)"+"google-analytics"+"(?:,|$)")). GTM uses javascript regular expression syntax.

πŸ™‹β€β™€οΈ General Information

🎨 Client-side 101

βš›οΈ React+Redux

πŸ’° Payment methods

πŸŽ› Deployment & Testing

πŸ“Š AB Testing

🚧 Helper Components

πŸ“š Other Reference

1️⃣ Quickstarts

πŸ›€οΈ Tracking

Clone this wiki locally