It is probably what is known as submissive peeing. That is in part an excitement problem, but also the puppy showing her submissiveness to you.
Things that can help are delaying petting her until she is calm, and avoiding standing or leaning over her when you pet her. The latter is very easy for us humans to do, since we're much taller than the dog - but in dog terms is something of a dominant gesture. You may find that things go better if you somewhat get down on her level, or perhaps sit on a chair and call her over for petting, rather than doing it from a standing position. Likewise, I'd suggest petting her chest and sides, and not her head at the beginning, and also avoid enclosing her in your arms (same reasons - they're somewhat dominant gestures)
Most likely she'll outgrow this - the vast majority of pups do. But in the meantime, I would suggest that you don't pet immediately or when she's excited, and avoid getting her excited by the petting (i.e. pet very calmly), and also try the sorts of petting gestures that are quite natural to humans, but do have dominant overtones to dogs.