If he only does this when he's just had his heartworm med or his flea med applied then you might swap brands to see if that is a problem.
But if he does this all the time it might be when his stomach is empty and irritated. The yellow is bile and that is produced normally to help digest food.
If the dog has a non food item it can't pass that can cause irritation (bone chips, a soft toy, a coin, a stick, grass etc), intestinal parasites such as worms can cause this sort of thing, and sensitivity to a food item can also cause this.
Treats, fatty people food, a sensitivity to preservatives, corn, wheat, soy, beef can all trigger vomiting.
You might try keeping a little diary of what was going on the days he is sick. Did he get his meds, did he have a late meal, did someone slip him a french fry or a greenie etc. That might help you figure out a trigger.
You can bring a fresh stool sample into the vet to be checked for parasites too.
Hope this helps you!
Please press Accept if you find my answer helpful. Want more info? Just reply on your question!
Bonuses for good work are always appreciated!
Thanks for the opportunity to help you!