Redirect when not logged in
Refactor analytics tests