0
votes

I'm working on the site that sells subscriptions. On /subscribe page, there's a list of available subscription plans, that I push to Analytics as product impressions on page load using dataLayer syntax. On clicking the plan, its details are shown, so it'd be natural to send "productClick" in click handler. This info is sent to GA, but then product details is shown on the same page, changing the location hash. GA documentation gives the only example on how to track product details given page view, but we don't actually have one here. Is there a way to manually send product detail?

In addition, there's a user flow which involves showing the same /subscribe page in an iframe. I'd like product impressions to be sent to GA too, but, once again, when I push to parent.dataLayer, the data is not sent to GA. Also, clicking on plan maps to addToCart event, so I'd like to send it as well, but somehow what goes through is only a "productClick". Is there a way to push both "productClick" and "addToCart" events at the same time?

1
I suggest that you remove the second unrelated paragraph, especially since you have already made it into a separate question.Eike Pierstorff

1 Answers

0
votes

"Is there a way to manually send product detail?"

You need an interaction hit to send the data with Google Analytics. Plus the data must be available before (or alongside) the GTM event (be it native or a custom event in the datalayer) is fired, since GTM updates its internal data structure from the datalayer variable when an event occurs.

In your case, since the location hash changes you might be able to use GTMs history change event handler (or you push a custom event with your product data) to fire a Google Analytics event that sends your e-commerce data. Conceivably you could event do a pageview with a virtual pagename if the content changes enough to warrant to be counted as a new page.