Before I can offer any suggestions, which comes first, the coughing or the gagging?
Some common causes of chronic cough include asthma, allergic rhinitis, sinus problems (for example sinus infection),post nasal drip and esophageal reflux of stomach contents. Infections such as bronchitis or pneumonia can cause coughing. These infections can be caused by virus, bacteria or fungus.
Diagnosis includes pulmonary function studies and allergy tests to rule out other allergies. I suggest you to consult a chest physician as soon as possible.
It is very difficult to precisely confirm a diagnosis without examination and investigations and the answer is based on the medical information provided. For exact diagnosis, you are requested to consult your doctor. I sincerely hope that helps. Take care and please do keep me posted on how you are doing.