• Resolved khannamanu

    (@khannamanu)


    Hi,

    I would like to track form signs up in my Google Analytics tracking. What would you recommend as the best way to set up a custom tracking event every time a user clicks the ‘submit’ button?

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Ales

    (@alesmal)

    Something like this should work, insert this code to Custom Analytics settings together with Google Analytics code.

    <script>
    document.addEventListener('DOMContentLoaded', function() {
     const submitButton = document.getElementById('submit-subscribe');
     submitButton.addEventListener('click', function(){
      ga('send', 'event', 'Subscribe Click', 'Subscribe Click');
    });
    }, false);
    </script>

    Ales

    Thread Starter khannamanu

    (@khannamanu)

    Hi Ales,

    Thanks for the code. I’m not able to find a custom analytics option. Where do I find the Custom Analytics setting? Is it within the CMB plugin?

    Plugin Author Ales

    (@alesmal)

    Yes, it is under SEO & Analytics > Website Analytics > Other where you can insert any Javascript.

    Ales

    Thread Starter khannamanu

    (@khannamanu)

    Hey Ales,

    Thanks for the help. So I entered the code into that section when I posted the previous reply. We have had some people sign up using the form since then, but Google Analytics is still not recording any events. I have changed the date filter and tried refreshing multiple times.

    The code is visible when you inspect source but looks like it still isn’t recording an Analytics event.

    What else do you recommend trying?

    • This reply was modified 4 years, 6 months ago by khannamanu.
    Plugin Author Ales

    (@alesmal)

    It seems you are using Googletagmanager, which I don’t have experience with, the code above should be working with standard Google Analytics.

    It might be very similar, but you might wanna check Googletagmanager docs how to track events and maybe change that code a little bit.

    Ales

    Thread Starter khannamanu

    (@khannamanu)

    Hey Ales,

    I removed the Googletagmanager code and unfortunately still don’t see events populating on Google Analytics – using the code you had suggested.

    I also tried tracking a click event using a different WordPress plugin, called WP Google Analytics Events but it still did not register any events.

    Is it possible that something within the CMP plugin is blocking GA events from being tracked? Trying to figure out a process of elimination to solve this issue.

    Appreciate your continued assistance.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Google Analytics Tracking’ is closed to new replies.