Event Mapping
Mapping is used to translate walkerOS events into a required format of another tool. The mapping also defines how to process events like renaming, bundling, or ignoring them. It's also checking for consent or validating a value.
There are common event rules for destinations like name
to rename an event
(e.g. product add
to add_to_cart
) or ignore
to not process an event at
all. There are settings, that are individual for each destination (e.g. a GA4
destination might require a measurement_id
while a Meta destination requires a
pixel_id
).
A *
can be used to match all entities or actions and set up common rules. Each
destination requires specific settings which can be configured in the custom
section of the mapping.
import type { Mapping } from '@elbwalker/types';
const mapping: Mapping.Config = {
entity: { action: {} }, // Basic structure
page: {
view: { name: 'pageview' }, // Rename the event name
click: { custom: { language: 'globals.language' } }, // Custom settings
'*': { ignore: true }, // Ignore all other page events
},
order: { complete: { consent: { marketing: true } } }, // Require marketing consent
'*': { visible: { batch: 2000 } }, // Bundle all visible events every 2 seconds
};
Event
The Destination.Event
mapping for each event supports standardized default
options. The custom
option can be used to set up custom properties for the
event and destination's individual settings.
Property | Value | Description |
---|---|---|
name | string | Renaming of the event (e.g. product add to add_to_cart ) |
ignore | boolean | If set to true the event won't get pushed to the destination. |
consent | object | Required states to process the event. |
custom | object | Individual settings for a custom destination. |
batch | number | Time in ms to bundle the events before calling pushBatch if available. |
To disable processing of other events, add {'*': {'*': { ignore: true }}}
to
the mapping.
Make sure to not list duplicate keys in the mapping, since this is an object.
Use hooks to modify events before processing.
If you need professional support with your walkerOS implementation, check out our services.