I read that there is no way to stop anxiety peeing. You have to stop the anxiety. This isn’t intentional peeing, it is an automatic response by puppy when she/he is overexcited or scared. If it is overexcitement causing the issue then you expose her to that excitement (have friends come over one day and knock on the door one by one for example). If it is being scared then perhaps examine what behaviors are making her scared, maybe not raise your voice.
The same methods you use to train a dog to potty outside normally will not work for this type of peeing because it is an automatic response to a stimulus. It is not intentional or lack of bladder control or not knowing where to pee. Also make sure your dog goes potty outside before being excited so there bladder isn’t full.
When potty training (under normal circumstances) positive reinforcement works best. You are using punishment. What works is to have them pee outside and immediately reward them for doing so. After awhile you don’t have to reward, we do but it’s not necessary.