Skip to main content

Mapping

The mapping is used to translate walkerOS events into another required format. The mapping also defines how to process events, like renaming, bundling, or ignoring them. as well as 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. And there are custom 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). The getMappingValue util

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 destinations individual settings.

PropertyValueDescription
namestringRenaming of the event (e.g. product add to add_to_cart)
ignorebooleanIf set to true the event won't get pushed to the destination.
consentobjectRequired states to process the event.
customobjectIndividual settings for a custom destination.
batchnumberTime 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.

info

Use Utils/Hooks to modify events before processing.