There are a few reasons why your dog might pee when you leave the house. Anxiety is probably the most common reason - being left alone can be very stressful for animals, and they may find it difficult to relax and control their bladder when this tension is building up. Another possibility is that they're unable to focus on anything else other than using the bathroom, which can lead to them accidentally urinating when concentrating on something else. Finally, if there's something unusual or subtly frightening in the environment surrounding you (a new person or object, for example), your dog might feel overwhelmed and want to evacuate their body by urine spraying.