Placing mats at all entrances to your house will cut down the rate at which your carpet gets dirty. They should be big enough to remove the dirt from the bottom of your shoes and should be cleaned regularly.
A lot of carpets come with a dirt repellent coating, however these are not bullet proof and will, over time, wear away. Quickly mopping up stains and spills is still required. Untreated carpets can have the protector applied after it has been installed.
Regularly vacuuming a carpet will remove grit and dust that would otherwise damage the carpet fibres and don’t forget to deal with spillages as they occur. And finally, having your carpet wet cleaned once a year will extend the life of the carpet, saving you money and keep it looking pristine.