Skip to main content

NPM

Use the @elbwalker/walker.js package to integrate it directly into your project. To get started with the installation, run:

npm i @elbwalker/walker.js

As a next step run the following code snippet once to create an instance.

import { Walkerjs } from '@elbwalker/walker.js';

window.walkerjs = Walkerjs({
/* custom config */
});

Then to configure and communicate with the walker.js instance load the elb-helper function:

import { elb } from '@elbwalker/walker.js';

window.elb = elb;
elb('entity action', data, trigger, context, nested); // push events
elb('walker <command>', data); // configure walker, see Commands

Single Page Applications

When using a Single Page Application like React, tell the walker to run on each location change in your app, like a real pageview:

import React from 'react';
import { Route, Routes, useLocation } from 'react-router-dom';
import { elb, Walkerjs } from '@elbwalker/walker.js';

window.walkerjs = Walkerjs({ default: true });

export default function App() {
const location = useLocation();
React.useEffect(() => {
elb('walker run'); // party hard!
}, [location]);

return <Routes>// ...</Routes>;
}

Refer to the following folders on GitHub for a detailed example