I have a javscript code wich record visitors interaction with the website (like calculating max scroll position, mouse movement in pixels, etc). However, these statistics are valid, only if the user stops interacting with the page. (he leaves, clicks a link, closes the browser, etc)
Is it possible to do a _gaq_push when this happens? If so, how?
Have you tried adding your push calls to the window.onunload event?
This should work.
However, it's worth noting by pushing an event to Google Analytics, it affects bounce rate calculation, which in your case would cause it to appear that users never bounced. So you must include that last parameter, and set it to
true
.