-
Notifications
You must be signed in to change notification settings - Fork 13
Google Tag Manager
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.
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 |
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.
- Redux Glossary
- Why Redux Toolkit?
- Writing state slices with Redux Toolkit
- Handling action side effects in Redux
- Presentational and Container Components
- Scoped actions and reducers
- Server Side Rendering
- Form validation
- CI build process
- Post deployment testing
- Post deployment test runbook
- TIP Real User Testing
- Code testing and validation
- Visual testing
- Testing Apple Pay locally
- Test Users
- Deploying to CODE
- Automated IT tests
- Deploying Fastly VCL Snippets
- Archived Components
- Authentication
- Switchboard
- How to make a fake contribution
- The epic and banner
- Environments
- Tech stack
- Supported browsers
- Contributions Internationalisation
- Payment method internationalisation in Guardian Weekly
- Print fulfilment/delivery
- Updating the acquisitions model
- Runscope testing
- Scala Steward for dependency management
- Alarm Investigations
- Ticker data
- Ophan
- Quantum Metric
- [Google Tag Manager] (https://github.com/guardian/support-frontend/wiki/Google-Tag-Manager)