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:
- Event name:
"entity action"format (required) - Data object: Properties for the event (optional)
- Context: Contextual information (optional)
- Trigger: The trigger name (optional)
- 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 Case | HTML Attributes | JavaScript |
|---|---|---|
| Click tracking | Best | Works |
| Visibility tracking | Best | Manual |
| Dynamic values | Possible | Best |
| Non-DOM events | Not possible | Required |
| API response events | Not possible | Required |
| Conditional tracking | Limited | Best |
tip
Use HTML attributes for DOM-based interactions (clicks, visibility, hovers) and JavaScript for dynamic or non-DOM events.
See also
- HTML Attributes - Declarative DOM-based tracking
- Tagger - Programmatic attribute generation
- Commands - Full elb API reference
💡 Need Professional Support?
Need professional support with your walkerOS implementation? Check out our services.