Many owners have observed their dogs eating feces, whether it be their own or another species. This behavior is called coprophagia, and is surprisingly common among canines. While pet owners view this behavior as disturbing or gross, it is actually considered normal and usually isn't harmful to the dog.
Many things are thought to cause coprophagia. However, it also just seems to be in their genes. Thousands of years ago before wolves were domesticated they would scavenge around human encampments, eating their trash and feces. It is thought that this behavior simply continued through domestication. Mother canines will also often eat the feces of their puppies in order to keep them clean and to not attract predators.
Puppies in particular often eat poop because at that age they learn and explore by putting everything in their mouth. While many dogs grow out of it, some take the behavior with them into adulthood. In some cases this can be caused by malnourishment or other health conditions, which can be addressed when consulting with your vet. However, even if your dog is perfectly happy she can still have coprophagia.
Some other reasons why your dog might have coprophagia are boredom, stress, hunger, or attention. If a dog is left alone in the same room for too long they can become bored, or hungry, and play with or eat their feces. Responding negatively to your dog when exhibiting this behavior is still attention, and because they want your continued attention they'll keep doing it.
There are several other things you can do to discourage your dog that won't give them increased attention, such as having a strong command or cue that means "leave that alone." You can also quickly clean up after them when they defecate, and if you have cats you can make sure the litter box is cleaned often, or, if possible, kept out of reach of the dog.
Just remember that this isn't necessarily a bad thing. Besides more severe cases your, dog having coprophagia is normal and not harmful to them