Fix bug 1081340: Measure generic login and logout

Supersedes https://github.com/mozilla/kuma/pull/2814 with rebase to fix travis ci build.