Closed StSaens closed 8 months ago
Hi,
This is more about how wp_json_encode (calling json_encode) converts a PHP variable into a JSON string.
If it sees a number, it will be encoded as a number, not as a string. What you could you is to create a custom JS variable inside GTM and iterate through the items array and convert all item_id value to string if necessary.
Hi, thanks for your response. I dont fully understand, since it's a change from 1.19.1 to 1.20
Well, that is strange...
Oh, I see, there was another ticket about this. They asked me to make sure the item_id is an integer when it is an integer and not a string :-)
So, who is right now? ;-)
The standard.
Deal :-)
Great! Is there an issue id with the other request you're referring to? I am interested in their use-case.
Hi, Google specifies id to be a string in view_item_details (and possibly others) event (https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtag#view_item_details)
In your code it's an integer. While not an issue within ga4, it does cause others like Piwik pro to give errors: "Broken event Error message: Tracking parameter
ec_products
has invalid value. Unable to deserialize ecommerce products JSON: invalid type: integer38625
, expected a string at line 1 column 7"Can this be fixed?
Thanks!