Hello there,
since we managed to resolve issues with more important events, our web analysts now noticed another problem - this time with the view_item
event.
On our website, we are using a lot of variable products. Unfortunately, the data sent with the view_item
event are incorrect and there are multiple situations were the problem appears:
- When using a parametrized URL such as: https://www.jagaia.cz/produkt/breathein/?attribute_pa_obsah=33ml, you can see that the item ID send in the event is correct - it is in the format of
productId-variantId
where both IDs are correct, but the rest of the item’s data are incorrect. I checked the source code inmergado-marketing-pack/src/Service/External/Google/GoogleAnalytics/GA4/Ga4ServiceIntegration.php
and it is quite clear that the variant only influences the item id and nothing else - for example the prices or categories are obtained for the “parent” product, not the correct variant. I believe this is incorrect behaviour. I am also unsure why is there the need for thisproductId-variantId
format. To me it would seem more reasonable to just have the variantId here same as you do withadd_to_cart
orpurchase
events. - When not using the parametrized URL, the source code just doesn’t take variants into account at all. I understand that one could think that in that scenario you don’t have information about the displayed variant (or that there is no variant displayed) but that’s true only sometimes. Woocommerce supports default variations which we use on our website, so if there is not a parameter in the URL, the wbsite will display the default one. I believe this would be true not just for our website and I believe the tracking should respect this WooCommerce settings.
I believe the fix for both of these problems should be quite easy - just fetch the product by the variation id before obtaining any information for the event. Btw just be careful not to override the global $product
variable as it could break many things.
Looking forward to your reply!
Honza