The best way to keep pet stains from coming back is to clean the area with detergent or white vinegar. Stop the carpet from getting wet, and always deal with spills as they happen.