Advanced Google Analytics and other integrations with GTM and dataLayer

JD Leonard

While any site builder can quickly integrate Drupal with Google Analytics (GA) using the Google Analytics module, organizations are increasingly choosing to leverage Google Tag Manager (GTM) to integrate a variety of services (including GA) without requiring developer time and a deployment whenever new services or other changes are needed.

In this talk, we'll cover:

Setting up separate Google Analytics properties for production and non-production purposes
Configuring Google Tag Manager to provide different GA tracking IDs depending on the website's environment (e.g. Live, QA, and Local)
Installing and configuring the GoogleTagManager module and the dataLayer module to provide rich data about users and content in Drupal 8 or Drupal 9 to GTM
Configuring Google Tag Manager to pass the data from Drupal through to GA
While we'll use Google Analytics as an example, these same principles can be used to integrate Drupal with additional analytics, advertising, A/B testing and other platforms using GTM tag templates such as those natively supported by GTM and the hundreds contributed to the GTM Community Template Gallery.

Note that we will not be using the Google Analytics module, which directly integrates Drupal with GA.

Drupal is a registered trademark of Dries Buytaert.