• Hi,

    I am really desperate. In product detail page when clicking on “Add to cart” button the click event is not fired on mobile. On desktop it runs fine.
    On desktop I can set breakpoint on:

    // track add to cart events for products on product detail pages
    document.addEventListener( ‘click’, function( e ) {

    in the gtm4wp-woocommerce-enhanced.js file but on mobile it doesn’t work.
    Please help.

    Kind regards

    • This topic was modified 2 years, 10 months ago by jedyny.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter jedyny

    (@jedyny)

    Well, I have found some solution.
    It works by listening also for an event “touched” which works on mobile.

    // track add to cart events for products on product detail pages
    [“click”, “touchend”].forEach(function(clickType) {
    document.addEventListener( clickType, function( e ) {

    I don’t know if it is a common error or maybe there is something wrong with my site.

    Plugin Author Thomas Geiger

    (@duracelltomi)

    Hi,

    Thank for sharing your findings.
    Don’t you see double tracking of the add to cart event on some devices with this solution?

    I tested click event on woo.gtm4wp.dev and it works with my Android device, at least with USB debugging I can see the add to cart event firing on product detail page with the click event listener.

    Thread Starter jedyny

    (@jedyny)

    That’s very strange. I see that on your site it’s working exactly as design but on mine unofrtunately it doesn’t. Maybe it’s because of the theme I am using (OceanWP). Anyway, I haven’t found any issues with my solution so for now I will stick to it.
    Thanks

    Plugin Author Thomas Geiger

    (@duracelltomi)

    Can you post the URL of your site?

    Thread Starter jedyny

    (@jedyny)

    Plugin Author Thomas Geiger

    (@duracelltomi)

    Hi,

    I checked your site with my Android device using Chrome USB debug helper and I can see both add to cart events:

    https://drive.google.com/file/d/1fbTDl7HVP917oHpM21vlaBQIC4y-zv1_/view?usp=sharing

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Add to cart event not fired on mobile’ is closed to new replies.