0
votes

Background: I've enabled enhanced ecommerce tracking on my website, which is implemented via Google Tag Manager

I've encountered an issue where pageviews are not being tracked for some pages with many product listings. The issue is the amount of product impressions that are getting pushed to the dataLayer - exceeding the payload size limit and preventing the pageviews from being sent. While researching I've found basically two suggestions:

  1. Create a product data import for product attributes that are matched to the product ID that gets pushed.

  2. Most suggestions point to this article, which explains how to break the impressions data up and send it in multiple hits.

With enhanced ecommerce, my understanding is that only the most recent 'ecommerce' variable push to the dataLayer is processed. Also any push will overwrite the previous event variable value. My question is - how can I break impressions into separate dataLayer pushes? Won't one batch of impressions override the previous, resulting in only some of the impressions getting pushed and tracked?

TL/DR: If I set up impression hits to get around payload size restrictions like the example below, won't the second batch overwrite the first?

dataLayer.push({
    'ecommerce' : {
        'impressions' : batch 1
     }
});
dataLayer.push({
    'ecommerce' : {
        'impressions' : batch 2
     }
});
1

1 Answers

1
votes

Even if the second push would not overwrite the first this would not solve your problem, since you do not send the data. If the data just accumulated and you'd send it in the end the hit would be as large as before.

Pushing data to the datalayer does not mean anything is tracked, it just means that it is available within GTM. You would need to include a custom event, and set your GA tag (some interaction hit, probably an event) to fire on that custom event. E.g.:

dataLayer.push({
    'event:'addImpressions',
    'ecommerce' : {
        'impressions' : batch 1
     }
});
dataLayer.push({
    'event:'addImpressions',
    'ecommerce' : {
        'impressions' : batch 2
     }
});

Each "addImpressions" event would fire a tag that sends a partial list of items.