both of my children learned to use the toilet very quickly. and both of my dogs learned to only use the bathroom outside also very quickly. but children and dogs are trained very differently. metaphorically it is counterproductive to rub a child's nose in there poop or pee so an inverse approach is necessary.
after two children I have learned that the most important things in a child's life is for them to know that they are loved and safe, and as they start openly communicating they need to be listened to and respected. and they deserve it! but you should be listening and respecting from the moment of conception and you will see that a baby does not cry without a reason.
to potty "train" your child the most important thing to remember is to never once scold them. ever. never. not even once or you have lost the game it is too late for you, good luck you have now said (after scolding you child) that pooping and peeing are wrong and that the toilet is a punishment.
Instead give them confidence and understanding- give them control over their bowl movement. celebrate that they have taken a poop or pee (even if it is on the carpet... again) and show them "where the big kids poop and pee. now lets go clean up the mess."
so a mock scenario would go like this: you notice a silence, you see that your child is standing still, concentrated (or what ever facial expression and body language that you have come to recognize your child expressing when it is time to go-potty) you quickly rush over in a non threatening way kindly and respectfully you ask "do you have to go to the potty?" but uh oh the rug now needs cleaned. the child looks to you a little proud of having relieved herself. you smile and say in a very friendly, kind of goofy way, something like "good job you poopied! let me show you were the big kids poop and pee" take her/him to the toilet, sit her on it in case there is more to come and out of association-training and say in a kind, encouraging, helpful voice "this is where mommy and daddy and the big kids use the potty. good job, I'm so proud of you for going poopy" clean him/her up and say. "good job pooing, now lets go clean up the mess"
cleaning baby poo from the carpet is easy. grab what you can without rubbing it in. scrap the rest with a knife or spoon. take a rag too it. put some water on it, some nontoxic dish soap (something like seven generation) sud-it-up, soak it up, put some water on it, soak up the water putting water on it and soaking it up a few times and then just soak up any remaining water in the carpet. don't worry too much, you now have a kid. nothing in your life is safe from stains, or breaking. my advice is to never wear white, and put away the fragile stuff, then you don't have any excuses for being an jerk to your kids.
by the way, dogs; catch them in the act, scold them, rub their nose in it and throw them outside. by contrast to children you want them scared to mark their turf in the house. how ever when you see them outside doing their business, reward them, give them love and affection, and tell them good job.