stateContext
stateContext
Property
stateContext
PropertyThe stateContext
property holds the contextual value passed to the currently executing state.
Purpose
When defining a state in the JENTIS Tag Manager, you can optionally assign a context value. This allows the state to behave differently depending on the condition or interaction that triggered it.
Default Behavior
If no context is provided, the stateContext
value is undefined
.
Use Case
Consider a state that listens to interactions on HTML form elements. This state might react to multiple behaviors such as submit
, change
, or input
.
To differentiate between these behaviors, the state can pass a state context, which you can access within a client-side variable. This allows you to define trigger conditions that listen to that state, for example:
// Client-Side Variable returning State-Context Property
function(arguments) {
return arguments.stateContext.behavior;
}
This allows you to build flexible triggers that respond based on the specific behavior that caused the state to execute.
Example
You might define triggers like:
[Client-Side Variable returning stateContext.behavior]
contains
"input"
This approach makes it easier to reuse the same state definition across different interaction types while tailoring logic to the specific context.
Last updated
Was this helpful?