Created
April 26, 2019 12:42
-
-
Save apoleshchuk/ad8da7780efd8eabfc04f74c8d7851bc to your computer and use it in GitHub Desktop.
InSales dataLayer events
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EventBus.subscribe("always:insales:cart", data => { | |
// Скрипт common_js добавляет события о корзине в `dataLayer`, но он не | |
// устанавливает поле `event` в его пэйлоаде, поэтому у GTM нет шансов | |
// зацепить изменения в `dataLayer`. Форсируем это самостоятельно. | |
if (window.dataLayer) { | |
setTimeout(() => window.dataLayer.push({ event: "cartChange" }), 50); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
window.dataLayer = window.dataLayer || []; | |
window.dataLayer.push({ | |
'event': 'checkout', | |
'ecommerce': { | |
'checkout': { | |
'actionField': { 'step': {{ checkout_datalayer_step }} }, | |
'products': [ | |
{{ checkout_datalayer_products }} | |
] | |
} | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment