url endpoint to track unauthenticated users before redirecting to final url

* cookie users that load urls with the pattern /$cookie_url_base/user_id/redirect_url and redirect them to redirect_url
* implemented a local get_current_user_id() function to return either the id of an authenticated user or the id of the cookied user

see https://github.com/GigaOM/legacy-pro/issues/3168