This topic has 5 replies, 2 voices, and was last updated 7 years, 4 months ago ago by Olga Barlow
Hi,
Recently I’ve bought the Google Analytics Pro plugin and most of its features work fine. However, GA isn’t tracking product clicks (support said that’s because of lack of the .product class). Here is their message:
“There is a conflict with the theme – something is preventing Google Analytics Pro from tracking clicks on product links in the catalogue. It looks like the theme is missing the .products CSS class on the HTML element that contains the products, which is what our tracking code expects to find. This is a standard in the WooCommerce templates, which your theme seems to be overriding.
I would suggest contacting the theme author and report that their theme is currently not compatible with Google Analytics Pro. For reference, here’s how GA Pro tracks product clicks:
$( '.products .post-12165 a' ).click( function() {
if ( true === $(this).hasClass( 'add_to_cart_button' ) ) {
return;
}
ga( 'ec:addProduct', {"id":"MJA2","name":"Amelia Yoga Mat","brand":"","category":"Yoga Mats","variant":"","price":"259","quantity":1,"position":2} );ga( 'ec:setAction', 'click', {"list":"Archive"} );ga( 'send', {"hitType":"event","eventCategory":"Products","eventAction":"clicked product","eventLabel":"Amelia Yoga Mat","eventValue":null,"nonInteraction":false} );
});
”
Is there a way to fix it?
Best,
Kuba
Hello,
Open xstore/woocommerce/loop/loop-start.php and add the class http://prntscr.com/g8sdbd , save and check if everything works fine after that. Let me know about results.
Regards
Hi,
Yeah, it’s working – thanks!
One more thing – can I prevent it from being overridden during an update?
Hello,
We’ll add this fix in next theme update.
Regards
You must be logged in to reply to this topic.Log in/Sign up