Skip to main content

Commands

A node client can either be created with a custom config during initialization or updated via commands using the elb function.

elb

The elb function gets returned when creating a node client. It pushes events and commands to the instance and runs asynchronously by returning a promise.

import { nodeClient } from '@elbwalker/client-node';
const { elb } = nodeClient();

const result = await elb('entity action', { foo: 'bar' });

Configuration

To configure the node client either do it while creating an instance or use the walker config command:

elb('walker config', {
globalsStatic: {}, // Static attributes added to each event
onError: console.log, // Custom error handler
onLog: console.error, // Custom logging
});

Run

A run can be seen like a cycle where all events are processed in the same group. A run is required to start the processing of events. Before starting a run all IDs and configurations should be set.

elb('walker run');

Destinations

The walker destination command adds a destination to the node client.

const destinationLog = { push: console.log };
elb('walker destination', destinationLog, {
/* destination config */
});
info

Learn more about consent management in detail.

Those names can be defined arbitrarily, but common groups are functional, analytics, and marketing. Values are booleans, and once a value is set to true it's treated as consent being granted. Previously pushed events during the run are now shared with destinations and new ones.

elb('walker consent', { marketing: true, randomTool: true });

Setting a consent state to false will immediately stop a destination from processing any events.

User

Setting the user IDs. There are three levels for user identification. Typically, the user is a company's internal ID. In contrast, the device ID can be treated as a value stored in a cookie for a more extended period, and the session can be used for temporary identification.

elb('walker user', {
id: 'us3r',
device: 'c00k13',
session: 's3ss10n',
hash: getHash(str),
});

The new user IDs have been added to each event. Make sure only to use hashed or anonymous ids.

{
"event": "entity action",
"user": {
"id": "us3r",
"device": "c00k13",
"session": "s3ss10n"
"hash": "h4sh3d"
}
// other properties omitted
}
info

Learn more about identification and user stitching in the guides.

caution

We highly recommend only using fully anonymized & arbitrary IDs by default and checking your options with persistent user IDs with your data protection officer.