Home Forums WoodMart support forum scrollToTop button

scrollToTop button

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #250037

    Inzman
    Participant

    Hi.
    I want to track “scrollToTop” button on click, but it is “return false”. How can I track it with GA?
    Thanks.

    #250089

    Hello,

    Please deactivate all the plugins not related to the theme and switch the parent theme, check the issue, If the problem has gone, activate the plugins one by one, checking the issue to detect which one causes the problem.

    if the problem remains, provide your site admin access to the private area.

    Best Regards

    #250746

    Inzman
    Participant

    Hello.

    $(document).on('click', '.scrollToTop', function(){
      console.log('Back to top');
    });

    So this works for you?

    #250879

    Hello,

    Please have a look at the site: https://woodmart.xtemos.com/ the top button works on click. It appears when the page is scrolled down to the button and returns the user up on click.

    If your button works in a different way, deactivate all the plugins not related to the theme and switch the parent theme, check the issue, If the problem has gone, activate the plugins one by one, checking the issue to detect which one causes the problem.

    Or clarify your purpose.

    Best Regards

    #250886

    Inzman
    Participant

    Yes, I understand it does what it is supposed to do.

    But I also need to add an extra action to it, but in code, there is “return false” and I can’t add the extra event. And I don’t understand why “return false” is needed in your JS.
    I want to track whether visitors are actually using this button or is it just wasting viewport room.

    $('.scrollToTop').on('click', function () {
      $('html, body').animate({
        scrollTop: 0
      }, 800);
      return false;
    });
    #251058

    Hello,

    Please add this code to the Theme Settings > Custom JS > On document ready:

    jQuery('.scrollToTop').on('click', function(){
      console.log('Back to top');
    });

    Best Regards

    #251068

    Inzman
    Participant

    Ahh, wasn’t aware of this option. Now it works, thank you, problem solved!

    #251102

    You are welcome! If you have any questions please feel free to contact us.

    Best Regards

Tagged: 

Viewing 8 posts - 1 through 8 (of 8 total)