Echo/Docs

CLI command

mmm payback

Cohort CAC payback: per ad campaign and month of acquisition, what each user cost and the month their revenue paid it back.

Invocation#

Shell
echo-cli mmm payback --months <n> --currency <code> --value-property <name>

Inputs and output#

Writes currency, from (the first day of the oldest cohort month), value_property, unsynced_users (users whose first attributed campaign Echo has not synced), other_currency_events (revenue events of acquired users in another currency) and cohorts, oldest month first and the most spent first within a month: campaign_id, platform, name, month, users, spend, cac, revenue_per_user (accumulated, one entry per month from the cohort's month to the current one) and payback_month (the first entry that reaches cac, counting from 0; null while none has).

State effect#

The command calls Echo Web's authenticated /api/analytics/mmm/payback with ECHO_INTERNAL_BEARER at ECHO_WEB_BASE_URL; the CAC payback by cohort section of the tracking screen and of Echo Desktop's GEO screen read the same, and echo-mcp runs it as echo_cac_payback. A user belongs to the campaign and calendar month (UTC) of their first ad_attribution_events row carrying both a user and a campaign; users first attributed before the oldest month are not in any cohort. The campaign is matched to the synced ad_campaigns row of that platform campaign id, and its ad account must declare --currency. CAC is that campaign's spend in the cohort's month from ad_campaign_metrics over the cohort's users. Revenue is the number every web and mobile event of an acquired user from acquisition on holds under --value-property, when its currency property equals --currency; Stripe and RevenueCat events carry net_revenue and currency. It stores nothing.

Refusals#

  • A wrong invocation is refused before anything is sent: "mmm payback does not take <flag>; it takes --months, --currency, --value-property", "<flag> needs a value" and "mmm payback needs <flag>".
  • Echo Web answers a bad request with "months must be a positive whole number: how many calendar months of cohorts to read, the current one included; got <value>", "currency is required: the currency spend and revenue are read in, as the ad accounts declare it", "value_property is required: the event property holding the revenue, such as net_revenue", "campaign <id> reported no spend on <day>, so its cohort's CAC cannot be measured" or "an <event> event at <time> holds no number under <property>, so its revenue cannot be summed"; and not found with "no user was attributed to a synced ad campaign in <currency> since <from>, so there is no cohort to pay back". The command prints Echo Web's sentence and exits 1.