• Resolved kubawlasny

    (@kubawlasny)


    Hello,

    After using the plugin for a while I noticed that not all of the events are tracked in my GA account. Namely the “add to cart” actions are not counted.

    I would be grateful for any tips on how to solve that issue!

    Thanks!
    Jakub

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Michael K

    (@mikkamp)

    Automattic Happiness Engineer

    Hi Jakub,

    I had a look at the page and it looks like it’s missing some of the JavaScript code for tracking when an add to cart button is clicked.

    Would you be able to confirm whether the following options are enabled in the settings (WooCommerce > Settings > Integration > Google Analytics):

    – Enable Universal Analytics
    – Add to Cart Events
    – Enable Enhanced eCommerce

    If any of those options is not enabled then it won’t include the JavaScript code to track the main add to cart button for the single product page.

    Thread Starter kubawlasny

    (@kubawlasny)

    Hi @mikkamp,

    Thank you for the answer!
    Yes, all of theses options are (and were) enabled.
    Do you have any other idea on what might cause the JavaScript code to be missing?

    Plugin Author Michael K

    (@mikkamp)

    Automattic Happiness Engineer

    Hi Jakub,

    I’m not quite sure why it wouldn’t be displaying if all those options are enabled. The only other check I see it does for that code is confirm that it’s on a single product page, but that seems to be the case if I look at classes which are set on the body element.

    When I compare it to my test site, the location where I’d expect to see the JavaScript code, I see a section with the following comment:

    WooCommerce Facebook Integration Event Tracking

    Could it be that this code snippet conflicts somehow? I’d try a conflict test as is described here to rule out any issues like that: https://docs.woocommerce.com/document/how-to-test-for-conflicts/

    If you look at the page source you should be seeing a section like this added towards the end of the page:

    
    $( '.single_add_to_cart_button' ).click( function() {
    	ga( 'ec:addProduct', {'id': '#123','name': 'Product Name','quantity': $( 'input.qty' ).val() ? $( 'input.qty' ).val() : '1'} );
    	ga( 'ec:setAction', 'add' );
    	ga( 'send', 'event', 'UX', 'click', 'add to cart' );
    });
    

    When I check a single product page on your site only that part seems to be missing. The odd thing is that it does add the add to cart tracking code for the related products that are shown on that page.

    Plugin Author Michael K

    (@mikkamp)

    Automattic Happiness Engineer

    Hi @kubawlasny,

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add to cart events not showing in Google Analytics’ is closed to new replies.