Hi Nicola,
Sorry for the late reply.
Could you post the URL of your site so that I can have a look at the add to cart events?
Hi Thomas, thank you for your reply.
The site is https://www.paoul.com/
Consider that for testing pourpose I modified your gtm4wp-woocommerce-enhanced.js script. To be honest, I think that there is a bug in that script (a GA4 event triggered inside a UA trigger event) but I do not remember the line.
You should be able to download the modified script to check the differences.
Hope to read soon from you!
Thank you!!
I found the line of the original script: 756 for the following code
// fire ga3 version
window[ gtm4wp_datalayer_name ].push({
'event': 'gtm4wp.productClickEEC',
'ecommerce': {
'currencyCode': gtm4wp_currency,
'click': {
'actionField': {'list': dom_productdata.getAttribute( 'data-gtm4wp_productlist_name' )},
'products': [ product_data ]
}
},
'eventCallback': function( container_id ) {
if (window.gtm4wp_first_container_id != container_id) {
// only call this for the first loaded container
return true;
}
// fire ga4 version
window[ gtm4wp_datalayer_name ].push({
'event': 'select_item',
'ecommerce': {
'currency': gtm4wp_currency,
'items': [ gtm4wp_map_eec_to_ga4( product_data ) ]
},
'eventCallback': function() {
if ( ctrl_key_pressed && productpage_window ) {
productpage_window.location.href = dom_productdata.getAttribute( 'data-gtm4wp_product_url' );
} else {
document.location.href = dom_productdata.getAttribute( 'data-gtm4wp_product_url' );
}
},
'eventTimeout': 2000
});
},
'eventTimeout': 2000
});
Thanks!
Your Siteground optimize is loading a minified version of the mentioned JS file which makes is quite hard to compare what are the changes in your version.
What I can see from the GTM debug tool is that you’ve added lots of extra data layer pushes to null the ecommerce variable. That is mentioned in Google’s docs since a while but the implementation in GTM4WP does not need this if you setup tracking the guide provided on the plugin website.
Could you save a copy of your modifications and revert back to the original script?
Here you can find the modified script:
https://www.paoul.com/wp-content/plugins/duracelltomi-google-tag-manager/js/gtm4wp-woocommerce-enhanced.js
What I can see from the GTM debug tool is that you’ve added lots of extra data layer pushes to null the ecommerce variable. That is mentioned in Google’s docs since a while but the implementation in GTM4WP does not need this if you setup tracking the guide provided on the plugin website.
You are right. That was a try!
Basically, I have commented out the GA3 pushes and added the currency to the ga4_product var at row 20
// default, required parameters
let ga4_product = {
'item_id': productdata.id ? productdata.id : '',
'item_name': productdata.name ? productdata.name : '',
'item_brand': productdata.brand ? productdata.brand : '',
'price': productdata.price ? productdata.price : "",
'currency': productdata.currency ? productdata.currency : gtm4wp_currency
};
Thanks!
Could you revert it back to the original version to that I can check how your site behaves using it?
Script reverted and excluded from minification!
I see this details…
In Analytics: https://tinyurl.com/ybvuyj3n
(and I don’t understand the value 199000000)
In the Tag assistant I see 2 events: do you know why?
https://tinyurl.com/ycgvwmy4
https://tinyurl.com/y7p5nwwq
The problem is that I do not see the revenue in GA4 reports. The Google assistance team told me to check the currency….
“Dopo aver fatto maggiori verifiche all´interno del suo account, ho potuto constatare che c’è da verificare che sia impostata la corretta valuta.”
I do not what else to check…