bsod99
bsod99

Reputation: 1297

Analytics enhanced ecommerce - sending product impressions

I'm trying to send product list impressions only when the product is visible in the viewport, and I have everything working in place up until the point of pushing the data correctly. I can verify that the impression data sends correctly if I allow it to send all products listed on the page, on page view, as is the default behaviour. However, using the same data layer structure, I'm unable to send this dynamically.

I've this approach below, where product is a json object with the data correctly populated.

           // I have a set of products visible here that I want to track impressions for..
            dataLayer.push({
                'ecommerce' : {
                    'impressions' : products
                }
            });

I'm just getting started with Enhanced Ecomm so it may be something pretty obvious I'm missing here - i'm not sure if I need to trigger the push via an event?

Thanks for any pointers.

Upvotes: 0

Views: 648

Answers (1)

michaelsinner
michaelsinner

Reputation: 376

The dataLayer push is only a way of communication with your tag manager, not analytics. So if you push the ecommerce information the container knows of it and maybe it even has the right format to transmit it to Google Analytics servers.

You should extend your push and give it a descriptive name first:

dataLayer.push({
  'event': 'product_in_viewport',
  'productinfo': ...
});

Now you can configure the container with triggers and tags and send the ecommerce data via a helper event to GA. The event can be named miscellaneous (category "helper event", action "product view").

Upvotes: 1

Related Questions