Moving segment assignment serverside

Segments are now assigned server side to prevent us from having to
reload the page with JS after setting a cookie.