element
Last updated
Was this helpful?
element PropertyThe element property provides a reference to the DOM HTML element that triggered the execution of the current state.
By default, this property is set to the global window object.
If a CSS Selector Action Trigger is used—executed through a specific JavaScript event such as a click, hover, or similar—the element property will instead reference the actual HTML element involved in that interaction.
This property allows you to extract contextual information directly from the DOM element that triggered the event. For example, you can:
Access custom data-* attributes
Read element-specific properties (e.g., id, classList, innerText)
Use the reference in further JavaScript operations
If a button is clicked and has a data-product-id attribute:
<button data-product-id="12345">Buy Now</button>You could use the element reference to access this value:
This makes the element property a powerful tool for context-aware data extraction in dynamic web tracking scenarios.
Last updated
Was this helpful?
Was this helpful?
const productId = element.getAttribute('data-product-id');