Borjante
Borjante

Reputation: 10497

Handle multiple product impressions and promotions in Google Tag Manager

I'm implementing GTM on an e-commerce site. The problem I have is that we have lots of products and lots of promotions on the same page and Google is limiting the size of the request. That means that not everything pushed onto the dataLayer is getting sent to their servers.

On my last try, I separated the data onto different objects, and pushed them both to the dataLayer

enter image description here

But when I inspect the requests made to Google with a plugin like HttpFox, only the data from dataLayer[3] is getting sent.

What can I be doing wrong? How does google expect us to send data in large e-commerce sites?

I've search a lot about this topic but couldn't find any help.

Upvotes: 0

Views: 1286

Answers (1)

Eike Pierstorff
Eike Pierstorff

Reputation: 32760

Send the first batch with the pageload, and every subsequent data with an GA event. You always need an interaction event (pageview or event) to send enhanced ecommerce data.

At the moment, as you have pointed out, GTM will pick the last thing you pushed to the datalayer (since the keys are the same the previous data is overwritten in the internal GTM data structure, which is an object rather than an array of objects).

So you push the additional data, add a custom GTM event ( e.g.{"event":"addData"} and build a trigger that fires on that custom event. GTM will pick the lastest ecommerce data from the datalayer and use it for GA. After the tag went through you push the next batch etc.

Upvotes: 1

Related Questions