The cause may be the anal glands, which are on either side of the anus in both dogs and cats, and produce a strong smell. The glands put a scent on the faeces – an important form of identification for dogs and cats.
The problem arises when the glands become blocked or inflamed. They discharge, leaving a foul smell, often on the carpet or couch. In most cases, your vet can drain the glands manually.
To prevent them blocking again, feeding dry food and keeping your pet trim can help. If it's an ongoing problem, surgery to flush the glands or remove them altogether may be advised.