element

element Property

The element property provides a reference to the DOM HTML element that triggered the execution of the current state.

Default Behavior

By default, this property is set to the global window object.

Triggered by Interaction

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.

Use Cases

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

Example

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:

const productId = element.getAttribute('data-product-id');

This makes the element property a powerful tool for context-aware data extraction in dynamic web tracking scenarios.

Last updated

Was this helpful?