Generate a unique hash/number for tracking on $wpdb insert

The userid will not exist until the user is inserted, you would need to do a second update for that. You may be better off using PHP’s uniqid(), perhaps with the user’s email as a salt/prefix to avoid a race condition (however unlikely).