If you're lucky, customers will tell you when they're about to defect. Usually through a bad interaction with customer service.
Let's back up a bit though.
Most customers don't want to go someplace else. They just want a store to fulfill their need or solve a problem.
When they buy a product, if it meets their expectations and their problem is solved, there's a satisfied customer.
But if the product doesn't live up to their expectations or the buying experience sucked, there's a good chance they're on their way to defecting.
If you think you have a customer loyalty problem, chances are you actually have a product problem.
If you think you have a customer service problem, chances are you still have a product problem.
If you think you have product problem, part could be all the stuff around the product (e.g. delivery, assembly, expectation setting, defects).
Think of customer service as your last chance to rectify the product and experience before the customer leaves. Done right, you might keep the customer. Done poorly, that customer could become a vocal opponent to your store.
For those customers that don't tell you they're defecting, you can use your data to find out who they are. The Automatic Segments and RFM model used in Repeat Customer Insights can identify defected customers and ones on their way out the door.
Some proactive customer service could recuse them and bring them back to your store.
Get a snapshot of your customer behavior
The sooner you signup for Repeat Customer Insights, the more comparison points your store will have. Each 1st of a the month a new snapshot is taken and saved to your account for analysis.