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.
Specify multiple Mapping.EventConfig
as an array and use condition
to check
which EventConfig
should be used. To test uncomment the globals
property.
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.
To access items in an array, use the dot notation.
key
The key
option is used to access a property of an object.
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.
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.
map
The map
option is used to create a new object. The objects keys are defined
using the getMappingValue
function recursively.
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.
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
.
consent
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
.
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
.
If you need professional support with your walkerOS implementation, check out our services.