This question has been answered by multiple community members. See the first response.
switch ($modx->event->name) {
case 'OnManagerLogin': $user->addSessionContext('web'); break;
case 'OnManagerLogout': $user->removeSessionContext('web'); break;
}