In helping my senior mother with her life, I've had to tackle (1) a dirt (escaping from a vacuum cleaner) stain; (2) spilled coffee stains; and (3) blood stains on her otherwise lovely and pristine-looking carpet. In case you're wondering about the blood, it occurred as she absentmindedly scratched a white mole on her ankle. The injured mole bled a lot and she didn't even notice it, dripping blood on 3 areas of the rug as she returned to her chair.
An all-purpose stain remover from a dollar store didn't work.
Through trial and error (avoiding cleaners that would take the color out of the carpet), what got the stains out was a combination of the following ingredients:
Homemade Carpet Stain Remover
2) Follow with drops of soap and undiluted white vinegar.
3) Pour baking soda on top of the wet mixture and let it fizzle. I use a scrub brush to work the mixture into the carpet. Toss some clean water on top if the paste is too dry.
4) Let the paste set/dry until the next morning. After 5 minutes or so you can also blot it with paper towels but not excessively so. I covered the wet spot with a couple of paper towels until the next morning so my mom remembered to walk with her walker around the stain. While drying it smells like a big salad.🥗:)