Add analytics code

Resolves #12