Add Analytics events.
First whack at consistent code style.