Pets are family. There is no doubt about that. But pets will generally leave an odor and can also have accidents on the carpets leading to odors and staining. Unfortunately there is not an ideal way to clean the accidents aside from having it professionally cleaned.
Many people will attempt to clean their carpets using water and soap, however the issue comes from not being able to get all of the soap or chemical out of the carpet. This will typically lead to accidental bleaching or discoloration. It is generally best to hire a professional to do a thorough clean once a month to ensure the integrity of the carpets as well as to reduce in the odor buildup. This can also reduce allergies to people that may be allergic to pets or pet dander.