Missing some parameters in items array in sgtm

Hi,
i am sending my ecommerce items array to sgtm. In datalayer there are beside quantity, item_brand and so on the following parameters in the items array:
google_business_vertical
action_source
category
id (not item_id)

In the log in sgtm i can see that google_business_vertical and action_source are there, but the others are missing (but the values are definitly there)

When i add the parameters to the normal event parameter but not the items array it works.

It seems like some parameters are deleted in ecommerce.items array?

When using data tag it is working …

Sounds strange, can you share screenshots where you can see that you are sending one format of items array, but on the server in event data in the same request you have a different one?

Hi @Alex,

I am having the same issue. The first time I see something like this…

The event triggers on web, and this is the dataLayer

This is the tag firing, and the data source is “dataLayer” (I am also sending the data one by one, and this works, but not as an array)

A parameter called “items” no matter what the value is, is not seen in Event Data.

I have tried to send an items array variable and named the parameter differently, for example products:

But then the value in Event Data is “[Object, Object]”
image

I have tried to send the parameters of items array separately in the GA4 server tag, but I can’t get it to go under “items” tab. It keeps going in the “parameters” tab, no matter how i structure it.

This is only happening with one client’s container. It works fine with others.

The items array seems to be working with the Data Tag:

Any clues on what could be the reson behind this strange behavior?

Thanks!

Hi Gasper,

In this screenshot you can see that you don’t pass items as part of the payload event, so it’s not on the server

GA4 has issues with passing custom arrays (all except ‘items’).

To pass a custom array through GA4 you need to use JSON.stringify on this array first, and on the server convert it through a custom variable via JSON.parse.

This is one of the reasons why we recommend using Data tag - Data Client to send data to server for non-Google platforms (Facebook, TikTok, Pinterest, etc.).

Hi, Alex,

I am not sending items specifically in the event properties section,but have the “Send Ecommerce Data” checked, which in other cases works, and sends the items array to the server.

But not in this case. The problem in this case is even if I send a “custom” parameter with a string or a number value and call this parameter “items”, this parameter isn’t visible on the server.

On the server in event data there are always all parameters that are sent.
You may not find some parameters in event data only if you do not send them together with the event you are checking. So first of all make sure that the parameters you need are available to the tag that sends it from the web, also make sure that this data is sent (ideally check this in the network tab of the browser).

By the way, if you use tag sequencing on a web tag for some reason - it can break the logic of the event, I recommend to avoid using it.

The “Send Ecommerce Data” checkbox normally sends all the data under ecommerce in the dataLayer. So, transaction_id, value, currency, and also items, and therefore we don’t need to specify this data separately in the event parameters section.

The problem is elswehre, because even if I specify a parameter called items and give it a string value, it won’t show on the server.

Here’s a screenshot, where I specify items parameter in the event parameter section and it’s now visible in the web tag that it is sending that parameter to the server:

And then on the server side, when this event is claimed, there is no items parameter in the event data:

.

Here’s a video explanation of the problem for better understanding: Troubleshooting E-commerce Data 🛠 | Loom

I know how it should look like but in this case it just doesn’t work. I show you another GTM container where I have practically the same settings to send the ecommerce data layer, and the items parameter is there.

Not sure what is going on here.

Thanks for your patience and help :slight_smile:

GA4 expected items param in array format, which is why your ‘test’ as value of ‘items’ not processed by GA4 clients and not transformed into event data. In what format do you have items in the data layer?

This is the copy of the dataLayer:

{
event: “select_plan”,
gtm: {
uniqueEventId: 16,
priorityId: 1,
start: 1717767616035,
scrollThreshold: 75,
scrollUnits: “percent”,
scrollDirection: “vertical”,
triggers: “6152600_138”
},
ads_data_redaction: false,
url_passthrough: false,
developer_id: {dY2Q2ZW: true},
ecommerce: {
currency: “Kč”,
value: 699,
items: [
{
item_id: “97”,
item_name: “STANDARD”,
item_brand: “FitInn”,
item_category: “Membership”,
location_id: “Praha-DBK Budějovická // Budějovická 1667/64, 1” +
“40 00 Praha”,
price: 699,
quantity: 1
}
]
}
}

I have unchecked the “Send Ecomerce Data” and manually entered the items array with a DLV:

Here’s a DLV:

And here’s the tag firing with items parameter:

Still, on the server-side, there’s no items parameter:

I don’t know if I’m missing any mistake or is this just very strange behavior?

THanks for your time looking into it!

It looks very strange, I’ve never seen it before. It looks correct on your end.
You just have to experiment. Try to do the same in a new tag and remove all payload except items from it

Yes, it’s very strange. I have done multiple server-side setups and have never seen such a thing.

I tried to work around this and sen each separately, and then on the server end I have created a vustom template that creates an array from separate items event data.

However I haven’t yet figured it out how to send that array apropriately to GA4 from the server. No matter what I do, the data always ends in the “parameters” tab and and not in the “items” tab if you know what I mean (in GA4 where we have parameters, user and items tab for ecommerce events).

If there’s a way I could do that, than this could be a viable solution.

I have already tried to create a completely new tag, with only items parameters, and the result was the same.

Maybe I can try with an empty container and give it a shot. Will let you know if maybe for some reason the container is broken if that’s even possible.

Hi, @Alex ,

I figured out that items parameter is getting to the server on official ecommerce events, so in my case add_payment_info, and purchase, but not on custom events. Is that the reason? Are there any limitations to custom events that they aren’t able to carry items data?

Regards,
Gašper

Hi @Gasper_Cerar

Yeah, I didn’t notice that you were sending this with a custom event and that there was such limitation. It’s not described anywhere in the official documentation, but in fact yes, items will only work for standard ecommerce events.

You can try to send it as some ‘custom_items’ param (before that you need to do JSON.stringify to get the custom array sent correctly through GA4, on the server you need to transform it with a custom variable through JSON.parse) → and on the server overwrite or transform it to items. I haven’t tried it myself but I doubt this will actually help to get items in GA4 on a custom event.

This is not some server side limitation by the way, GA4 client tracking will not send items for custom events either.
And that’s one of the reasons to use Data tag to send data for non google platforms :slight_smile:

Thanks, Alex, for your answers. I’m glad we cleared the problem an I know now why this is happening.

I was trying to end it to GA4, for others I do use the Data tag :slight_smile:

I guess I’ll have to do some workaround for the funnel report in that case.

Thanks again for all the help.