OnSubmit & OnClick Goal Tracking in Google Analytics

By Amanda Sides | Jan 16, 2013
More Articles by Amanda


If you know me at all, or Search Mojo, or anyone in the search industry for that matter, we are all big advocates of using Google Analytics to track activity on your site. Having the insight into where your traffic is coming from and what visitors do once they arrive on your site is very valuable to your bottom line, whether you realize it or not.

Goal-setting is important for any aspect of your life, but in this particular instance, for your online efforts. Establish goals in Google Analytics to track conversions that you’ve set as high priority, or even if you’re just curious how many you are getting. The main goal types used are a URL Destination setting, tracking a goal when that specific URL is triggered. You can also set goals for things like if a visitor travels to a certain amount of pages per visit, or stays on the site for a certain length of time.

One conversion type that is under-utilized and could give site owners a lot more insight into mini-goals, or goals that can’t be tracked via the URL Destination type.

Setting Up the “Event” Goal Type

As a quick refresher, to find the goal set-up page, simply log in to your Analytics account, navigate to the profile where you’d like the goal to live, then find the Admin link in the top right.  For this goal, you’ll want to select Active, Event, and then fill out the Goal Details as appropriate. I tend to only use Category, Action, and Label, and choose the “that matches”option.

google analytics event tracking

When to Use “Event” Goal Tracking

Good examples of actions that could be tracked with event goal tracking are PDF downloads, form submissions that don’t have the confirmation page on a new URL, or forms that direct to a third party site, where your Analytics tracking will most likely end.

OnSubmit Event Tracking

You’ll want to use onsubmit code to track form submissions (in the event that you are unable to track with a more traditional method). The code would be placed at the opening of the form code, not on the submit button. Here’s an example of the onsubmit code within the beginning form code:

<form id=”pledge-form-home” action=”take_pledge_handle” method=”post” onsubmit=”_gaq.push(['_trackEvent', 'Sample Category', ' Pledge', 'Sample Label']);” >

OnClick Event Tracking

You’ll want to use onclick code to track a click on a specific button or link. For instance, we have a client right now where we track the form submission for a program guide download, and also track the physical click on the download button on the thank you page to see how many leads end up actually downloading. Here’s an example of what your onclick code would look like:

<a href=”files/ProgramGuide.pdf” onclick=”_gaq.push(['_trackEvent', 'Sample Category', 'Download', 'Program Guide'], ['_trackEvent', 'Program Guide', 'Website']);”><span>Download</span> the program guide</a>

For more information on how to set up goals in Analytics, visit the Analytics Support Center.

Share this article

Share on LinkedIn Share on Twitter

Receive Monthly Digital Marketing Tips

Subscribe to monthly updates from the Marketing Mojo Blog to get the latest digital marketing tips, best practices and insights - hot off the presses and straight to your inbox!

 

Blog Search