You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've run into a situation where values fetched from the item_category field and item_brand handles character encoding differently. I'm keen to get some feedback on why this happens and potential solutions.
In Woocommerce I have this category called "Food & Beverage":
When it's surfaced in the item_category it outputs correctly:
But when that same category value is outputted into the item_brand field it shows up like this:
item_brand is populated with the category as I have that setting enabled in GTM4WP:
The text was updated successfully, but these errors were encountered:
In fact, when diving deeper, it seems to happen inside the item_category alone, see this excerpt from GA4:
I also tested adding secondary dimensions such as Device, Browser Language, Country to the above report to try to see whether the problem is pertaining only to specific dimensions, but that was not the case. Hence I wonder what might cause the character encoding to be different.
I have checked that there is only one Category with this name inside WooCommerce, and the different spelling even occurs on the same page path and same product in certain cases.
henkisdabro
changed the title
Text encoding differs between certain dataLayer keys
Text encoding differs in 'unknown' cases - & vs &
Aug 16, 2022
henkisdabro
changed the title
Text encoding differs in 'unknown' cases - & vs &
Text encoding differs in unknown sitations - & vs &
Aug 16, 2022
I created a Custom Javascript variable inside GTM that solves the above matter for me, but I'm not sure it's the best way to do it. It would be insightful to know what causes this encoding inconsistency to happen (in some cases, not all), and resolve it on the plugin side right away, but for now this solution works for me, here's the GTM code to the Custom JS variable in case it helps someone else. Ensure to adjust the {{ecommerce.items}} variable name to match the variable within GTM that returns the ecommerce.items array.
I've run into a situation where values fetched from the
item_category
field anditem_brand
handles character encoding differently. I'm keen to get some feedback on why this happens and potential solutions.In Woocommerce I have this category called "Food & Beverage":
When it's surfaced in the
item_category
it outputs correctly:But when that same category value is outputted into the
item_brand
field it shows up like this:item_brand
is populated with the category as I have that setting enabled in GTM4WP:The text was updated successfully, but these errors were encountered: