Foam carpet shampoo products are available from a number of manufacturers. To use a foam carpet shampoo, simply spray it on, rub or sponge it in if instructions require it, then vacuum when dry. Follow the manufacturer's directions and always pretest in an inconspicuous corner to be certain the fiber is colorfast. You may have to shampoo the entire carpet if removing the spot leaves a brighter patch.
To remove small spots, apply a carpet stain-removing product such as Spot Shot Instant Carpet Stain Remover (WD-40 Company), Stain-X Carpet Stain Remover (AMI - Stain-X) or Up & Out (Carrol Company). Up & Out is not for use on wool carpets.