Just like with any unwanted behaviour in dogs, it's important to above all know that if it's being practiced by our dogs, it's because it's a behaviour that works for them, not to hurt us or to be disobedient.
With that said, if you'd like to ensure that your dog is less likely to want to repeat the unwanted behaviour, you want to make sure that you are providing your dog with the following:
1. Ongoing awareness of how and what your dog is feeling, especially when you're experiencing difficulties with your dog's behaviour.
Dogs react to others and their environment, and just how they react is something we have a say over if we're able to take the time and help tailor their environment in order to encourage them to react in a different, better way.
An example of how we can change our dog's environment for the best in order to positively affect their feelings and emotions is by walking them away from a scenario or setup to help them take a break, such as during play with other dogs (especially at the dog park) before inviting them to come back. Though takings breaks may not always be necessary, they never hurt and can help your dog better manage his/her own emotions, thus preventing the need for them to exhibit a behavior that could be indicative that they needed a break, sooner. Such as barking, whining, pacing, and jumping.
2. A strong bond and relationship with you.
Dogs perform their best when they know what options and choices they can make in order to feel better in different situations, and the most reliable way for them to figure out what those good decisions are is through the guidance of their pet parent.
When it comes to having a strong relationship with your dog, more than obedience, commands, and anything else, the most important attribute to it will be that your dog and you have an open line of communication, where you know when to listen to one another, and how to speak to each other.
An example of this is when you're regularly acknowledging good choices your dog makes naturally, which will often be the complete opposite of unwanted behaviours. Such as when your dog lies down instead of jumping, or when they choose to walk away instead of barking. Recognizing and rewarding these good decisions will let your dog know that you're listening and focusing your energy on letting them know what behaviours you do like, which ultimately encourages your dog to repeat those above others.
3. Regular outlets to their physical and mental stimulation needs.
Physical enrichment can consist of going for runs, playing fetch, tug and pull games, using a flirt pole and mental enrichment encompasses training classes, nosework and scent detection games, puzzles, snuffle mats, and new/different activities you and your dog experience together.
Got some of these outlets down pat? Awesome! Next, it's time to focus on the actual behaviour you want to tackle. Practice addressing the issues you're looking to modify when your dog is feeling relaxed and mellow from the above activities. A mellow and tired brain is more likely to 1. Not practice the unwanted behaviour (in which case you can then mostly focus on rewarding the desired behaviour) 2. Provide you with a dog that is more likely to follow your guidance thanks to your connection, and this is key. Providing guidance is your main and best training tool, as you practice going through the scenario which normally leads to the unwanted behaviour, but in a way where you are keeping a close eye on the patterns and indicators that it's about to happen, but instead of just letting it happen, you can there and then interrupt the habit by guiding your dog's body and mind into something else (like a game, your attention, and affection, or even a toy). The idea with practicing this is that it makes it so your dog doesn't get to repeat the unwanted behaviour as much as possible because you are providing a new habit/behaviour that feels even better for them, that will with time replace old habits.