The curious case of the view_item event on Server Side GTM

Hello,

I have a very strange situation.
view_item is sent directly to GA4 instead of sending it to server and after that to GA4.
If I add the product to cart (so, an add_to_cart event is fired), then the view_item event that occurs automatically after ATC is sent correctly to server and after that to GA4.

view_item sent directly to GA4

view_item send correctly to server and after that to GA4 (but only if there is an add_to_cart event before)

This is my GA4 config for web. Since I‘m using a config tag, all GA4 event tags (including view_item) will use the same configuration. (so send to server should be “on“ for all events).

This is my GA4 tag in server side. Nothing special, just the basic thing. All other events (page_view, atc, begin_checkout - and even my custom events - are firing properly, claimed by GA4 Client)

This is a preview from SS where view_item was claimed by GA4, but only after an add_to_cart event.

Any idea where should I look?

Thanks,
Alin

One thing that I noticed (makes no sense for me) is that there is no “developer“ parameter for view_item event (when is sent directly to Google).

Variable in Preview Mode is saying contrary.

Other events have “developer“ param.

Hi,

This can happen if you have a gtag snippet in your code with the same measurment id, but without transport url.
Thus it’s possible that view_item event is triggered before configuration tag and so view_item uses settings from gtag snippet.
I’d recommend checking this first, but you can also just use tag sequencing so that config is always triggered before the event.

Hi, @Alex

Thanks for your reply.
Indeed, it was a problem related to tag sequencing. I managed to solve this last days and marked this post to be deleted. (Dan saw this, but for now he did not delete this post)

The only problem with tag sequencing (reading other posts and blogs) is that it might cause problems with Unique Event Id. In my tests (after using tag sequencing) everything was fine. But I am not sure if this will be ok on the long run.

And I think I have to mention that tag sequencing was used only for (page_view and view_item), for all the rest events (add_to_cart, begin_checkout, purchase - and also my custom event) it was not necessarily to use tag sequencing since these events (atc, bc, pur) are firing after GA4 Tag config, later after Container Loaded.

Also, another possible solution that I managed to came with, was to fire GA4 Tag on Consent Initialisation - but this I think will cause some more trouble when I will setup a Consent Manager.

So, for now, with tag sequencing everything looks fine.
But I think the BEST solution is to fire Config Tags and page views on Container Loaded (as it is now for me), and other events (starting with view_item, atc, bc, pur and other custom events) to be fired on DOM Ready or later.
Here the problem is that I am not sure how to configure a trigger for that.
Tried a DOM ready trigger, but I am unable to add smth related to event (lets say view_item)
And also tried Trigger with custom event, but no option to add smth related to DOM ready.

Many thanks,
Alin

Doubled check and found out that Site Kit plugin was responsible.
Removed it and everything works perfect.

ga4 tag firing to container loader, all events firing after, no need for tag sequencing.

Thanks, @Alex for your enormous help!

Hey @Alin_Tatarca,

But I think the BEST solution is to fire Config Tags and page views on Container Loaded (as it is now for me), and other events (starting with view_item, atc, bc, pur and other custom events) to be fired on DOM Ready or later.
Here the problem is that I am not sure how to configure a trigger for that.
Tried a DOM ready trigger, but I am unable to add smth related to event (lets say view_item)
And also tried Trigger with custom event, but no option to add smth related to DOM ready.

It depends on your data layer. For example, it’s often the case that the purchase event is fired before the container loaded, so tag sequencing may be needed on it as well.
If you have data layer events - I would use them + tag sequencing on events that might appear before the container is loaded. But alternatively you can use a trigger group: add a custom event and DOM ready trigger for example.

1 Like

Hello, @Alex,

After monitoring for a while how tags are firing with tag sequencing (and also looking at event_id), I decided that I will use a group (custom event + DOM ready) trigger for GA4 events.

Quick questions, please

  1. Should I use this trigger for Data Tag also? What about for FB and TikTok tag?

  2. Regarding GA4 events, since you mentioned that besides add_to_cart, purchase event it‘s often fired before Container Loaded, do you think it‘s a good idea to eliminate any doubt by using the group trigger for ALL the GA4 events, even for remove_from_cart let‘s say?

Thanks,
Alin

Could you please help me here with an answer?
I would appreciate.