Feature docs

Discount analytics on Vareons for Egypt stores

Discount analytics shows promotion performance from /dashboard/discounts/analytics tenant-wide and from /dashboard/discounts/[id]/analytics per coupon, based on Coupon.data.analytics and the redemptions log updated at order creation.

Last verified: 2026-09-19

Tenant-wide analytics opens at /dashboard/discounts/analytics with Bar, Line, and Pie charts for usage by type and month, a Top discounts table by redemption amount, a 7 / 30 / 90 / 365-day range picker, and a single-discount selector.

Per-coupon analytics opens from the View Analytics row action or directly at /dashboard/discounts/[id]/analytics, reads through GET /api/dashboard/discounts/[id]/get, and shows total redemptions, total discount given, orders using the coupon, average discount per order, redemption rate, and last used date.

The source is the order: POST /api/orders/create persists data.discounts[], data.totals.discountTotal, and data.coupon, then aggregates Coupon.data.analytics and appends to Coupon.data.redemptions with orderId, customerId, and amount. Redemptions are therefore recorded at order creation, not at validate time.

Known gaps: the page client sends range and discount but the current handler only reads tenant, and Export Report calls /api/dashboard/discounts/analytics/export, which is not implemented — use Export CSV from the list page for now.

Setup steps in Vareons

  1. Open the tenant analytics page

    From /dashboard/discounts open /dashboard/discounts/analytics and review the charts and top-performers table.

  2. Compare by type and month

    Switch between Bar, Line, and Pie, then pick a 7, 30, 90, or 365-day range and a single discount to compare.

  3. Open single-coupon analytics

    From the discount row click View Analytics or open /dashboard/discounts/[id]/analytics and review redemptions, amounts, per-order average, redemption rate, and last use.

  4. Tie numbers back to orders

    Open /dashboard/orders/[id] and confirm the data.discounts[] lines and data.totals.discountTotal match the analytics.

  5. Decide: keep, pause, or duplicate

    For a weak promotion use Pause via PATCH status; for a winner use Duplicate with a _COPY code for a new season.

Frequently asked questions

Where do I find discount analytics?

Tenant-wide analytics live at /dashboard/discounts/analytics; single-coupon analytics at /dashboard/discounts/[id]/analytics via View Analytics.

Which metrics are shown per discount?

Total redemptions, total discount given, orders using it, average discount per order, redemption rate, and last used date.

When do analytics numbers update?

Only at order creation via POST /api/orders/create, not when the code is validated at checkout.

Does the analytics report export work?

Export Report points to a currently unimplemented endpoint; use Export CSV from /dashboard/discounts instead.

Why does the number not change with the date range?

The current handler only reads tenant and ignores the range and discount sent by the UI; compare manually via the top table or order records.

Troubleshooting

1) If numbers show zero, confirm the coupon is Active and orders were created after activation, since redemption records only at order creation. 2) If filters do not change numbers, remember range and discount are currently ignored by the handler. 3) If Export Report fails, use Export CSV from the list page. 4) If analytics totals differ from orders, check data.discounts[] and data.totals.discountTotal in /dashboard/orders/[id].

Important limitations

• Redemptions record at order creation, not at validation. • The range and discount filters are sent by the UI but currently ignored by the handler. • Analytics export is not implemented; the fallback is Export CSV. • The full stacking matrix is currently summed rather than fully enforced.

Related links

تواصل معنا على واتساب