Skip to main content

Forms, Leads and GA4 Reporting · Part 4: Custom JavaScript for tracking

Chapter 11.1 · 19 of 36 · 3 min

JavaScript for marketers: as much as you need, and no more

Variables.

Unlocks with the book

Variables. A name that holds a value. There are three keywords: var, let and const. Use var in GTM Custom JavaScript variables, because it is safe in older browsers. Use const in code on your own site.

Functions. A wrapper around some work, which you can call by name. A GTM Custom JavaScript variable is always a function, and it must return something.