Organizational Research By

Surprising Reserch Topic

track event in google analytics upon clicking form submit


track event in google analytics upon clicking form submit  using -'javascript,jquery,google-analytics,analytics'

I need to track an event in google analytics when someone fills out a form and clicks submit.  The resulting page that comes up is a standard dashboard-type page, so in order to track the event on that page I'd have to pass in the event in the url and then read the url and output the google analytics event tracking javascript code based on it.  This is a frequently bookmarked page though and page that is reloaded, clicked back to, etc.  So I'd really rather not pass tracking events in the URL and screw up the analytics.

Instead, I'd much rather do something like the following jQuery code on the page with the form:

$('#form_id').submit(function() {
  _gaq.push('_trackEvent', 'my category', 'my action');
});


The problem I fear with the above is that I'm going to miss some events being tracked because immediately after calling that javascript the browser is going to submit the form and go to another webpage.  If the utm.gif tracking image isn't loaded in time, I miss the event :(.

Is my fear justified?  How do I ensure I don't miss events being tracked?
    
asked Oct 13, 2015 by manju bhargava
0 votes
7 views



Related Hot Questions



Government Jobs Opening


...