My experience with our first dog is the tendency to vomit. We used to live in a rented house with a backyard and front yard garden which when unkempt breeds insects and pests. Even when she was a puppy, Jedi would vomit once in a while. That would cause a short visit to the vet who would give medication to control the vomiting. When the trips to the vet became frequent, my husband made an inquiry with a dog breeder.
Aside from the food given to the dog, it is natural to get microbes that would irritate the throat or the upper intestines. That's may be the reason why the dog vomits. But that is only a temporary condition since the immunity of the dog would drown the microbe or germs. However, there are strains of bacteria that can cause the stomach to revolt and that's when we would need antibiotic. So the rule of thumb is to give the dog sugared water and observe. If the vomiting continues then a medication is necessary. In our experience, the simple irritation can be remedied with sugared water.