The only way to keep your data when doing a factory reset is to back it up and restore it when the reset is complete. Google's built-in backup feature is the easiest way to back up your data.