Update ga-event.js

Refactored code for performance, added documentation.