Hacking and gagging are both expressions of irritation to the back of the throat or larynx area. As long as he is eating normally and feels good you don't need to worry to much. Many times this symptom will linger for days or a couple weeks after the initial respiratory infection is over. If you see an increase in the frequency or intensity of these symptoms or especially if your puppy's attitude or appetite are affected be sure to let your vet know. I many times will use cough medicine that contains an expectorant to aid the puppy in handling the irritation, mucus and debris that gives rise to the gagging reflex. Be sure to watch these videos: "Respiratory Infections-Symptoms, Causes and Treatment" "Kennel Cough"