I’ve found placing baking soda (dry) into the carpet and then a mixture of warm water and vinegar helps with stains (as well as breaking pet smells, if there’s dogs,)
Speaking of smells, if there’s a funky smell that won’t go away, an ozone generator usually does the trick (and, it’s quite possibly the carpets,)
while I agree that the air freshener sorts are basically useless (they smell nice as you vacuum them up.) the baking soda does serve a purpose, and used in the correct proportions, you're not risking leaving the mild abrasive behind. (the other reason the baking soda is used as a cleanser. it's a relatively mild abrasive.)
for the record, this is for spot cleaning, not whole-carpet cleaning. for that get carpet detergent. you shouldn't be dumping baking soda on, instead, you give a light dusting, and just enough that it falls into the pile (but not so much that it falls through the backing.) you're not scrubbing. you're letting it's reaction with vinegar do the work so you don't have to scrub. You absolutely should do a test patch somewhere, just in case you're carpet is bleached by it... and water in the solution can slow down the reaction as well, but if you used the correct amounts of baking soda and vinegar, there isn't anything solid left. If you're unsure add more vinegar+water
the products are sodium bicarbonate + acetic acid (and water) -> sodium acetate (and water, it's aqueous) + carbonic acid, which decomposes into water and carbon dioxide. just run the extractor over it to remove it, and then proceed with the full carpet scrub and extraction. as far as I know, it's relatively safe for pets and kids (sodium acetate is what they use to make salt and vinegar chips- they dry it out of solution and use it as salt.)
during college, I worked on the cleaning crew for the college dorms. this includes a summer of working through all the dorms... and let me just tell you there were some new and interesting smells discovered (in all the wrong ways. the worst is either the closed-down dorms that the security guard took a shit in, after they turned off the water and the aircon.... ozone generators. Trust me.... or, the dorm room that tried to keep a tortoise hidden in the closet, and got away with it for six months. poor tortoise.)
The vinegar attacks proteins in organic stains, causing them to lift off. the fizzing action helps get it out of the fibers if it's soaked in, so it can be removed with the extractor. Also because it attacks proteins, it breaks down smells caused by organic sources. (you can just use vinegar if it's, ah, fresh.) Another side note is, if you have stuck on pans (like from baking fish or chicken breasts or something), heat up enough hot water (as hot as you can stand, I usually go at around steam lifting off.) add a table spoon or two of vinegar to the pan or pot, and a drop of dish soap, then pour in the hot water. (the heat makes the vinegar work faster. Alternatively, take a tablespoon of vinegar some water, and some cornstarch and deglaze that beautiful fond into a sauce... Just saying.)
For stain removal, having a proper carpet cleaner is worth the money. We have one almost always ready to go. It sits in the closet loaded with the water and cleaning solution mix and as soon as a big spill happens we can just clean it up.