If you have really bad pet urine smells in your carpet spray the entire area with tile cleaner (we bought Power House brand spray it was the foam kind) first you might want to spray in a "no show" area to make sure it doesn't leak the color.
Shut the door or block it off so your dog or cat can't lick up the tile cleaner. Let it fully dry and spray it again. This will eliminate the odor in the carpet and the room. After it's dry put some baking soda on the spot and vacuum up. Vola!!!!