What Built-In Variables Are
Built-in variables are pre-configured variable types that Google Tag Manager provides out of the box. They give you immediate access to page metadata, click information, form data, and other browser properties without writing a single line of JavaScript. Most are disabled by default — you enable the ones you need from the Variables section.
Page Variables (1–4)
- Page URL: the full URL of the current page including protocol, domain, path, and query string. Use in: page URL triggers, GA4 page_location parameter, conversion tag conditions. Example value:
https://yoursite.com/thank-you?order=12345 - Page Path: just the path portion of the URL, without domain or query string. Use in: trigger conditions for specific pages. Example:
/thank-you - Page Hostname: just the domain name. Use in: cross-domain tracking checks, filtering tags to specific subdomains. Example:
yoursite.com - Page Title: the HTML title element of the page. Use in: GA4 page_title parameter, content categorisation. Example:
Contact Us | YourSite
Click Variables (5–9)
- Click Element: returns the DOM element that was clicked. Use in: identifying which specific element triggered a click event. Returns an element reference, not a string.
- Click Classes: the CSS classes of the clicked element. Use in: targeting clicks on elements with specific class names (e.g. "cta-button primary"). Example:
btn btn-primary cta-button - Click ID: the HTML ID attribute of the clicked element. Use in: targeting clicks on a specific button by its unique ID. Example:
submit-contact-form - Click Text: the visible text content of the clicked element. Use in: tracking which CTA text users are clicking (useful for A/B test tracking). Example:
Get a Free Quote - Click URL: the href attribute of the clicked link. Use in: outbound link tracking, exit link categorisation. Example:
https://external-site.com/page
Form Variables (10–11)
- Form Element: the DOM element of the submitted form. Use in: identifying which form triggered a form submit event.
- Form ID: the HTML ID attribute of the submitted form. Use in: triggering specific tags only for a named form. Example:
contact-form-main
Scroll Variables (12–13)
- Scroll Depth Threshold: the scroll depth percentage that triggered a scroll depth event (10, 25, 50, 75, or 90). Use in: GA4 scroll_depth parameter, reporting how far users read. Example:
75 - Scroll Depth Units: whether the threshold is measured in pixels or percent. Usually "Percent".
Utility Variables (14–15)
- Random Number: a random integer. Use in: deduplication logic, A/B test assignment, preventing cached tag values. Example:
748291 - Container ID: your GTM container's ID (GTM-XXXXXXX). Use in: debugging and documentation. Rarely used in tags but useful in custom JavaScript variables for self-identification.
How to Enable Built-In Variables
- In GTM: Variables (left navigation)
- Under Built-In Variables, click Configure
- Check the boxes for the variables you want to enable
- Click Save
Enable only the ones you actually use — enabling unnecessary variables adds slight container overhead and clutters the variable list.
Combining Built-In Variables With Custom Triggers
Built-in variables become especially powerful when combined with custom triggers. Example: a trigger that fires when Click URL contains "linkedin.com" uses the Click URL built-in variable to detect outbound LinkedIn clicks — enabling you to track professional networking interactions for your Google Ads audience building without any custom code.
Summary
These 15 built-in variables cover the majority of common tracking needs. Enable them as needed, use them in both triggers (as conditions) and tags (as parameter values), and pair them with the data layer for the variables that built-ins cannot provide.
See our Google Tag Manager Setup and Audit service for expert GTM configuration.
Need GTM built out properly? Contact Adslytics.
Need expert tracking setup?
Our Google Tag Manager experts have delivered 500+ tracking setups with a 98% success rate.
Get a Free Consultation →