Implement track_by_identity for get_attempts_num

Thanks to @LuCiAn0 for pointing this out