Echo/Docs

CLI command

analytics revenue

Split net revenue — RevenueCat's or Stripe's payments — by acquisition channel under the credit model named — the payer's ad platform or a multi-touch model over their web sessions — adding up to the stored revenue.

Invocation#

Shell
echo-cli analytics revenue --by channel --source <revenuecat|stripe> --app <app-id> --environment <name> --days <days> --model <ad_platform|first_touch|last_touch|linear|markov>

Inputs and output#

Writes source (where the payments were read), app_id, environment, since (the start of the window), model (the one credited by), models (every model with how it credits a payment) and currencies, each with currency, revenue (net of refunds), payments and channels, most revenue first, each with channel, revenue and payments (how many payments credited any of it; a payment split by a multi-touch model counts in each channel it reached). Every payment's credits sum to its net amount, so each currency's channels sum to its revenue.

State effect#

The command calls Echo Web's authenticated /api/analytics/attribution/revenue with ECHO_INTERNAL_BEARER at ECHO_WEB_BASE_URL; the Revenue by channel section of the tracking screen and of Echo Desktop's GEO screen read the same split for the source and model chosen there, and echo-mcp reads it too (echo_revenue_by_channel). With --source revenuecat it reads every RevenueCat payment the app stored in the environment over the last --days days, the payer being its RevenueCat app user id; with --source stripe it reads every payment the Stripe webhook recorded as a web event of the web source --app names in the environment (production or test, as the webhook names it from Stripe's livemode), the payer being the user id the payment names, else its anonymous id, and its net amount its revenue less its refund_amount. ad_platform credits a payment whole to the ad platform of its payer's stored ad attribution, found through the identity edges as paid-ads conversion feedback finds it. first_touch, last_touch, linear and markov credit it as analytics attribution credits a conversion: the payer is the visitor the identity edges join the payer's id to, the payment's touches are that visitor's web sessions and paid install attributions of the window (each ad attribution the mobile attribution path recorded naming an ad platform, a touch on paid_<platform>) that began at or before it was paid, and markov weighs each channel by its removal effect over one converting path per payment and one path per visitor who paid nothing. A payment whose payer has no attribution, or no touch before paying, or that names no payer, goes to unattributed. Amounts in different currencies are never added. It writes nothing.

Refusals#

  • A wrong invocation is refused with the usage status 2 before anything is sent: "analytics revenue needs --by channel, the one split it offers; got <value>", "analytics revenue needs <flag>" for each of --source, --app, --environment, --days and --model, "analytics revenue does not take <flag>; it takes …", "<flag> needs a value" and "<flag> may be supplied only once".
  • Echo Web answers a bad request with "source must be one of revenuecat, stripe: where the payments are read; got <source>", "days must be a positive whole number: the window to read" or "model must be one of ad_platform, first_touch, last_touch, linear, markov: how a payment is credited to channels; got <model>", and a stored payment naming no currency ("payment <id> of <source> names no currency, so its revenue cannot be added to any") or holding an amount or timestamp that is not a number ends the read naming the row.