Sounds very familiar to what was going on with my Bulldog. Been coughing/gagging for two weeks or more. He was taking an antibiotic for another issues and those are sometimes tough on a dog's stomach. So that is the reason we didn't take him in sooner thought it was to do with that. However after about 4 days off the antibiotic it seemed to have gotten worse, so I took him to Vet today. After a bunch of test and approx. $400 dollars later they said he has pneumonia. So if it has been going on for sometime now you might want to get him/her checked out. Hope he feels better soon!!!
Preventative grooming in the future but cat hairball medicine may work here.
If the coughing does not stop and the hairball is not brought up then consult your vet.
Well, dogs don't get "hairballs" and its not normal for them to cough, so my suggestion would be to take your dog to a vet and have her checked out, she may have kennel cough or something else that truly needs to be treated.
The best thing is to go to a vet. They know what to do!
I think that it would be better and safer to go to a vet.