Are you sure it's a medical reason because many dogs do this. I think some do it for attention as well. When your dog does this just make a distraction, Ex. clapping, "no", etc.