I faced a problem in Google Analytics that finally resolved. Thanks to the awesome Stackoverflow.com. This is the original thread.
Google Analytics was not tracking my event of downloading document generated dynamically.
When the user click on the "Export to Word" button, the event should be tracked, and after it, the download start. Google Analytics tracks events in asynchronous way (of course) so, when the form was submitted, the event was not tracked because there is not enough time to do it.
The JSF form with problem:
After trying some proposals of the guys helped me, I mixed the solutions and got this with jQuery:
I did not like the code, but is the only that worked for me in any browser (Safari, Chrome, Firefox and Opera).