Skip to main content

Mapping

The Mapping.Config stores all individual Mapping.EventConfig configurations for each entity-action event. The getMappingEvent function returns the matching event mapping while the getMappingValue is used to resolve a Mapping.Value settings for a specific property to return an actual value. The custom property is used by each destination individually.

getMappingEvent

getMappingEvent(event: string, mapping?: Mapping.Config<unknown>): EventMapping returns the matching eventMapping configuration and the used mappingKey for the given entity-action event name. If no mapping is found, it will return an empty object. An explicit key is favored over an asterisk * key. If available a condition will be checked to determine if the EventConfig applies. It's used by the sources.

Configuration
Result

Specify multiple Mapping.EventConfig as an array and use condition to check which EventConfig should be used. To test uncomment the globals property.

Configuration
Result

getMappingValue

getMappingValue(event: WalkerOS.Event, mapping: Mapping.Value, options?: Mapping.Options): WalkerOS.Property | undefined primarily used by destinations to process values from the original event. This offers flexibility to configure individual tagging setups to standard fields of the destination.

string

Using a string for the mapping is a shortcut for the key option. It will return the value of the property specified by the string key.

Configuration
Result

To access items in an array, use the dot notation.

Configuration
Result

key

The key option is used to access a property of an object.

Configuration
Result

value

The value option is used to return a static value. This can be used as a fallback if no other mapping option is applicable.

Configuration
Result

fn

The fn option is used to return a value from a function. The function will be called with the event object as the first argument.

Configuration
Result

map

The map option is used to create a new object. The objects keys are defined using the getMappingValue function recursively.

Configuration
Result

loop

The loop option is used to iterate over an array and return a new array. The first parameter is the array to iterate over. The second parameter is again a getMappingValue function to define the value of the new array.

Configuration
Result

validate

The validate option is used to validate the value of the property. If the value does not match the validation function, it will be set to undefined or the static fallback value.

Configuration
Result

The consent option is used to check if the user has given consent to the property. If the user has not given consent, the value will be undefined or the static fallback value.

Configuration
Result

First the condition is checked to determine if the ValueConfig should be used. Second, the consent state gets checked if an instance is provided. If no required consent is given, no value will be returned. If a fn is provided, it will be called to define the value, otherwise the key or initial string value will be used with byPath. The current value will be check using the validate function and set to undefined if it fails. Finally, the value will be cast to match the WalkerOS.Property type. An empty ValueType will return undefined.

info

If you need professional support with your walkerOS implementation, check out our services.