Clean your shoes before entering the house
Remove the stains the moment they appear on the carpets
Move and rearrange the furniture
Vacuum your carpets regularly
Handle the pet problems properly
Get professional help