Privacy & settings / select what others see you when you have viewed their profile. You can select as "Anonymous".