Blocking your dog’s view through the car window is a great option when they bark at people/dogs outside the car so that barking in the car does not become a habit. This can be achieved by putting a cover over a crate in the boot or blacking out back side windows if they sit on the back seat.
If your dog does bark, completely ignore them. Talking to them/giving them treats while they are barking to quiet them down will reinforce the behaviour and make it more likely to happen in the future. The moment that there is a pause in the barking and they are quiet, say “Good” and give them a treat (this can only be practiced if there is a passenger in the car or you are stationary).
Reduce excitement levels when your pup goes in the car. Practise going to the car in a calm manner, put them in the car, then just let them out and go back in again. Repeat 3 or 4 times a day. When they are calm entering and exiting the car, start to put them in the car, then turn the engine on for a few minutes, before then going back in. When they are consistently calm doing this, put them in the car and just drive round the block before returning home a few times a day. We are teaching them that going in the car does not always predict a walk.
Reducing barking when they see a car/person/dog. Take your pup to a location where you will see passersby but can keep a good distance from them. Allow them to look at the car/person/dog, then say “Good” and give them a treat. If they begin to offer eye contact voluntarily when they see a passerby, say “Good” and give them a treat when they do. If your dog is already barking, you are too close to the passersby and need to move further away while you do the training. With time, the distance they can be from passersby without reacting will reduce.
If your dog barks when you arrive at a location you can do two things: 1) don’t get out of the car until they have stopped barking. Just sit quietly, without talking, looking at them or stroking them until they are calm for a moment, then immediately get them out. If they start barking again as you start to get them out, just wait until they are calm again to continue getting them out; 2) train a “Wait” cue.