Q. My dog has vomited twice and keeps hacking like something is in his throat he's drinking water but not eating what can I do
DR. CHRISTIE LONG, D.V.M., C.V.A.
A. Sometimes it's difficult to discern whether they are throwing up or coughing, especially if they're hacking as you're describing. However, the fact that he's not eating makes me more concerned that this is a GI problem and not coughing. Unproductive vomiting (trying to vomiting without actually bringing anything up) is a sign of a very serious emergency known as gastric dilatation and volvulus. It's when the stomach flips over on its axis, blocking both the entry and exit. I would urge you to get your dog seen by a vet immediately to rule this out. I don't know what kind of dog you have but it's more common in deep-chested breeds like great danes and St. Bernards, however it can happen in pretty much any dog (mostly large breeds).
I'm not trying to scare you, but I do want you to be vigilant. If you want to consult more about this I'm on line and might be able to help you better tell if this is an emergency or not.