Deutsch

Google Tag Manager (GTM) is a tag management system. It lets you set up and manage tags such as analytics or ad tracking on a website without changing the site’s code each time. For SEO it matters as a measurement tool and as a possible source of errors.

How does Google Tag Manager work?

You add two code snippets to your pages once. Everything else is configured in the GTM web interface. Four building blocks work together.

  • Container holds all tags, triggers and variables for a site or app.
  • Tags are the managed code snippets, for example a Google Analytics measurement.
  • Triggers are conditions that make a tag fire when certain events occur.
  • Variables supply values that tags and triggers use.

GTM manages tag deployment. Google Analytics is a separate product that reports the data.

The data layer

The data layer is an object that GTM uses to pass information to tags. Your site can push an event into it, and a trigger in the container reacts to that event.

What it means for SEO

GTM is often used to set up measurement such as key events in Google Analytics without a code release, which supports conversion tracking and reporting.

It can also output page elements through JavaScript. Google can process titles and canonical tags set that way, but advises against changing the canonical URL via JavaScript to something other than the one given in the original HTML. A noindex in the HTML may stop Google from rendering the page, so removing it with JavaScript may not work. SEO-relevant elements are safer in the delivered HTML (assessment).

Tests by searchVIU (2017) checked which page elements Google picks up when they are injected through GTM. Google processed hreflang, canonical and noindex tags, titles, meta descriptions and internal links. Google itself still names the served HTML as the best place for the canonical and doesn’t recommend setting it with JavaScript.

GTM supports consent mode with four consent types: ad_storage, analytics_storage, ad_user_data and ad_personalization. A Consent Initialization trigger makes sure consent settings are applied before other triggers fire.

Example

A form pushes an event to the data layer when it is submitted.

Code
window.dataLayer = window.dataLayer || [];
dataLayer.push({'event': 'form_submitted'});

A trigger in GTM listens for form_submitted and fires a tag that sends the measurement to Google Analytics.

FAQ

What does Google Tag Manager do? It deploys and manages tags on a website from a web interface instead of the site’s source code.

Is Google Tag Manager the same as Google Analytics? No. GTM delivers tags. Analytics collects and reports the data.

Sources

  1. About Tag Manager – Tag Manager Helpsupport.google.com
  2. Consent mode in Tag Manager – Tag Manager Helpsupport.google.com
  3. The data layer – Tag Platform documentationdevelopers.google.com
  4. JavaScript SEO basics – Google Search Centraldevelopers.google.com
  5. Google Tag Manager – Semrush Blog (secondary)semrush.com
  6. More JavaScript SEO experiments with Google Tag Manager – searchVIU blog (2017)searchviu.com
  7. How to implement hreflang with Google Tag Manager – searchVIU blog (2017)searchviu.com

Last updated: