Walker.js docs

Using JavaScript

How to use JavaScript to track events
Walker.js uses the elbLayer to handle all events. It is possible to also trigger custom events manually using JavaScript:
import { elb } from '@elbwalker/walker.js';
elb('entity action', data, trigger, context, nested);
Both entity and action are combined in one string separated by space and required. The optional data object holds all properties of an entity. The trigger is optional and is expected to be a string.


// Virtual page view of an overlay popup
elb('page view', { id: '/overlay/login', name: 'Log In' }, 'visible');
// Add to cart
elb('product add', { name: 'Everyday Ruck Snack' });
// Just an event
elb('application confirm');
The full elb-function interface requires the event and accepts additional parameters for data, trigger, context, and nested
interface Elb {
event: string,
data?: Walker.Properties,
trigger?: string,
context?: Walker.OrderedProperties,
nested?: Walker.Entities,
): void;
'entity action', // event
{ foo: 'bar' }, // data
'custom', // trigger
{ test: ['a', 0] }, // context
// nested
type: 'child',
data: { iam: 'nested' }
When working directly with the elbLayer make sure to initialize it properly by writing the following line before making use of the push method: elbLayer = elbLayer || [];

Contact us

For more information on any of the things covered in this documentation, you can