What is hacking (gacking)
When we humans cough, it is usually to clear our throats; however, dogs have no need to cough or hack (gack). While some coughing is normal in dogs, especially if it can be attributed to eating or drinking too quickly, excessive coughing and hacking with no obvious reason can be a sign of a potentially dangerous disease.

Several conditions can cause your dog to cough and/or hack:
Kennel cough
Tracheal collapse
Canine distemper
Heart disease
Fungal infections
Other possible causes (allergies, internal parasites, coccidiosis, auto-immune illness)

Why Coughing and Hacking Occurs in Dogs Kennel Cough:
If your dog has been boarded lately or somehow come in contact with a large number of dogs, and he has developed a deep, hacking cough that gets worse with exertion, then your dog may have kennel cough. Caused by the highly contagious bordetella infection, kennel cough is associated with severe coughing and inflammation. Any age or breed of dog can become sick with bordetella.

Tracheal Collapse Listen to the sound of your dog’s cough. If your older or overweight dog develops a cough that sounds more like a honking sound, it is possible your dog is experiencing a collapsed trachea. Other signs you may notice are gagging while eating or drinking, low tolerance for activity, and episodes of respiratory distress. In addition to elderly and overweight dogs, small breed dogs have a higher incidence of tracheal collapse.

Canine Distemper Dogs do not normally show signs of a common cold the way humans do; if you notice your dog exhibiting lethargy, a yellow, mucous discharge from her eyes and nose, and a dry cough, it is possible your dog is experiencing canine distemper.

Heart Disease Congestive heart failure is present when the heart becomes enlarged and obstructs airways, thus producing a cough and/or gagging episodes in your dog. Heartworms can also cause a dog to cough excessively. Pericardial effusion is the buildup of fluid around the heart, also causing your dog to produce a “wet” cough or a gagging sound. Be sure to notice if this cough occurs mostly at night or when your dog is lying down as this is a sign of fluid gathering around the heart. Great Danes, Cavalier King Charles Spaniels, and all older dogs are at risk for heart disease.

Fungal Infections Do you happen to live on or near a farm? Do you happen to have chickens or live near chickens? Has your dog developed a “wet” cough that almost sounds like a gargling sound? Then it is highly possible your dog could have inhaled some fungal spores or animal droppings and is now coughing as a result. Dogs can also inhale fungal spores after spending time in damp areas. Fungal infections can lead to pneumonia, so if you suspect this is the problem, get your dog to the vet immediately.

Other Causes Always be sure that your dog has not swallowed a foreign object that might be stuck in his throat. A foreign object does not have to choke the dog, but can be a huge irritation. Allergies can make your pup as miserable as they make humans. Pollen, mold, household dust, and insect mites can have much the same effect as they have on humans. If allergies are what is plaguing your pooch, you will also notice itchiness in him. Although it is very rare, dogs can develop tuberculosis. You may notice a “wet,” productive cough accompanied by bloody phlegm. Coccidiosis is another disease that is characterized by a wet, productive cough. Because these symptoms can signal both mild and more serious diseases, it is imperative that your vet diagnose the cause of the cough. Any age or breed of dog can suffer from allergies, tuberculosis, coccidiosis, or other auto-immune illnesses. What to do if your Dog is Coughing and Hacking

Read more at: https://wagwalking.com/symptom/why-is-my-dog-coughing-and-hacking

A few comments relative to ME:
1) Cerenia does seem to help more than metoclopromide, but, since they work a bit differently, both can be used.
2) Antibiotic Responsive Gastroenteropathy seems to be common in dogs w/ ME – treat w/ amoxicillin and metronidazole for 21 days, is one therapy that can be used.
3) Esophagitis may be suspected – treat w/ LIQUID Carafate (sucralfate)
4) Nebulizer administration of albuterol can often fend off both AP, and, may minimize its recurrence. Use only if you have no lung or heart issues, and w/ permission from your physician.