I am in the process of having my carpet replaced by a guy who has been doing marine interiors for a long, long time. He gave me a good hint regarding carpet cleaning. He said the biggest problem people have when cleaning a carpet is getting the soap out of the carpet. The soap residue becomes somewhat sticky over time causing the carpet to get dirty faster. He said to ALWAYS let your carpet dry throughly and then fill the carpet shampooer with water and do it again to rinse out any residual soap.
Also, he suggested that you always have handy your little 2.5 gal Husky Shop Vac for picking up spills in lieu of "blotting" them into the carpet. In fact he includes the purchase of one he'll use on a large installation and then leave it for the owner at the end of the job.