Monkeys and apes in general, and humans in particular, have a relatively poor sense of smell but the same is far from true of most other mammal species. For such animals, scent can be an important method of communication and this is often done through scent-marking, leaving long-term messages that can be understood by other passing members of your species.
A common way to do this is by rubbing specially adapted scent glands onto objects - these glands are often on the feet or the sides of face, which is why many animals will rub their heads against things to mark their territory. An alternative is to either urinate or defecate in a particular location, the natural aroma of the excreta often being aided by anal scent glands. We are all familiar with a dog's need to mark its territory in this way and it's hardly alone in this respect.
This can provide all sorts of useful information to other animals from the same species, such as territorial ownership, social dominance, willingness to mate, and so forth. When the method used to deposit this information is defecation rather than urinating, the result is termed a latrine or midden - which, in the biological sense, are basically alternative words for "dungheap". Animals that use this method of scent-marking include rhinoceroses, lemurs, and antelopes. (And we can but wonder what human cities would be like had we evolved from a species that communicated in this way).