Attribution

What it is

Attribution is the rule that classifies every order in your store: did an engine recommendation help cause this purchase or not. Every order gets exactly one level — from strong evidence ("clicked a recommendation and bought that product") down to no evidence ("purchase with no engine touch").

How it is computed

When an order arrives, the engine searches the customer's recent history (30 days by default) for a recommendation touch: a recommendation-link click in an email, a recommendation marker from the store plugin (cookie), or a product view. The strength of what it finds decides the level:

LevelMeaning
Direct purchaseclicked a recommendation and bought that product within the hour
Later exact purchasearrived via a recommendation and bought that product later
Indirect same-sessionclicked a recommendation, bought a different product within the hour
Indirect laterclicked a recommendation, bought a different product later
View-assisted purchasea recommendation touch was found, but no click evidence
Influenced purchaseopened an email with recommendations while holding live recommendations and bought in the window — not counted as engine revenue
Control purchaseno engine touch found

All levels except the last two make up engine revenue.

How to interpret it

  • The levels are a scale of evidence strength, not a "percentage" split. If an order is in engine revenue, its full amount counts there — not a fraction of it. (The level's weight is used internally for learning: stronger evidence teaches the engine more.)
  • "Influenced purchase" is deliberately zero-weighted: opening an email is not a reliable signal, because Apple's Mail Privacy Protection opens emails automatically. These are shown as a separate line but never counted as revenue.
  • "An email with recommendations" means a Smaily email in which at least one recipient clicked a link from the recommendation fields. Smaily gives the engine no email content, so these clicks are the evidence. Opening a plain newsletter does not make a purchase influenced, and neither does an email nobody has clicked a recommendation link in yet; such a purchase is a control purchase. This rule applies to purchases from 5 October 2026; older influenced purchases were not re-classified.
  • A control purchase does NOT mean "the engine failed" — it is the baseline against which the engine's impact can be measured at all.
  • While a holdout is running, a customer in the holdout group never gets a recommendation level: they receive no recommendations, so their clicks are not linked to a recommendation and every purchase of theirs is a control purchase.
  • A click whose link carries no recommendation tag is matched to a recommendation by slot or by product. It is linked only to a recommendation that was live at the moment of the click: on the contact's fields then, not issued later and not already replaced. A click with no such recommendation stays unlinked. Links made before 2 October 2026 were not repaired.
  • A slot click is matched to the recommendation that was in that slot when the email was sent, if the send to that contact is recorded: recommendations are re-issued several times a day, so the slot can hold another product by the time of the click. Without a recorded send, the moment of the click is used. The recommendation is still issued at most 60 days before the click (PRO-3700, from 5 October 2026; earlier links were not repaired). A click on a plain product link in the email is matched by the same rule to the recommendation of that product (PRO-3794, from 5 October 2026; earlier links were not repaired).
  • A purchase after a click on a storefront recommendation (the store plugin shows the customer's recommendations on the store's own pages) gets its level as above and counts as engine revenue, but no email campaign gets the credit. When the customer clicks a recommendation in an email after that, the email gets it: the last click wins.

Common misreadings

  • "Why are so many orders in control?" — Smaily does not track links in recommendation fields the way it tracks normal campaign links, so some genuine recommendation clicks only register through the store plugin. Until the plugin is installed (or freshly after installing), classification leans conservatively toward control. This is intentional: we would rather understate the engine than overstate it.
  • "Lots of opens but little attributed revenue" — see the previous point and the "influenced purchase" note: opens do not prove impact.

Technical background

Classifier: lib/engine/attribution/classify.ts; levels and weights (1.0 / 0.7 / 0.5 / 0.3 / 0.2 / 0.0): lib/engine/attribution/types.ts (OUTCOME_SCORES). "Same session" = 1 hour. A cookie match counts as a click-equivalent (the recommendation parameter can only be picked up by clicking the link). The lookback window is configurable per tenant (tenant_settings.attribution_match_window_days, default 30 days). Holdout group: liveHoldoutCustomerIds (lib/holdout.ts), used by the action-log poller and processOrderAttribution. Influenced purchase: checkAssistedOpen (lib/engine/attribution/match-purchase-to-rec.ts) — the open's campaign needs a click whose link matches REC_FIELD_CLICK_URL_PATTERN (the smaily_rec parameter or an unrendered {{rec_N_…}} tag); a plain product link tied to a recommendation by URL does not count. Click matching: pickRecLiveAtClick (lib/smaily/action-log.ts) — live window [issued_at, COALESCE(closed_at, window_closes_at)], issued at most 60 days before the click. A credited purchase sets closed_at only on a still-pending recommendation; one closed earlier always keeps it (creditedRecUpdate, lib/engine/attribution/process-order.ts). A purchase with a score above 0 turns closed_neutral / closed_loss into closed_win; replaced stays replaced and the nightly supersede sweep decides. History from before 2 October 2026 was not repaired: some older click links break this rule, and many older close dates were overwritten. Channel (PRO-3781): a cookie match whose order carries smaily_rec_ctx = 'storefront' is a storefront credit — no email click time, no smaily_campaign_id, and the discount learners leave it out (isStorefrontChannel / storefrontChannelSql, lib/engine/attribution/channel.ts).

Last updated: 2026-10-05