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