When dogs greet someone that they really like or someone that really intimidates them they can pee. Dogs also use body language as we know like avoiding eye contact, crouching down and tucking the tail between their hind quarters. Urinating can be another type of body language to express their "respect" for a person.
Young Dogs=Young Bladders
With puppies they obviously can not hold their bladders like older dogs and so when they become excited they accidentally wet the floor. In addition, puppies are usually in their crates for a few hours, with full bladders when their owners come home to relieve them so that doesn't help the situation either.
Submissive Peeing In Older Dogs
However some older dogs that lack confidence will do this as well as a sign of submission.
Dogs In Trouble
Other dogs will urinate if they are in trouble for something they did. When the people that they love yell at them and show them their displeasure they may urinate as a sign to say they are sorry. We also see this amongst dogs, not just humans.
What Can You Do?
Come home quietly! We are so happy to see our fur kids when we get home and we show them how excited we are by our body language and our voices. It's hard not to be happy but what we can do is not make a fuss about seeing them. Being quiet and calm until we can get them outside to go potty and then reward them after they peed outside can help tremendously with this common problem.
Go outside as soon as you come home
Don't check the mail or put your coat in the closet. Make your first priority to head for the back door.
Keep their kennel as close to the door as possible so there is little space between their crate and the great outdoors.
Teach them basic obedience
The best way to teach a dog to stay calm when greeting them is to teach them basic obedience such as sit and stay or lie down. So set the tone by giving them something to do when you see them, then reward them with a lovely greeting and a treat after they go potty where they are suppose to.