Then use a command like sit and reward the positive behavior immediately to reinforce commanded behavior instead of barking.
Train your dog not to bark.
Repeat the process multiple times.
To train dogs not to bark avoid responding with shouting since your dog may interpret this as positive attention.
When your dog understands and stops barking use your clicker and a treat.
However you will have to do more than not pet them as even.
If your dog is excessively barking for attention a way to undo this behavior is to ignore them.
Stop feeding treats as soon as your friend and their dog disappear from view.
If that doesn t work try distracting your dog by dropping something opening the pantry or giving it something else to investigate.
Remember not to try to progress too quickly as it may take days or weeks before your dog can pay attention to you and the treats without barking at the other dog.
Have a friend with a dog stand out of sight or far enough away so your dog won t bark at the other dog.
If you re in your home teaching your dog to go to their spot when people approach the front door will also help distract them while establishing a pattern of staying quiet when visitors arrive.
As your friend and their dog come into view start feeding your dog treats.
Right after you use your voice command and your dog stops barking click twice and give your dog a treat.
Use dog treats to hold your dog s attention until the other people pass by only rewarding your dog if they don t bark.