Datalayer
The Lyftio script automatically monitors the datalayer. This enables setting up targering for any event that is pushed by using a datalayer condition. The datalayer condition is best used for triggering goals (and not as an Audience condition) as the event depend on when the user or page triggers it.
Example
Say you want to target visitors that add a product to cart. If you have a GTM event for that you can easily target that by setting a datalayer condition.
Example datalayer event
{
"event": "add_to_cart",
"ecommerce": {
"items": [
{
"item_id": "122-434",
"item_name": "Low Waist Jeans Black - EU 34",
"item_variant": "Black",
"item_brand": "Jeansy",
"item_category": "Jeans",
"price": 699,
"discount": 0,
"quantity": 1,
"size": "EU 34",
"item_variant_id": "2626-0014-1252"
}
],
"currency": "SEK",
"value": 699
},
"gtm.uniqueEventId": 228
}
In the example above we set the event to add_to_cart. This will target all events called add_to_cart but you can easily use the key/value input fields to narrow down the target on any key value pair inside the event. The datalayer listener will go through the hierarchy of the event and search for your set key/value.
Datalayer condition is not recommended for use in an Audience as the event might be triggered after page load which could cause flickering for the experiment.
Always test your Audience in Preview before activating the experiment to make sure that your experiment only runs on pages that you intented.