I would definitely take your pup to the vet. There are multiple possibilities this could be, and ppl on the internet unable to examine your dog can't with any certainty narrow down the possibilities to just one cause. This could be kennel cough, collapsed trachea, reversed sneezing, bronchitis, heart issues, etc. It really needs to be evaluated by a vet. If you can take a video either w a camera or your cell phone when your pup has an episode, that would help your vet be able to see the same thing you see as it happens.
This past Spring my yorkie had cough-like episodes. I took her to the vet and she had a case of kennel cough with an allergy component. She was put on antibiotics, cough suppressant, and allergy meds. Really cleared it up. Glad I went.
Please keep in touch and let us know how you and your little one make out.