Sometimes potty-ing in the house and yard is confused with “marking”. When a dog marks he is leaving his information on whatever he has peed on. Dogs smell it and learn a lot about the dog who left the scent. For both instances, take away all roaming of the house for three weeks, then allow very limited amounts of supervised roaming. Teach your dog to stay on a dog bed in the house for extended periods of time. When you cannot supervise him, put him in his crate, outside or in the dog run. Be sure to get your carpets cleaned by a professional that specializes in pet stains and odor to ensure that your dog doesn’t go back to mark his spots again once he regained roaming privileges.