How to set and retrieve cookies?
Drupal already sets a session cookie when a user logs in: see the function drupal_session_regenerate(). 

Can you use this session Id for your purposes? If not, then you just need to create a new value in the cookie the same way that you will do in PHP, $_COOKIE['my_value'];. Place this code in the hook_init() of a custom module, adding a if() to filter the landing page.

Later, you retrieve it and use it in your view; you can use some of the hooks of Views depending on your needs. You can also use the module Views custom field, and embed your PHP code there.