Short answer. A campaign is a versioned rule: conditions, product, family, quantity, basket threshold, period, channel, customer segment; an effect, percentage, amount, X for Y, bundle, free delivery; a budget in dinars or units. One engine evaluates all campaigns against the basket as it forms, in a written order, line promotions then basket, with exclusivities, and a margin guard that caps a discount when the margin computed on the last purchase price would fall below the written minimum per family. Codes generic or unique, single use per customer, capped, that stop on their own. Every channel, till, website, B2B portal, WhatsApp orders, calls that engine, the offline till included, so one price everywhere at the same instant. And a measurement: every campaign is simulated on past sales before launch, tracked during, and judged afterwards against control stores or control weeks, with margin and the weeks after.
This guide is for the shop and the retail chain, the online store, the wholesaler running promotions for its retailers, the restaurant and café making offers, and the founder based in France who wants to launch a promotion from their phone and know, six weeks later, whether it made or lost money. It does not repeat how a quote computes a price per customer with approved discounts, described in the price engine guide, nor how loyalty points are earned and spent, described in the loyalty guide; here it is about campaigns, limited in time, open to a segment, and judged on their margin. Legal rules on sales, crossed-out prices and discount announcements, and the tax treatment of discounts, are for counsel and the accountant; this guide builds the engine that applies the rules the manager writes.
One basket at the till, and the promotions that apply
The figure is a receipt seen from the inside: five candidate campaigns, three applied, one capped, and the final price the cashier sees.
The conditions: for each campaign, the engine checks the period, the channel, the product or family, the quantity, the basket threshold computed on the total before promotions, and the segment of the customer identified by phone as in the customer record guide; one false condition is enough to set the campaign aside, and the manager can see which. The order: line promotions apply first, oil at minus ten, three biscuits for two; the basket promotion next, on the total before or after promotions, per the written rule; codes are exclusive with the basket, or stackable, per what is written, never per what the cashier types. The margin guard: before showing the price, the engine computes each line's margin on the last purchase price; oil at minus ten percent would leave six percent, below the minimum of eight written for the family; the discount is capped at minus eight, the till shows 1,334, and the manager sees in the day's board how many times the guard played.
What the cashier sees: the final price per line and the total; not the rules, not the campaigns set aside, not the guard; they type nothing and choose nothing. What the customer sees: on the receipt, each discount named; on the website, the same price at the same instant, because it is the same engine; in a WhatsApp order as in the WhatsApp agent guide, the same price again. What is kept: for each line sold, the list price, the campaigns applied with their version, the discount, the margin after; that is where measurement starts. Prices, margins and campaigns are a constructed example.
«The engine evaluates every campaign against the basket, in a written order, and the margin guard caps before the price is shown; the cashier types nothing.»
Launching a promotion, in six beats
The application is the accented beat, but the simulation before it is what avoids discovering the cost at year end.
Define: conditions, effect, period, channels, segment, budget in dinars or units, and who approves above a threshold as in the roles guide; the campaign is versioned, and a sale keeps the version it used. Simulate: the engine replays the campaign on the sales of the same weeks last year or last month: lines hit, total discount, margin after, cases where the guard would have capped; the manager sees the cost before the first receipt, and adjusts the effect or the threshold. Publish: the campaign goes to every channel at the stated time, offline till included, which receives campaigns at sync as in the offline guide; a poster does not start before the engine has it.
Apply: at every basket, the evaluation, the order, the stacking, the guard; in a few milliseconds, because active campaigns are few and indexed by product and family. Track: budget consumed in real time, uses of each code, guard caps, stock of promoted products linked to the stock guide; a campaign stops on its own at budget, and suspends on its own when stock falls below the written threshold. Measure: against control, over the weeks after, with cannibalisation of neighbouring products; one verdict per campaign, and the next starts from there.
Measuring a promotion against control stores, over six weeks
The figure compares six stores on promotion with six stores without, two weeks before, during and after. Volume rises, margin falls, and the week after drops.
The control: six stores chosen to resemble the other six, same volumes the week before, that do not receive the promotion; comparing with a control is the common method of controlled experiments, described as a randomised experiment between two variants whose measurable outcome is compared, and whose precision depends on sample size; with six stores, the verdict is indicative, and the application says so. A two-store chain compares instead with the same weeks last year, and the guide says that too. During: plus 38 percent units against control, but margin per unit goes from fifteen to eight percent; in total margin over the two weeks, the promotion loses, because 399 units at eight make less than 290 at fifteen.
After: the following week, promo stores sell 17 percent less than control; customers stocked up, and part of the volume during the promotion was moved volume, not gained volume. Cannibalisation: the engine also looks at the neighbouring oil brand, whose sales fell during the promotion; it enters the verdict. The verdict: a figure, margin gained or lost over six weeks, per store, computed by a background job as in the background jobs guide and shown in the dashboard with its definition; the next campaign starts from there, for instance minus five instead of minus ten, or a bundle rather than a percentage. Stores, units and margins are a constructed example.
«A promotion is measured against a control and over the weeks after, not only over the week the till rang; the verdict is a margin figure.»
Six real situations, and what the application does
Each row is a sentence heard in a business that runs promotions, and the answer is a written, measured rule, not one more poster.
The promotion worked, and we lost money: the simulation before launch gives the cost, the margin guard caps during, and the six-week verdict says what it really brought. The promo code was shared on Facebook: codes are unique or capped, tied to a segment, single use per identified customer, and stop on their own at cap or budget; a shared code dies on its own. Two promotions stack by accident: the stacking order and exclusivities are written and played by the engine; the cashier types no discount.
The till and the website show different prices: one engine, called by every channel, with the same synced campaigns; the price is the same at the same instant, offline included. Stock was gone on day three: the budget in units is linked to stock; the promotion suspends at the written threshold, replenishment from the stock guide is warned, and the website pulls the banner at the same time as the till; a promotion on short-dated lots follows the lot guide. Nobody knows whether the promotion helped: every campaign has its control, its weeks after, its cannibalisation and its figure; the same one is not rerun out of habit.
Promotions, in five layers
The engine is the accented layer: one evaluation, in the written order, with the margin guard, called by every channel.
Campaign. A versioned rule: conditions on the product or family of the catalogue guide, quantity, basket threshold, period, channel, segment; an effect, percentage, amount, X for Y, bundle, free delivery; a budget; an approval above a threshold. A campaign is a written rule, not a poster, and a sale keeps the version it used. Engine. At every basket, evaluation of all active campaigns, indexed by product and family; the written order, line then basket; stacking and exclusivities written; the margin guard on the last purchase price, per line, with the minimum per family; the result kept line by line. The same engine serves the quote of the price engine guide for campaign discounts, and loyalty points are computed on the price after promotion, per the written rule. Codes. Generic or unique, generated in batches, single use per identified customer, capped in uses and budget, tied to a segment; a code stops on its own, and refused attempts are counted.
Channels. The till, the website, the B2B portal of the ordering portal guide, WhatsApp orders and the agent call the engine; the offline till receives campaigns at sync and applies them without network, with the same evaluation; payments follow the till guide. Measurement. Simulation before, tracking during, budget, uses, caps, stock, and the verdict after: control, weeks after, cannibalisation, margin gained or lost, per campaign and per store, with a WhatsApp alert as in the notifications guide when a budget is consumed or stock falls below threshold.
Putting promotions under rules in 2027, in weeks
Seven weeks, the first without code, and two for campaigns and the engine, because codes, channels and measurement are only inputs and readings of that engine.
- What the manager sees: before, the simulated cost; during, budget consumed, codes, caps, stock; after, the margin verdict over six weeks, per campaign and per store.
- What the cashier no longer does: type a discount, choose between two promotions, explain why the website says otherwise, sell a promoted product that is no longer on the shelf.
- What is measured: simulated versus real cost, budget consumed, code uses and refusals, guard caps, uplift against control, margin gained or lost, weeks after, cannibalisation.
Week 1, rules: admitted campaign types, stacking order, exclusivities, minimum margin per family, who creates and who approves, customer segments, the stock suspension rule; with the manager, without code. Weeks 2 and 3, campaigns and engine: versioned campaign model, evaluation at basket with order and stacking, margin guard, simulation on past sales, result kept per line. Week 4, codes: generic and unique, caps, single use, segment, automatic stop, refused attempts counted.
Week 5, channels: offline till, website, B2B portal, WhatsApp; campaign sync; one price everywhere. Week 6, tracking: budget consumed, uses, caps, linked stock, suspension at threshold, alerts. Week 7, measurement: control or reference weeks, weeks after, cannibalisation, margin, verdict per campaign, Monday review.
- Why a margin guard, if the manager already chose the discount?
- Because the purchase price changes between campaign creation and the basket, and because a basket promotion can add to a line promotion: a line's real margin at the time of sale is not the one in mind. The guard computes on the last purchase price and caps at the written minimum per family; the cashier does not see it, the manager sees how many times it played.
- In what order do promotions stack?
- In the order written by the manager: usually line promotions first, then the basket one on the total before or after, then codes, exclusive or stackable per what is written. The order is played by the engine at every basket, and it is the same on every channel; nobody chooses it at the counter.
- How to prevent a promo code from being shared?
- With unique codes generated in batches, single use per customer identified by phone, tied to a segment, capped in uses and budget; a generic code has a cap and an end date, and stops on its own. Refused attempts are counted: a code receiving three thousand attempts in two days tells the manager.
- And with only two stores, how to measure?
- Against the same weeks last year or last month, with the trend corrected; it is less precise than a control, and the application says so. With several stores, control stores chosen to resemble the others give a sturdier verdict; comparing two variants on a measurable outcome is the common method of controlled experiments, whose precision depends on sample size.
- Does the promotion also apply offline?
- Yes: the till receives active campaigns at sync, with their version, and the local engine evaluates them exactly like the server; offline sales keep the campaigns applied and go up when the network returns. A campaign created during an outage starts at the next sync, not before.
- How does this relate to loyalty and quote discounts?
- Loyalty points from the loyalty guide are computed on the price after promotion, per the written rule; quote discounts from the price engine guide are per customer and approved, not campaigns; a campaign can however apply to a quote if the portal channel is ticked. One final price per line, whatever the path.
- How long to set this up?
- Seven weeks in the typical calendar, the first without code and two for campaigns and the engine. A shop that already has the till and the catalogue of the corresponding guides takes less; a chain with several channels, unique codes and control stores takes more, the time to write the rules and choose the controls.