If you want to prevent accidents before they happen you’re going to need to watch your pup at all times, including every time they wander off. It only takes one accident to set your training back. Now I know that watching your puppy non-stop isn’t exactly fun & exciting, but being able to catch them before they have an accident is why this method works so well.
If your dog isn’t giving you an obvious signal that they need to go out (like whining at the door) I suggest teaching them to ring a bell when they need to go outside. Some of the other signs dogs give that they need to go out such as pacing around or circling can be easy to miss if they’re in another room, which is why a noise based signal such as ringing a bell can make things easier.
Many owners appear disappointed that their young puppy will not toilet when out on a walk, yet relieves itself the second it gets back home. This is because the puppy has been taught to toilet only at home (hopefully in its garden), and being creatures of habit, they often wait until they have returned home before evacuating their bladder and/ or bowels.