If you have a carpet shampooer you can run it over the spot you need to clean making an extra pass to suck up excess fluids. After applying pressure over a clean, dry towel to help ensure it dries as fast as possible.
For messes caused by pet or human soils, you will want to use an enzyme cleaner. These will break down naturally derived mess and the odors these leave behind.
Baking soda is a great way to help absorb and get rid of odors in your carpet.You can mix baking soda with a few drops of essential oils to help leave behind a better fragrance and even help kill the bacteria that cause odors in your carpet.
Alcohol is great for killing germs that cause bad odors. You can make a mist to spray over your carpet that will help kill off the odor-causing bacteria between cleanings.
If your carpet has issues with foot odors, controlling shoe odors and improving foot hygiene by cleaning feet after removing shoes and not walking around on your carpets with socks.
If you have pets you can help control the odors by keeping litter boxes through the house clean, bathing your pet regularly, and gating off carpeted rooms from pets that have not been properly trained yet.
Depending on how many people live in your home and how quickly your floors get messy you should vacuum at least 2-3 times a week to help keep your carpets clean and prevent the build-up of dirt, crumbs, and bacteria.