NodesCoding
Set Variable
Creates or updates a global window variable.
Coding
Use this when a vendor expects a browser global like `dataLayer` or a queue object to exist first.
When to use it
- Initialize a vendor queue before calling it.
- Set a browser global once per page.
Routing behavior
Continues through its connected downstream path when it completes successfully.
Properties
| Property | Type | Required | Details |
|---|---|---|---|
variableName variableName | string | Optional | Global window variable name (e.g. dataLayer, fbq) |
value value | expression | Optional | Value to assign (supports expressions). If blank, defaults to empty array []. |
preserveExisting preserveExisting | boolean | Optional | Preserve if already exists (acts like `window.var = window.var || value`) |
Common mistakes
- This is browser-only behavior.
- Preserve Existing keeps the old value if one is already defined.