I've been asked to setup some dataLayer pushes for google tag manager for our external client.
I've setup the GTM script
<script>(function (w, d, s, l, i) {
w[l] = w[l] || [];
w[l].push({
'gtm.start':
new Date().getTime(), event: 'gtm.js'
});
var f = d.getElementsByTagName(s)[0],
j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : '';
j.async = true;
j.src =
'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', 'XXXXXX');</script>
and have added a dataLayer push event
{% macro billing_tracking(page, shopper_session) %}
<script>
window.dataLayer = window.dataLayer || []
window.dataLayer.push({
'users_state': '',
'status': '',
'card_value': {{ shopper_session.amount | format_2dp | tojson}},
'order_id': '',
'virtual_page': {{ page|tojson }},
'event': 'Virtual Page',
})
</script>
{% endmacro %}
I then load this macro in my HTML page.
I am expecting to see a post request made when this dataLayer.push event is loaded. That doesn't seem to happen. Is that a correct assumption? I do see a get event gtm.js?id=id but I would expect to see the post event being fired back to google tag manager?
Any ideas why this isn't happening?