Adding analytics code; closes #158