Track HTML Forms Using Google Analytic Events

Lets say you have lot of forms and you want to track submission of those all forms,

its not always easy to track each one. but now GA made it easy for you. all you need to have a GA account and a profile for you website. you can have multiple forms and any other category in your website that is know is events for Google Analytic, you can easily track it using goals.

lets start with simple tracking.

<a href="idm.html" 
onclick="_gaq.push(['_trackEvent', 'downloads', 'IDM', 'tracking IMD downloads counts']);">
Download Internet download manager</a>

above tracking will be used for an click event for any link or button. _gaq.push function will put data to you GA account like its doing for other parameters. may be you have observed there are a lot parameters which actually GA passes data to show you a complete tracking profile.

bellow is a simple form called bio

<form action="submit.php" method="post" name="bio" onsubmit="_gaq.push(['_trackEvent', 'forms', 'bio', 'submitting bio form']);">
<input type="submit" value="submit" />
</form>

now look at the syntax of _gaq.push function, after _trackEvent next parameter is category which we have forms, because here we want to track lot forms, so we made a category forms. and then form name (event name) and the third parameter is somewhat details about our event. its optional , you can leave it blank, but you must need to put an empty string ”.

in this way you have a category and you want track lot forms , name each form and create a new goal for that form and fill details. you can also take help form my previous post how to fill details of goal