Moving segment assignment serverside

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