Skip to content

Program rules

This page lists the rules the engine uses to count progress and issue rewards. They help you explain to buyers why a discount hasn’t arrived yet or why a scenario disappeared from their profile.

During the pilot we configure scenarios, budgets and durations as agreed with you. Your server doesn’t change them, but it sees the result in the user status and in webhooks.

  • Described in the vocabulary. An event of a type that isn’t in your vocabulary is stored but not counted: status ignored, reason unknown_type (E5).
  • In the client currency. There is one currency per client. An event in another currency isn’t counted: reason currency_mismatch (E6).
  • Not from the future. An occurred_at more than 5 minutes ahead gets a 400. There is no general age limit: whether an old event counts is decided by the scenario’s window and campaign dates (E4).
  • Within the daily limit. An event type can have a daily limit, for example at most 5 listings. An event over the limit isn’t counted: reason over_limit. Days follow the client time zone, Asia/Baku by default (E7, M1).
  • In occurred_at order. The order in which events reached us doesn’t affect counting (E8).

A scenario is done when all its steps are done. A step is an event type, a metric, a threshold and, if needed, a filter on event fields, for example listing.photos ≥ 10.

Metric What is counted Example
count the number of counted events 3 purchases
sum the sum of amount after discounts; with an item filter, price × qty of matching items 100 AZN or more
distinct_values the number of distinct values of one field 20 different listings
distinct_days the number of distinct calendar days 5 different days
distinct_weeks the number of distinct weeks (Mon–Sun) top-ups in 4 different weeks
consecutive_weeks weeks in a row without a gap 4 weeks in a row

An event with items passes an item filter if at least one item matches (M3, M5). Steps can be done in any order (W2).

Window When the scenario is done What the buyer sees
no window all steps done since the campaign start progress accumulates
sliding, any N days at some moment all steps are done by events from the last N days progress doesn’t reset, old events drop out one by one; the date of the next drop is shown
from_first_event, N days from the first event all steps done within N days of the event that opened the attempt a countdown; if time runs out, the next event starts over

N days means N × 24 hours, not calendar days (W1).

  • Campaign dates. Events with occurred_at between the campaign start and end count. After the end the scenario can’t be completed, but rewards for completions within the dates are still issued later (W4).
  • Counting the past. When a scenario launches, events that already happened, including imported history, can count, but no older than 90 days before launch. History alone doesn’t complete a scenario: at least one new event after launch is needed (W5, H1).
  • Repeatability. A scenario is “once”, “N times” or “unlimited”. After a completion the next attempt starts from zero: events and values already counted in a completed attempt are not used again (W3).
  • A scenario with an object, for example per listing, is counted separately for each object: “once” means once per listing, and the discount is tied to that object through applies_to_ref (O1–O3).
  • Levels. A ladder such as 1 / 5 / 15 purchases is passed once, and each level has its own reward. One event can close several levels at once. A reached level stays reached even if progress later drops (L1–L3).
  • A badge is issued right at completion, without a delay. It stays while at least one valid completion grants it. The profile shows the highest level of the badge reached (B1–B4).
  • Delay is how long to wait after the completion before the discount becomes available; validity is how long it lasts after that. In live both are set in whole days: delay from 0 to 90 days, validity from 1 to 365 days. In test they can be set to the minute, so you can check things fast.
  • Refund window. You have a period in which a purchase can be refunded. In live the discount delay must be no shorter than that period: then a refund can cancel the discount before it can be used (R10).
  • A late event. If a discount appears later than completion plus delay, for example because an event arrived late, it becomes available at once and validity counts from that moment. A discount is never born expired (R7).
  • Reserving and redeeming are described in the Checkout guide. A redeemed discount stays redeemed forever (R3).

A budget limits how many discounts a scenario can issue over its lifetime, to all buyers together (R5).

  • A budget unit is one discount, not money. A budget of 500 means 500 issued discounts, whatever their size.
  • The budget is shared by all versions and levels of a scenario, and separate in test and live.
  • In live a scenario with a discount doesn’t launch without a budget. The budget can be raised or lowered at any time, including to 0. A budget of 0 is an emergency stop for discounts.
  • The budget ran out. The completion still counts, but no discount is created for it, and none appears later even if the budget is raised. Badges don’t spend budget and are issued as usual.
  • A unit comes back only if a purchase refund cancelled the discount. An expired discount or one annulled by an operator doesn’t return its unit.

A completion cap limits how many times a scenario can be completed by all buyers together, for example “the first 100 sellers” (R8).

  • Each new completion first takes a place under the cap, and only then does its discount take a budget unit.
  • No place left: the completion is recorded over the cap, without a discount and without badges. Raising the cap later doesn’t change that.
  • A place is freed if a refund cancelled the completion. The freed place goes to the next new completion, never to anyone retroactively.
  • Once the cap is reached, the scenario is hidden from new buyers, as with an exhausted budget.
flowchart LR
  c["Scenario done"] --> cap{"Place left<br/>under the cap?"}
  cap -- no --> over["Over the cap:<br/>no discount, no badges"]
  cap -- yes --> b["Badges issued"]
  b --> bud{"Budget unit<br/>left?"}
  bud -- no --> nob["No discount"]
  bud -- yes --> r["Discount pending,<br/>then available"]
  • A refund is always full. order.refunded or order.chargeback excludes the original purchase entirely; the amount in the refund is ignored (V2, V3).
  • A refund before the purchase waits for it and applies when the purchase arrives (V4).
  • Consequences. If the scenario is no longer done without the purchase, an unused discount is cancelled (reward.cancelled), and a badge is revoked if nothing else holds it (badge.revoked). A redeemed discount stays (V5).
  • A chargeback reversal (order.chargeback_reversed) makes the purchase count again (V7).
  • Refunds always apply: campaign dates and the daily limit don’t restrict them (V8).
  • Control group. Some buyers don’t take part in a scenario so that its effect can be measured fairly. Their progress is counted, but without rewards, badges, budget or webhooks, and the status shows group: control (C1, C2). Details are in the Users and the control group guide.
  • Shadow. We first run a new scenario version in shadow: it counts real events but issues nothing and isn’t visible to buyers. Based on its measurement we decide together whether to launch it (S1).
  • Editing a scenario creates a new version. Started attempts move to it; rewards already issued don’t change (W6).

At your request, an Zirva operator can cancel an unused discount, pending or available, for example in case of abuse. A reward.cancelled webhook follows. A reserved or redeemed discount can’t be cancelled. The budget unit isn’t returned (R9).