Added support for Google Analytics events

- Refactored other methods (coding conventions)
- Added comprehensive tests
Merge pull request #1531 from fauvel/issue-1531

Implement Google Analytics event tracking