Sign in

Campaign Revenue Report

GET https://{organization}.myguper.com/api/order/report/campaign/{campaignId}

How many sales a campaign was attributed and how much they were worth.

Attribution means the customer redeemed balance from the campaign (cashback, point, coupon), or received a message from it and bought within the attribution window (notification). Sales the campaign merely rewarded are not counted — the reward is a consequence of the sale, not its cause.

This lives in the order service because the sale value does. The loyalty campaign report measures the benefit (credited, redeemed, outstanding balance); this one measures the revenue. They answer different questions and will not match.

byOrigin does not add up to total, by design. A sale attributed through more than one origin counts once in each. total counts distinct orders, so it is always less than or equal to the sum of byOrigin.

Attribution is not incrementality. These sales may have happened anyway — the customer had balance and used it, but might have bought regardless. Read this as influenced revenue, not generated. Measuring real impact requires a control group.

Cancelled orders are excluded — revenue from a reverted sale is not revenue.

All monetary values are integers in cents, in the organization's currency. revenueGross is the order total before the redeemed balance is taken out; revenueNet subtracts it and is what came in as money. avgDiscount is redeemed / revenueGross (a ratio), averageTicketGross is revenueGross / orders and averageTicketNet is revenueNet / orders, all over distinct orders; the gap between the two tickets is the average balance applied per order.

baseline is the ruler: orders not attributed to this campaign, in the same window and organization. Without it an absolute revenue figure always looks good. It is cached (the query is expensive and the value moves slowly), so it carries its own computedAt and is not from the same instant as the rest of the payload.

When no period is given, the window runs from the first to the last attributed order — comparing against all-time would fill the baseline with periods when the campaign did not exist. period.explicit tells which of the two happened.

The date range is all-or-nothing. Informing only one of the two returns 404 — the route itself does not match with a single date. Half a window silently ignored would return all-time numbers wearing the requested period's face.

Try-it values populated from environment ACME (Demo)


Authentication

Token

Send your user token in the x-guper-authorization header.

Headers

Name Type Description
x-guper-authorization * string User token issued by Guper.
Content-Type * string Always `application/json` for endpoints that accept a JSON body.

Path parameters

Name Type Description
campaignId * integer Loyalty campaign id.
dateStart string Start of the period, `YYYY-MM-DD`, filtering by order date. Requires `dateEnd`.
dateEnd string End of the period, `YYYY-MM-DD`, inclusive. Requires `dateStart`.

Responses

{
    "meta": {
        "unit": "cents",
        "attribution": {
            "rule": "Venda atribuida a campanha cujo saldo foi resgatado (cashback/point/coupon), ou cuja mensagem o cliente recebeu e comprou dentro da janela (notification). Campanha que apenas premiou a venda NAO entra.",
            "caveat": "Atribuicao nao e incrementalidade: a venda pode ter acontecido de qualquer forma. Ler como receita INFLUENCIADA, nao gerada. Medir impacto real exige grupo de controle."
        },
        "notes": {
            "revenueGross": "total_order dos pedidos atribuidos. Bruto: o resgate NAO esta descontado.",
            "revenueNet": "revenueGross - redeemed. O que entrou como dinheiro.",
            "returnOnBenefit": "revenueGross / redeemed. Sobre o RESGATADO, nao o creditado.",
            "baseline": "Pedidos NAO atribuidos a esta campanha, mesma janela e organizacao.",
            "byOrigin": "Nao soma com total: pedido atribuido por mais de uma origem conta uma vez em cada."
        }
    },
    "campaign": 361,
    "period": {
        "start": "2025-12-06",
        "end": "2026-08-17",
        "explicit": false
    },
    "total": {
        "orders": 10254,
        "clients": 8538,
        "revenueGross": 1904183642,
        "redeemed": 333571751,
        "revenueNet": 1570611891,
        "averageTicket": 185702,
        "avgDiscount": 0.1752,
        "averageTicketGross": 185702,
        "averageTicketNet": 153171,
        "returnOnBenefit": 5.71
    },
    "baseline": {
        "orders": 185201,
        "averageTicket": 280407,
        "ticketDeltaPct": -33.8,
        "computedAt": "2026-08-17 18:02:09"
    },
    "repeat": {
        "clients": 8538,
        "repeatClients": 1330,
        "repeatRate": 15.6,
        "ordersPerClient": 1.2
    },
    "byOrigin": [
        {
            "origin": "cashback",
            "orders": 10254,
            "revenueGross": 1904183642,
            "averageTicket": 185702
        }
    ]
}
Copied to clipboard