I'd like to have any help regarding an events-firing issue with Universal Analytics deployed via Google Tag Manager.
In particular, I'm attempting to send two kinds of events on the same page: a checkout-purchase event (Enhanced-ecommerce) and an onclick generic custom one.
Below my page's related code, in the order of onload execution:
<script>
<!--Initialize dataLayer-->
dataLayer = [{'userId' : ...}];
<!--End dataLayer-->
<!--Tag Manager-->
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':.....})(window,document,'script','dataLayer','GTM-...');
<!--End Tag Manager-->
dataLayer.push({
'event': 'checkout',
'ecommerce': {
'purchase': {
'actionField': {
'id': ...
'revenue': '1.00',
'tax': ...
},
'products': [{
'name': 'Product1',
'price': '1.00',
'category': 'Category 1',
'variant': 'Variant1',
'quantity': 1
}]
}
},
'eventCallback': function() {
console.log("Purchase pushed!");
}
});
</script>
<button onclick="dataLayer.push({'event': 'eventTest'});">CLICK ME</button>
As you see, the purchase event is correctly pushed at the page-load.
I state "correctly" because inspecting the dataLayer object in browser console, is revealing the added purchase child object.
In addiction, at the end you find a simple button which pushes another generic "eventTest" on its onclick handler. Even this event object is added to the dataLayer "queue".
For you to consider, these below are the page-load '200 status' requests concerning Google:
- gtm.js?id=GTM-... [www.googletagmanager.com]
- analytics.js [www.google-analytics.com]
- collect?v=1&_v=j35&a=211135512&t=pageview... [www.google-analytics.com]
In short, everything seems to be ok.
Obviously, when those pushes are done, no addictional requests are fired, but this is expected.
My questions is: when, and based upon what, the dataLayer "queue" data is sent?
In fact, no events data are reported in Analytics panel after several days from my tests.
The Analytics tag is based upon "All pages" firing rule, in Google Tag Manager, and "e-commerce elements", with advanced ecommerce features and dataLayer options, are all active.
Is there any other Tag Manager's options, or rules, I should set in order to make those events be collected?? Should those events be previously "registered" in Tag Manager's console?
Apologise for being long and thanks so much.
UPDATE:
I managed to make those events data collected, but I'm facing issues with events "labels" sent.
I mean that events are regularly recorded even in the Universal Analytics real-time panel, but as "undefined".
Inspecting Analytics' requests is showing "undefined" values for "ec" and "ea" parameters, both for ecommerce object "addToCart / removeFromCart" dataLayer.push, and for the generic onclick "eventTest" one.
What might be wrong with these?
Thanks so much.