The Datalayer Tag Experience allows users to trigger any Marfeel SDK method based on the values of a Javascript object accessible on the window
context.
You can create a tag experience
- From Experience Manager
- Create a Datalayer Tag Experience
Set the user type
In the example below setUserType
is invoked with values 0, 2, 3 or 4
depending on the value of the user.type
object value.
[
{
"type": "object",
"path": "user.type",
"effects": [{
"action": "userType",
"condition": "anonymous",
"params": {
"type": "fixed",
"value": 0
}
} , {
"action": "userType",
"condition": "registered",
"params": {
"type": "fixed",
"value": 2
}
} , {
"action": "userType",
"condition": "subscriber",
"params": {
"type": "fixed",
"value": 3
}
} , {
"action": "userType",
"condition": "exSubscriber",
"params": {
"type": "fixed",
"value": 4
}
}
]
}
]
Trigger a conversion
In the example below the system will look for an array
named dataLayer
. As indicated on the condition
field if dataLayer.event == GAevent
and dataLayer.eventAction == signup
and dataLayer.eventCategory == user
it will invoke the trackConversion('signup')
method on the Marfeel SDK:
[
{
"type": "array",
"path": "dataLayer",
"effects": [{
"action": "conversion",
"condition": {
"event": "GAevent",
"eventAction": "signup",
"eventCategory": "user"
},
"params": {
"type": "fixed",
"value": "signup"
}
}
]
}
]