Does it sound like this. Below is a video of my dog. He has been doing this since 4 months old and he is now almost two. If you listen to the end you can really hear the hack noise he makes. My vets are not sure why he does it. But like Willies mom said could be acid reflux.
https://youtu.be/iWA32rh7mfU