
- MODX 3
- PHP 8.2
- Vue 3


Writes UTM parameters from the query string into $_SESSION['utm']. Used with section visibility rules (settings.utm in the document JSON).
Keep campaign tags on first visit so PageBuilder can show or hide sections by UTM in the same request and later in the session.
The PageBuilder plugin already captures UTM on OnHandleRequest in the web context. Use the snippet if:
Place it before PageBuilder in the site header or base layout chunk.
No properties. Call with no arguments.
[[!PageBuilderUtmSession]]{'!PageBuilderUtmSession' | snippet}| Query | Session |
|---|---|
?utm_source=google | $_SESSION['utm']['source'] = 'google' |
?utm_campaign=sale | $_SESSION['utm']['campaign'] = 'sale' |
Keys are normalized to lowercase. Empty values are ignored.
Parameter registry and defaults live in CMP UTM. Section visibility rules are set in the inspector Visibility dialog (pagebuilder_inspector_visibility_enabled), not on the UTM tab.
Url and button fields support {{utm:key}} (substituted at render). See CMP → UTM.