This is pretty much spot on. The order in the cookie will be:
- domain user_id
- cookie creation timestamp (epoch)
- domain session index (visit count)
- current visit timestamp (now)
- last visit timestamp (empty if no previous session)
- session id
Rather than parsing the cookie you may be able to grab some of these values directly (assuming the tracker is on the page) by using a similar method to the client_session context.