Sunny has anal gland issues and I've been squirted on a few times (so unpleasant). I tried giving her pumpkin but that ended badly with Sunny pooping all over my apartment (she's very well house trained so I knew this wasn't usual). I was giving about a tablespoon with each meal so maybe I was giving her too much? I stopped the pumpkin all together and the pooping accidents stopped immediately.
I now give her carrots but I don't think that does anything. Mainly I keep giving them to her as a low cal treat. I now have learned how to manually express them from the outside although that's an unpleasant experience for both of us and sometimes I worry that I'm not fully emptying them. Also, I fear the day that I may get squirted on my face or something as I express her glands. I express them myself if I get squirted on, or she's scooting. Also whenever she goes to the vet or groomers she gets them but I don't think the groomers do a very good job since there have been times where the next day I've been squirted on.
My first pug didn't have any issues. She'd scoot every now and then and after a trip to the vet she'd be scoot free for a long time. And she never squirted! So I think it depends on the pug a lot. Squirter or not, I still love my Sunny Bunny! Maybe I'll try the pumpkin again but just do a tsp.
Mother to my <3 pug, Sunny bunny.