I have been battling with this for a while now.
Molly has always had a diet of veg/fruit/chicken etc. strictly no commercial food,
a couple of months ago I added bran to her food and we have not had any bottom problems for roughly 4 months.
Dougall is a different story, he is on a similar diet but he has been fed the Royal Canin biscuits as a treat. He has had infections, impacted and full glands despite bran and usual things. The last 4 weeks we have completely withdrawn all commercial treats/biscuits. We went to the vets this evening, I couldn't believe it, the dreaded anal glands were completely clear!
We havn't quite got to grips with Dotty yet as we are in the process of changing her diet now.
I think I might have got to the bottom of it. Complete natural feeding seems to be the answer