Ck into getting some professional training help. It has to be cheaper than continually getting new carpet every few years.
Good Luck.....we use potty pads and give a distinct order for her to "go potty" and then the treat.....but, with yours being 4 yrs old.....you may need help.