I'm asking this question to better understand how GTM works, in hopes of debugging it myself. But a better title might be:
I want enhanced eCommerce to "just work" when I push to the dataLayer. What am I doing wrong?
In the past, I've implemented GTM's enhanced eCommerce dataLayer on
Magento 1. Because Magento is server-side-rendered, the
dataLayer JS array is already populated with products/impressions/conversions/etc by the time the page loads. In those scenarios, I was able to simply:
- Adding a "Page View" Universal Analytics tag in GTM
- Check the checkbox for "Enable Enhanced Ecommerce Features" and "Use data layer"
- Having it fire on "All Pages Page View",
This was enough for GTM to automagically call the enhanced eCommerce functions that push that data up to Analytics.
I say automagically because I now realize I was taking for granted the way it worked. I'm now implementing this for a client-side rendered site, where the
dataLayer isn't populated until long after the page loads. I've had to add additional GTM tags (UA with type=Event), and triggers to fire those tags when specific events are pushed to the dataLayer.
I now have the conversion/purchase tracking working, but for some reason, impressions don't get pushed. GTM says the tag is firing, and I do see an HTTP request to send the UA event (has
t=event), but no impressions data is present in the request.
Ideally, I could add just one tag, and GTM would call the appropriate Analytics function whenever new productDetail/impressions/addToCart/purchase data gets pushed to the dataLayer -- the same way it behaves when the dataLayer is pre-populated at page load time.
Is it even possible to make GTM work this way (without manually adding a tag for each type of eComm event I want to push)? Or maybe I am just not understanding how it's supposed to work.