If you run, the dog will instinctively try to catch you. It will see you as prey to chase down. Instead, you want to make yourself seem like you aren't a threat and aren't prey. Protect your torso and face by lifting your knee in front of your body. If the dog does bite or scratch, it won't be able to reach your stomach, neck, or face. Larger breeds instinctively go for your face, so block them with your arms. Crossing your arms will put up a stronger barrier than just flailing your arms in front of your face. Further protect your head by tucking it under your arms. Lean your head forward and fold your crossed arms backward so that your head is covered. Since dogs have prey instinct, curling into a ball can end the dog's urge to attack. While you may be afraid to lay on the ground, it's the safest option during a dog attack. Just play dead.  Don't move or try to scoot away. Just curl as tightly into a ball as you can. Remove any items of clothing that may be around your neck since the dog may pull on it to play tug-of-war, which could strangle you. Fight back only if the dog is small. Fighting back can make the dog fight harder, especially if it's a larger breed that can overpower you. Don't try to engage the dog at all while you're on the ground. That means don't look at the dog, don't try to talk to it, and don't try to sooth it by petting it. The dog is in attack mode, and engaging with it will only antagonize it more. You can continue to shout commands if you've chosen to do so. The dog will only struggle to bite harder and hold on if you try to pull away. Additionally, you can rip the skin more and make your wound worse.
Avoid running away. Bring your knee up. Cross your arms in front of your face. Roll into a ball. Ignore the dog. Avoid pulling away if the dog bites you.