Skip to main content

Google Tag Manager

Google Tag Manager (GTM) enables you to run and manage fragments of client-side code on a website. It provides a way to abstract third-party integrations away from the core front-end code of the site itself and approach things in a consistent way across a variety of web properties.

GTM is based around the idea of 'containers' - essentially wrappers for running code snippets ('tags') when certain conditions are met ('triggers'), picking up variables from the website (usually via the data layer) as necessary.

There are two types of GTM 'container'.

  • Web: This is the traditional form of GTM, where all of the managed code executes on the client browser or device and information is passed directly to third-party clients like Google Analytics or Facebook. Official documentation.

  • Server-Side: This is a newer approach in which the container executes on a server application running on your own Google Cloud Platform. As summarised by Simo Ahava in his server side tagging post "the purpose of this setup is to create an endpoint in a server environment that you own. It will act as a sort of a proxy between the hits sent from browsers and devices and the actual endpoints to which the hits are collected." Official documentation.

Site developers / team members will never be directly involved with the server-side container

How do I create a web GTM container for my project?

Firstly, please ensure there is not already a suitable GTM container setup for you to use. By navigating to https://tagmanager.google.com you will be able to see any GTM web containers that you currently have access to.

Creating a new container can be done as follows:

  1. Navigate to https://tagmanager.google.com
  2. Add your web container by clicking on the 'Create Account' button or the 'Create Container' link in an account dropdown if there is an account relevant to your product already visible to you
  3. Choose 'Web' as the type of container
  4. Following the instructions provided thereafter to add the necessary GTM loading script to your application