Question: how to train a dog not to pee when scared?
Answer: Reduce the excitement level upon entering the home.
Take your pet outside immediately after you get home with little or no fanfare.
All humans should stay calm. ... 
Teach alternative, calm behaviors for your pet to do when they start becoming excited: Sit, Stay, Down.