Google analytics on webform submissions

Briefly summarize the issues you have been experiencing.
I’d like to track form submissions as a google analytics event. From what I’m reading, I need to set up a js call to do so (onclick="_gaq.push([’_trackEvent’, ‘category’, ‘click’, ‘opt_label’]);"). However, when using the Netlify forms, the js is covered by Netlify code, and I wasn’t sure where to inject this eventing.

I’d love to know what the best practice is for setting up Netlify webform submissions as a google analytics event so I can create funnels in GA.

Please provide a link to your live site hosted on Netlify.
www.sparepad.com

What have you tried as far as troubleshooting goes? Do you have an idea what is causing the problem?
Haven’t tried much, looking for guidance.

Not sure how to do this since we don’t use GA on our forms, but hopefully other customers do. My basic workflow would probably be to use some special GA call on your form submission thank you page. Since you can set a custom page with your own html and javascript in that (or you could run your own JS to report, when form submit button is used), I’d think you can do “whatever you’d like” as far as reporting to GA at that point.

The best practices I’m not sure of are around whether that’s a campaign or how to track it there - but I bet someone else here IS good at GA whereas our Support team doesn’t work with GA too much.

That’s right. I ended up solving it by adding javascript that triggers when a form submits. Basically following this guide

https://developers.google.com/analytics/devguides/collection/gtagjs/sending-data

1 Like