Some discount codes work once and then stop, and sharing them achieves nothing. Those codes are generated individually and tied to a record before they are sent.
What a generated code contains
A single-use code is created as a unique string linked in the retailer's system to a specific recipient, campaign, expiry date and set of conditions.
Nothing about the discount lives in the characters themselves, so the code is meaningless outside the system that issued it and cannot be guessed.
When it is entered at checkout, the system looks up that record, checks whether it has been redeemed, and marks it used if the order completes.
Why retailers moved towards them
A shared code reaches people the promotion was never intended for, and many of them would have bought anyway, so the discount buys nothing.
Restricting redemption to named recipients means the margin given away goes only to the group the campaign was designed to move.
It also protects the headline price, because a code that cannot be posted publicly does not become a permanent discount that everyone expects.
What the retailer learns from them
Because each code maps to a person, redemption reveals exactly who responded, what they bought and how long they took to act.
That allows a campaign to be measured against a control group who received nothing, which is the only way to know whether the discount changed behaviour.
The results feed the next campaign, determining who receives an offer at all and how deep the discount needs to be for each group.
Where the offers are targeted
Lapsed customers receive the most generous offers, because the alternative is losing them entirely and a discount is cheaper than acquiring someone new.
Abandoned baskets trigger their own codes, sent within hours while the intention to buy is still current and the products remain in mind.
Frequent buyers often receive less, since the system already expects them to purchase and a discount would simply reduce the margin on a sale that was coming.
Why some codes still get shared successfully
Generic campaign codes remain common where the cost of generating individual ones outweighs the leakage, particularly for broad seasonal promotions.
Codes distributed through affiliates are usually generic by necessity, because they have to work for an audience the retailer cannot identify in advance.
The practical distinction is length and pattern, since a short readable word is usually a public campaign and a long random string is usually tied to someone.