Make sure you're safe, stay calm and exchange information.
First and foremost, make sure you, your loved one, or pet, are out of harms way. Once you've determined that you are safe, exchange information with the dog's owner. Whether the attack occurred with a stranger's dog or happened with someone you know, stay as calm as possible and make sure you have all their contact information. They may ask you to not report the incident or try to minimize what happened. Hopefully that will not happen, but if it does, you owe the owner of the dog who attacked you no explanations or promises. Right now the most important thing is to be safe and get medical treatment for the injury.