If the id is to live throughout the session, then you could write it into the session cookie.
Do this using:
ad_set_client_property mymodule idname value
Then you could do something like alter the request processor such that it will put your id into the ad_conn array.
Then you would read it like:
set my_id [ad_conn idname]
Alternatively you could just read from the cookie every time.
set my_id [ad_get_client_property mymodule idname]
Hope this helps