Summarize:

Before treating your carpet, remove any dried on spills, blot away wetness, and dab soap on noticeable stains. You want your carpet to be in its best state before treating the smell. The baking soda will work to neutralize the odors that are trapped in the carpet. You should create a thin coat of baking soda, so get a large box of baking soda for each room that you plan to treat. If it clumps in spots, use your hand to spread it out. You can also add Borax to baking soda for better results. Simply measure one part baking soda with one part Borax and mix well. Add a few drops of an essential oil if you'd like it to be scented. Then use as you would baking soda. The recommended wait time is several hours, but if you have really bad carpet odors, then you may want to let it sit overnight. Keep pets and children away from the area. Monitor your vacuum cleaner bag or canister because baking soda can quickly fill it. Empty it out as necessary. If baking soda alone doesn’t work, you can make your own deep cleaning treatment with 2 tablespoons (30 milliliters) of hydrogen peroxide, ¼ cup (59 milliliters) of baking soda, 1 teaspoon (5 milliliters) of liquid soap, and 1 quart (1 liter) of water. Mix the ingredients together in an open container. Test it on a hidden area of your carpet before using it on the whole carpet.  Use gloves when handling this treatment. DO NOT put a lid on the treatment once it’s mixed. Spraying is better because it provides an even coat, but remember to leave the nozzle open and avoid leaving unused treatment in a closed spray bottle. When pouring be careful not to saturate the carpet. Remember to wear your gloves, especially if you pour the treatment. The treatment needs time to work, so leave it untouched. While you want to ventilate the room, keep it secure from pets and children. If any wet areas remain, use an old or white towel to remove it. Let the remaining wetness air dry.
Treat soiled areas. Sprinkle baking soda onto the carpet. Let the baking soda sit. Vacuum up the baking soda. Apply a deep treatment. Pour or spray it on the carpet. Allow it to sit for 24 hours. Use a towel to soak up excess liquid.