Michael CastroMEASUREMENT INTELLIGENCE

MICHAEL CASTRO / GUIDE

Understand the
Starter Kit.

The Starter Kit is not a pile of tags. It is a small vocabulary for describing what happened on a website. Start with primitive values, then watch them compose into reusable measurement logic.

HOW TO READ THE SYSTEM

VARIABLESWhat value do we know?
→
TRIGGERSWhen is a condition true?
→
TAGSWhat should happen?

STARTER KIT REFERENCE

Primitive first.
Composition second.

Each section expands the Note included inside GTM and introduces the underlying web or computer-science idea only where it makes the implementation easier to understand.

01
BUILT-IN VARIABLEURL / string

Page URL

Returns the address of the current page. A variable is a named value: GTM can ask for Page URL at the moment it needs it, then use that value in a condition, trigger, or tag.

CONCEPTVariable · value · string
02
BUILT-IN VARIABLEstring

Page Hostname

Returns the hostname of the current page, such as example.com. It is a smaller, more specific piece of the full URL and is useful when logic depends on the site or subdomain rather than the entire address.

CONCEPTData decomposition · string
03
BUILT-IN VARIABLEstring

Page Path

Returns the path portion of the current URL, such as /pricing. Separating a URL into parts lets measurement logic describe intent more cleanly: Page Path contains /pricing is easier to reason about than matching a complete URL.

CONCEPTComposition · conditions
04
BUILT-IN VARIABLEURL / string

Referrer

Returns the referring URL available to the browser. A referrer is context: it describes where the current page navigation came from. The Starter Kit later derives Referrer Hostname from this more primitive value.

CONCEPTInput · derived value
05
BUILT-IN VARIABLEstring

Event

Returns the name of the current GTM event. GTM is event-driven: instead of running one linear program from beginning to end, it reacts as page loads, clicks and other interactions occur.

CONCEPTEvent-driven programming
06
BUILT-IN VARIABLEDOM element / object

Click Element

Returns the actual HTML element associated with a click. Unlike a text value, this is an object representing part of the page’s Document Object Model. More advanced Starter Kit components can inspect it and move through its relationships.

CONCEPTObject · DOM · state
07
BUILT-IN VARIABLEURL / string

Click URL

Returns the destination URL associated with a clicked link. Other Starter Kit components derive the hostname, path and file extension from this value instead of repeatedly solving the same problem.

CONCEPTReuse · derived values
08
BUILT-IN VARIABLEstring

Click Text

Returns text associated with a click. It can be useful context, but the exact clicked node is not always the element a person conceptually interacted with. That limitation motivates the later Closest Interactive Element and Interaction Label Starter Kit components.

CONCEPTAbstraction · edge cases
09
VARIABLEConstant / string

Google Analytics Measurement ID (G-0000000)

Stores one reusable value for the Google Analytics Measurement ID. A constant is a value intended to stay the same while the container runs. The included G-0000000 value is deliberately a placeholder and must be replaced before publishing.

CONCEPTConstant · single source of truth
10
VARIABLEURL variable / string

Click Hostname

Returns only the hostname of Click URL, such as example.com, with www removed. This is a derived variable: it takes a more general input and transforms it into the specific value needed for classification and conditions.

CONCEPTFunction-like transformation · return value
11
VARIABLEURL variable / string

Click Path

Returns only the path of Click URL, such as /pricing. It demonstrates a useful programming pattern: normalize complex input into smaller values that can be compared reliably.

CONCEPTNormalization · comparison
12
VARIABLEURL variable / string

Click File Extension

Returns the filename extension from Click URL, such as pdf or xlsx. The File Download Click trigger later uses this returned value as an input to a condition.

CONCEPTReturn value · dependency
13
VARIABLEURL variable / string

Referrer Hostname

Returns only the hostname from Referrer. This is another example of composition: a primitive browser value becomes a more useful Starter Kit component without changing the original value.

CONCEPTComposition · immutability
14
VARIABLEAuto-Event Variable / string

Element Type

Returns the HTML element type involved in an interaction, such as BUTTON, SPAN, INPUT, or A. HTML elements are the structural objects that make up a web page; their type is one clue to what an interaction means.

CONCEPTDOM · type
15
VARIABLEAuto-Event Variable / string

Element ID

Returns the id attribute of the clicked HTML element. An ID is intended to identify a particular element in a document, making it useful when a site provides stable, meaningful IDs.

CONCEPTIdentifier · attribute
16
VARIABLEAuto-Event Variable / string

Element Attribute — ARIA Label

Returns the aria-label attribute. ARIA labels provide accessible names for controls that may not have useful visible text, so they can also provide meaningful interaction context when used carefully.

CONCEPTAttribute · accessibility semantics
17
VARIABLECustom JavaScript / DOM element

Closest Interactive Element

Starts with Click Element and asks the browser for the nearest link, button, form control, or common ARIA control. This solves a common DOM problem: a person clicks an icon or span nested inside the button they actually meant to activate.

CONCEPTFunction · DOM traversal · ancestor relationship
18
VARIABLECustom JavaScript / string

Interaction Label

Returns the best available human-readable label for Closest Interactive Element. It checks sources in a deliberate order—accessibility label, normalized visible text, then descriptive attributes—and returns the first useful value. Input values are intentionally excluded as a privacy safeguard.

CONCEPTFunction · precedence · fallback · return value
19
VARIABLECustom JavaScript / string

Interaction Type

Describes the resolved interactive element using its role, type attribute, or HTML tag. This is an abstraction layer: downstream logic can ask what kind of interaction occurred without repeating the DOM inspection.

CONCEPTAbstraction · encapsulation
25
TRIGGERClick — Just Links

File Download Click

Uses Click File Extension and a regular-expression pattern to recognize common downloadable files. A regular expression is a compact language for matching text patterns. Google Analytics Enhanced Measurement may already collect file_download, so check before attaching another GA4 file-download tag.

CONCEPTRegular expression · pattern matching · duplication
26
VARIABLEGoogle Tag Event Settings

Google Tag Event Settings

Composes Environment Name, Container ID and Container Version into one gtm_context value. This demonstrates why small Starter Kit components matter: simple primitive values can be assembled into richer diagnostic context without hard-coding it into every tag.

CONCEPTComposition · observability
27
TAGGoogle tag

Google Tag

Uses the Measurement ID and shared Event Settings to load Google Analytics. Tags are outputs/actions in GTM: variables supply values, triggers decide when, and the tag performs the work. The Starter Kit deliberately fires it on Initialization and leaves the Measurement ID as a safe placeholder.

CONCEPTInputs → condition → action

THE PATTERN

Small pieces.
Legible systems.

The goal is not to make every GTM user a JavaScript developer. It is to make the logic visible enough that a marketer can understand what a system knows, why a condition is true, and what happens next.