Google Analytics Pro – .product class missing

This topic has 5 replies, 2 voices, and was last updated 6 years, 8 months ago ago by Olga Barlow

  • Avatar: bindebale
    bindebale
    Participant
    August 15, 2017 at 11:07

    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

    4 Answers
    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    August 15, 2017 at 16:01

    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

    Avatar: bindebale
    bindebale
    Participant
    August 15, 2017 at 16:10

    Hi,

    Yeah, it’s working – thanks!

    Avatar: bindebale
    bindebale
    Participant
    August 15, 2017 at 16:23

    One more thing – can I prevent it from being overridden during an update?

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    August 16, 2017 at 10:44

    Hello,

    We’ll add this fix in next theme update.

    Regards

  • Viewing 5 results - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.