Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Has anyone setup Google Analytics Goal Tracking with Umbraco Forms?
Ideally, I'm looking for some quick code I could edit or add into place so that when forms are successfully filled out (pass validation) and are actually submitted, it send an event (or whatever is required of GA Goal Tracking) to Google.
I tried a while back with some jQuery to attach to "onClick" & "onSubmit" and couldn't figure out how to not send the event if the form didn't actually submit (ex. form errors).
Even better would be if there's an extension / project that I could load in to accomplish this.
The quickest solution would be to ensure the form redirects to a thank you page which does not appear on the menu and you just add the goal straight into Google Analytics?
That's an okay solution, but non-ideal because it involves creating another page for every form and also removes the ability to have a nice ajax form submission.
My understanding is goals needs to be tied to a URL so perhaps you are confusing Google Analytic goals with Google Analytic events. An event can be added to an onclick / onsubmit / etc but Events and Goals are very different things.
You won't need to create another page for every form to track goals. You could make the thank you page appear based on a route like (e.g. "/page-name/thank-you", "/another-page/thank-you") then in GA you could either track these as the same goal you could specific different goals for each (or even use regular expression to group them).
A work around if you do not want to redirect is to push a page view event straight into Google Analytics along these lines:
If you want to do a Google Analytics event then the syntax is along these lines:
onClick="ga('send', 'event', 'Page Name', 'click', 'Form submission');
On Google Analytics you can setup conversion tracking goals based on events (whoo!):
My issue is that binding the "OnClick" event doesn't result in an actual conversion because all of our forms have at least one required field. So if you don't fill that form field, the click results in no info being sent to the sales team and a validation error shown to the client.
I saw a post here: https://our.umbraco.org/forum/umbraco-pro/contour/28090-Contour-and-Google-Analytics-Goals#comment-162568
Which describes being able to modify the onsubmit logic to fire off Google Analytics events when the onsubmit message is shown.
This is now actually in "ContourForm.cshtml" which should allow me to do what I need.
Write your reply to:
Image will be uploaded when post is submitted