Skip to main content

JavaScript

Capture events programmatically using the elb() function instead of HTML attributes.

When to use

  • Dynamic events not tied to DOM elements
  • Custom application logic
  • Events triggered by API responses
  • Complex conditional tracking

Basic usage

Loading...

Event structure

The elb function accepts:

  1. Event name: "entity action" format (required)
  2. Data object: Properties for the event (optional)
  3. Context: Contextual information (optional)
  4. Trigger: The trigger name (optional)
  5. Nested: Nested entities (optional)
Loading...

Examples

Page events

Loading...

User actions

Loading...

Form submissions

Loading...

API response tracking

Loading...

Error tracking

Loading...

Object syntax

You can also pass events as objects:

Loading...

Comparison with HTML Attributes

Use CaseHTML AttributesJavaScript
Click trackingBestWorks
Visibility trackingBestManual
Dynamic valuesPossibleBest
Non-DOM eventsNot possibleRequired
API response eventsNot possibleRequired
Conditional trackingLimitedBest
tip

Use HTML attributes for DOM-based interactions (clicks, visibility, hovers) and JavaScript for dynamic or non-DOM events.

See also

💡 Need Professional Support?
Need professional support with your walkerOS implementation? Check out our services.