Tracking via Google analytics

Hi!



I’m trying to track signup clicks in google analytics to measure how well the ad network is going. I know I can track it in Mautic, but that doesn’t easily show their search query, nor ties into how well my ad spend is going.



I was previously using mailchimp, and I modified their form to include an ‘onSubmit’ that called googles ga(“send”…) function. I’ve tried the same thing with the mautic form code, and ended up somewhat breaking the form. :(

I then tried playing around with moving this code elsewhere in the form with no success.

I know I can trigger google tracking if I redirect the form to a new page (standard include of the google tracking url), but how do I track it when the user stays on the page and gets a message?



Before I go hacking away at the core code and break it terribly, I’m wondering if someone else has an easy ish solution?



Thanks!

Hi!

I’m trying to track signup clicks in google analytics to measure how well the ad network is going. I know I can track it in Mautic, but that doesn’t easily show their search query, nor ties into how well my ad spend is going.

I was previously using mailchimp, and I modified their form to include an ‘onSubmit’ that called googles ga(“send”…) function. I’ve tried the same thing with the mautic form code, and ended up somewhat breaking the form. :frowning:
I then tried playing around with moving this code elsewhere in the form with no success.
I know I can trigger google tracking if I redirect the form to a new page (standard include of the google tracking url), but how do I track it when the user stays on the page and gets a message?

Before I go hacking away at the core code and break it terribly, I’m wondering if someone else has an easy ish solution?

Thanks!

Finally solved it…

By using onClick instead of onSubmit. So in the html of the form, you’ll see something like:

Yes, Click Here!

Add in the onclick code calling the ga event:

Yes, Click Here!

Anyone know if there’s a way (or a plan) to have that in the mautic interface, rather than editing the html?

This worked great - thanks