At the dog training place, there was a thing they called "the dog walk." It was a narrow wooden platform, maybe five feet high and eight feet long and maybe a foot wide; sloped ramps down to the floor added maybe six more feet at either end. The ramps had little ridges across them, to help with footing, and the whole thing was covered with a scratchy black artificial surface for traction. The proportions and angles are wrong, but it was sort of like this:
The idea was, you would walk your leashed dog over to the foot of the ramp on the left, and you would put your dog into a "sit." Then you would put your dog into "heel" and start walking along the right side of the ramp, without leaving enough room between yourself and the ramp for your dog to fit in there, so that in order to stay next to you the dog would have to go up the ramp. "Heel" is the special high-alert command that demands very strict obedience for situations where there might be dangers or distractions and your dog can't be given the latitude to sniff around or follow its curiosity; the dog has to walk directly at your left hip, with their head right next to your leg so that they can see you at all times, and pay total attention to you, and immediately return to "sit" whenever you come to a stop. So you would walk along this ramp, and your dog would have to go up the ramp in order to stay next to you—in order to follow the "heel" command.
For a dog that had never done this before, trying to obey a "heel" command while being led up this ramp would be scary and stressful, because ordinarily a dog would not choose to walk along a narrow ledge; the dog would try to step down off the ledge as soon as it became clear that the floor was getting farther away, and, failing that, would simply try to stop and back away. And then you would have to not allow your dog to either jump off the platform or to simply stop, while also motivating your dog with encouraging talk ("That's it, buddy! That's it!") and by patting the ramp in front of them to get them to try each next step up the ramp. What you could not do is scare or intimidate or punish your dog up the ramp, because that would only make your dog more afraid of the ramp as A Place Where Things Get Worse; eventually the dog would get so distressed that it would flip out and bite you. Also you couldn't bribe your dog up the ramp with treats, both because dogs are big old chickens who will only endure so much fear for the sake of a tasty treat and because there might eventually be situations in which you will need your dog to obey a command despite fear or distraction and likely you will not happen to have any ham handy at that moment, so bribing will not prepare them for that. In short, the only way to get them up the ramp was to persuade them, in a positive way, with encouragement (and by consistently thwarting their attempts at just jumping off of this damn thing), to take each next scary step.
When your dog finally got to the flat platform at the top of the ramp, you would walk your dog out to the middle of the platform, and then stop. This would be your dog's cue to sit, because that's how "heel" works. And this, too, would be stressful for your dog. Ordinarily it would not sit down on a narrow beam five feet off the ground; it would get off of that thing as soon as it could. But you would encourage your dog to sit, and then it would sit, shaking with anxiety, and you would very calmly praise the dog for a few seconds while it held its sitting position, and then you would return to "heel" and very calmly walk your dog across the rest of the platform and down the ramp at the far end, resisting your dog's attempts at sprinting to the finish.
Then, once all four paws were back on the floor, you would release your dog from "heel" with a big excited "Okay!" and you would crouch down and throw your dog an absolute party of praise and smooches and patting and yelling "Yay!!!!" and "Good job!!!!" and "You did it!!!!!" while your dog jumped around in circles and wagged its tail like crazy in excitement.
The term for this whole exercise was "Confidence boosting." You could do it with the ramp, or with a gate for your dog to jump over, or with some big rocks you saw on a forest hike or with the edge of a retaining wall or whatever: Encourage your dog to follow its training through something it ordinarily wouldn't do and might be afraid of, and then throw it a big party at the end. The idea was that over time your dog would come to understand that when you encouraged it to do something it otherwise would not, that it might find scary or incomprehensible, things would be okay: Nothing bad would happen, it would succeed, and then it would get a big happy party at the end. The dog, and you, would draw confidence from this understanding: confidence in the training, and in each other, and in yourselves. And then the dog would be happier, more confident, less fearful of the incomprehensible challenges the world throws at it, and generally much more able to just focus and remain calm in the kinds of situations that otherwise might have caused it to freak out and bark or bite or bolt or fight.
The main thing was, neither fear nor bribery would get your dog to walk that narrow ramp on command, or to jump over a fast-approaching barrier instead of swerving around it—or, less telegenically but just as impressive, to hold a calm, focused sitting position in the middle of a maelstrom of noise and movement and unfamiliar smells. Only confidence and trust—happiness, that is to say—would get your dog to do those things. And then doing those things and getting joyous praise and celebration for having done so would make it feel happier, and would build it up even further, and would make it more able to handle stress and fear without freaking out.
I did this with all four of my big doofus dogs, who had been unhappy and stressed out all the time and then just weren't anymore. So when I see a video like the one below, I'm not watching an automaton cattle-prodded into doing tricks on command, but an extremely happy and confident dog—because you simply could not get a dog to do some of this insane shit unless you had made that dog feel extremely good about trusting you and trying scary new things!—showing off the stuff that it associates with good feelings and happy times.
And then that makes me happy. So it's good all around.