AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Analytics
2.3K members online now
2.3K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

Best practices for tracking Enhanced Ecommerce Product Impressions with dynamic item lists

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hello,

 

I'm having a bit of trouble implementing complete Enhanced Ecommerce tracking using Google Analytics and Google Tag Manager... there are a few concepts I'm not sure of how they're supposed to work.

Maybe someone can help me out or point me in the right direction...

 

Problem no. 1 is tracking Product Impressions and how our (proprietary) shop frontend works:

Consider a webshop homepage with 20 products for the customer to view. These products are from different sources: half of them might be selected dynamically from the customer's browsing history and based on his current browsing profile, the other half might be statically selected "bestsellers" that are the same for everyone. This means, at the time of rendering the page HTML, it is not clear which exact products are being listed. So I cannot prepare the data for the GTM DataLayer ("ecommerce.impressions" object) at this point.

 

So I guess the only way to solve this is to write a custom Javascript, which runs after the page has finished rendering and all the dynamically inserted products are selected. This script would have to scan the whole page and gather the product impression data, and then make a dataLayer.push with the "ecommerce.impressions" data. Then I'd have to send a "non-interaction" event to Google Analytics in conjunction with the Ecommerce data. (The original Pageview tag has already been fired at this time, so I'd have to create an additional tag for this.)

 

This whole procedure seems really cumbersome to me, but I suppose it's the only way if we want to track all product impressions ... or have I overlooked something? Are there other "best practices" for this particular use case of GTM and Enhanced Ecommerce tracking?

 

Another thing is, there doesn't seem to be an easy way to access the DataLayer object from my own custom Javascript...?

Of course, its basically just an Array of Objects which I could iterate over to find the nodes I'm looking for... But I would have thought that the Google Tag Manager might provide an API for easier access to the information that I have sent to the Data Layer in previous requests?

 

1 Expert replyverified_user

Re: Best practices for tracking Enhanced Ecommerce Product Impressions with dynamic item lists

Top Contributor
# 2
Top Contributor
Hi Matthias,
1. Product impressions - in your case if there is no real way to prepare the dl object for the gtm.js / Pageview event then just use a subsequent event. So after the products render and you have all the available info needed for the dl object push it with a non interaction event.

As for the custom JS I believe you need to have some kind of control of what is shown as the end page render (product list with item details) - all this data needs to be pulled from somewhere and then parsed / sorted or whatever so it would be either plug in to that rendering process or wait for the page to be 'loaded' and then push the event.

2. Access DL from your own JS
Well essentially DL is fully exposed so you just need to be aware of how is it structured - some idea http://www.simoahava.com/gtm-tips/access-array-members-in-the-data-layer/

Hope it helps.

Kind regards,
Zorin
Web analyst @ escapestudio.net

Re: Best practices for tracking Enhanced Ecommerce Product Impressions with dynamic item lists

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Thanks for your help, I guess I'm heading "somewhat" in the right direction... Smiley Wink

1.) Because of the way our shop frontend works, I can't "plug in" to the rendering process, but instead I'll have to wait for the whole page dom to be rendered and THEN push the event. This is a bit complicated, but definitely possible.

2.) I found this: https://www.stickler.de/en/information/analytics/gtm-data-layer-access
The google_tag_manager["GTM-XXXX"].dataLayer.get('.....') function is basically what I'm looking for, but its a bit... "impractical" that I have to know the exact GTM-XXXX code at this point, but I guess it will suffice. I think it's better than writing my own "Data Layer handler".

Any other suggestions or ideas are welcome, but I guess I have everything I need to start with the real implementation.

Re: Best practices for tracking Enhanced Ecommerce Product Impressions with dynamic item lists

Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭

Hello Zorin,

I've now implemented an Analytics event for the Enhanced Ecommerce impressions tracking, and it basically works as expected, but I'm having trouble with the Behavior Flow report.
It is listing what looks like double pageviews.

 

The problem is that apparently, the tracking events that I send with every pageview are also listed as pageviews with the "page type" being "not set".

Do you know a solution for this? Of course, I have configured the tracking events as "non interaction" events, but still they seem to be interfering with my pageviews in the Behavior Flow report. (And only there. All other data seems to be okay.)

 

Re: Best practices for tracking Enhanced Ecommerce Product Impressions with dynamic item lists

Top Contributor
# 5
Top Contributor

Hi Matthias, 

 

could you please check the following:

Right click on (not set) which is I believe a Content grouping?

 

Web analyst @ escapestudio.net

Re: Best practices for tracking Enhanced Ecommerce Product Impressions with dynamic item lists

Visitor ✭ ✭ ✭
# 6
Visitor ✭ ✭ ✭

 Hi Zorin,

yes it is a Content Grouping ("Produkt" are all product detail pages in our shop).

Apparently, 100% of visitors generate a "(not set)" pageview in the Flow report as their second hit:

 

 

And I'm quite sure this is because of my Ecommerce Tracking event. When I deactivate the tracking event, the "(not set)" hits are no longer generated.

 

This is what the report looks like when I highlight all hits for the "(not set)" interaction:

 

Re: Best practices for tracking Enhanced Ecommerce Product Impressions with dynamic item lists

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭
Some more information, for clarification:

The main problem is that apparently ALL users who visited "Root" (our shop homepage) as their first interaction, triggered a "not set" hit as their second interaction. This makes it much harder to properly read the report, because the bounce rate from "Root" appears to be zero at first glance.

I don't understand how this is possible, as we only have a single "Pageview" tag configured in Google Tag Manager. All other relevant tags are "Events" (most of them "non interaction" events). But even the "interaction" events should not appear in the Behavior Flow report at all...

Re: Best practices for tracking Enhanced Ecommerce Product Impressions with dynamic item lists

Top Contributor
# 8
Top Contributor
Hi Matthias,

2 things:
1) which pages are inside the (not set) 1st Interaction (seems the images from my previous reply did not go through?)
2) could you send the live site URL just that I can see what is going on in more detail

Kind regards,
Zorin
Web analyst @ escapestudio.net

Re: Best practices for tracking Enhanced Ecommerce Product Impressions with dynamic item lists

[ Edited ]
Visitor ✭ ✭ ✭
# 9
Visitor ✭ ✭ ✭

Thanks a lot for your help!
I can't see any images in your replies. (But I had trouble posting images myself, it only worked when I manually inserted the images as <img src="..." /> tags in the HTML editor.)

1) I'm not really sure how it is even possible that there are "(not set)" hits as 1st interaction.... Apparently, it is only the shop homepage "/", i.e. the same as "Root"

2) The URL is www.connox.de (www.connox.com for an english version if that helps with the navigation, but the tracking via GTM is currently only active for www.connox.de).

Re: Best practices for tracking Enhanced Ecommerce Product Impressions with dynamic item lists

Top Contributor
# 10
Top Contributor
Hi Matthias,

could you please check that the pageview tag is firing before the event which carries the product impressions. I can see that the event fires after gtm.dom but it seems that the pageview is one step behind? For example on home page as the case - and if possible check if that same thing happens inside the -1 property.

Kind regards,
Zorin
Web analyst @ escapestudio.net