Data Layer and Page State
Understand the difference between the current event and the longer-lived state that Fluxyn keeps during the session.
One of the most important ideas in Fluxyn is that not every piece of data has the same lifespan.
Some values belong only to the event happening right now. Others should stay available for the rest of the session. Fluxyn treats those cases differently on purpose.
The Global Data Component
Fluxyn can read pushed values from window.dataLayer.
For example:
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
user_tier: "enterprise_premium",
current_location: "US-NY"
});When values are pushed without a meaningful event for a flow to react to, they can still affect the page state that later executions read from $.
That makes the data layer useful for long-lived context such as:
- user attributes
- campaign information
- page metadata
- CMP or consent state passed in from another system
The Separation of Context
Fluxyn keeps two ideas separate:
$eventDatais the payload for the current event$is the accumulated page-level state
This is what makes flows predictable.
- Use
$eventDatafor details that are unique to this run. - Use
$for context that many later runs may need.
For example:
- the current purchase amount probably belongs in
$eventData - the visitor's country or subscription tier may belong in
$
Updating State from Flows
You do not have to rely on raw dataLayer pushes to maintain state. You can also update it from within a flow using Set Properties.
That is the cleanest option when:
- you want to persist a value that was computed in Fluxyn
- you want later flows to reuse that value
- you want state ownership to stay in the flow builder instead of the host app
Good State Practices
- Store only what future executions genuinely need.
- Keep event-specific values in the current run unless they should survive.
- Normalize important fields early so later flows do not all solve the same problem differently.
- Be deliberate when overwriting state. If a value should be removed, clear it intentionally instead of assuming a later event will replace it.