I want to use event tracking to record clicks by type of a specific type on another website. I am using jQuery, and the code that I have now is:
$('a.website').click(function(event) { var href = $(this).attr('href'); try { _gaq.push(['_trackEvent', 'website', 'click', href]); } catch(err) {} });
However, when I see the referrer information from another site, I do not believe that it accurately tracks clicks, possibly because _gaq.push is asynchronous and the request was not received before the browser goes to the URL and terminates any javascript on the current page.
Is there any way to detect that the _gaq.push function completed successfully, so I can use event.preventDefault() and document.location to go to the link after the event was recorded?
javascript jquery google-analytics event-tracking
Matt Austin Nov 16 '11 at 5:16 2011-11-16 05:16
source share