Most discount codes are issued to defined groups rather than published openly. The reason is straightforward: a code available to everyone reduces the price for people who were already going to buy.
An open discount is paid to existing demand
If a retailer cuts prices for all shoppers, the reduction applies to customers who would have completed the purchase regardless.
The margin lost on those sales is pure cost, and it usually exceeds the margin gained from the additional sales the discount creates.
Targeting solves that by reaching only the shoppers whose decision the discount actually changes.
Behaviour identifies who needs the incentive
Retailers observe browsing history, abandoned baskets, time since the last order and response to previous offers.
Those signals separate a customer who is hesitating from one who is about to buy anyway, and the code goes to the first group.
This is why a code arrives shortly after a basket is left unfinished, and why regular customers often receive fewer offers than lapsed ones.
Codes are segmented by value as well as intent
Offers are also sized against a customer's expected value, so the same retailer may issue several different codes on the same day.
A first-time buyer might receive a larger incentive than a frequent one, because acquiring a new customer is worth more than discounting an established relationship.
Testing runs continuously, with different segments receiving different amounts so the retailer can measure which produces the best return.
Leakage is managed rather than prevented
Targeted codes are shared publicly almost immediately, on aggregator sites and forums, which undermines the segmentation.
Retailers respond with single-use codes tied to an account, expiry dates measured in days, and minimum spend thresholds that limit the damage.
Complete prevention is impossible, so the design goal is to make leaked codes expire before they circulate widely.
Conditions shape what a code is worth
Minimum spend requirements are the most common condition, and they push the order value up enough to protect the margin the discount removes.
Category exclusions do similar work, keeping the discount away from goods already sold at thin margins such as electronics and gift cards.
A code is therefore best evaluated against what you were going to buy rather than against its headline value, since meeting a threshold with unwanted items reverses the saving.