Don't have one? Create one ↗
Work with real data

Hands-on module

Variables that shape data

Pick how you'll read data, then reach into the dataLayer and the DOM and clean and map values with tables and custom JS.

Real data is rarely GA4-shaped. This module is about reading it wherever it lives, the dataLayer, the DOM, cookies and web storage, and then cleaning and mapping it with GTM's variable types so your tags get exactly the values they need.

You'll read nested dataLayer values with dot notation, scrape the DOM, normalise messy strings with Custom JavaScript, bucket values with Lookup and RegEx tables, read cookies and storage, and reshape a whole order into GA4's items array.

What you'll learn

  • Read nested dataLayer values with dot-notation Data Layer Variables
  • Scrape the DOM and clean messy values with Custom JavaScript
  • Map and bucket values with Lookup Table and RegEx Table variables
  • Read cookies and web storage, and reshape data into GA4's ecommerce shape