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
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
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 6 years 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
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.