I am using Universal Analytics for one of my Websites. I want to track an Analytics Event with an onsubmit on my form. The onsubmit is working perfectly, but the event is not tracked in analytics.
The form tag:
form onsubmit="ga('send', 'event', 'Formular', 'Submit', 'Contact')" id="contactform" class="news-form" action="thankyou.html" method="post">
I think this is the right way to track events with the new analytics. Can anyone help me or give me some advice what to check?
The problem is that the request with the tracking information to analytics might or might not finish before the browser loads the next page. To avoid this you could use the hitCallback feature of universal analytics: