Open joeprongen opened 2 months ago
I Would like to add in on this issue. Here is a screenshot of the issue with the received data. Here you can see that the item_category includes & instead of the & that is inserted in the sent data
@duracelltomi Could you please help us with this issue?
Hi,
Sorry, I was on vacation. Could you post the URL of this website?
Data in view_item is encoded to a JavaScript object using the json_encode PHP function which creates this output. Since I am not aware of any flag that could change this behavior, probably one solution could be to do a simple search&replace in the code of GTM4WP.
@duracelltomi No problem! Hope you had a good one
An example page ; https://www.bbqexperiencecenter.nl/modular-egg-workspace-met-kast-inclusief-big-green-egg-lar/ When searching for item_category in the page source you can see the &
hi @duracelltomi
Did you have any chance to look into this already?
Thanks in advance
I did some testing recently but I am not sure this can be fixed in all places.
For example on single product pages, product data is stored in an input node's value parameter. To make the code safe, I need to route the value through esc_attr() which will always encode & even if I revert back the encoding after calling json_encode.
Revering back what esc_attr() returns will trigger signals in security checks.
Hmm alright.. I understand the issue. Unfortunately this issue is giving us different information on the pages, so it's quite annoying for us.
Couldn't you push the data with JS and parse it there? Could also become a filter to avoid problems in other scenario's
We have some product categories with a & sign in them, but for some reason the view_item_list and view_item events show them differently, which is affecting our tracking of these categories.
VIEW ITEM LIST
VIEW ITEM ecommerce: { currency: "EUR", value: 3332, items: [ { item_id: 892548, item_name: "Modular Egg Workspace met kast inclusief Big Gree" + "n Egg Large", sku: "6017429198120", price: 3332, stocklevel: 10, stockstatus: "instock", google_business_vertical: "retail", item_category: "Buitenkeuken & tafels", item_category2: "Big Green Egg Modular Outdoor Workspace", id: 892548, item_brand: "" } ] }
We cant seem to find the reasons this is going wrong, it all seems the same function. Do you have any idea? Or can you reproduce it?