Echo/Docs

CLI command

mmm forecast

The ad spend forecast of a month: the spend and conversions each channel and each campaign reported so far in one currency, and the month's projected totals with the method and, when asked, their intervals.

Invocation#

Shell
echo-cli mmm forecast --month <YYYY-MM> --currency <code> [--sigmas <n>]

Inputs and output#

Writes month, currency, from (the month's first day), through (the last whole day read), days_elapsed, days_in_month, method, sigmas and interval_method (null without --sigmas), and the month's totals: spend_to_date, projected, spend_interval, conversions_to_date, conversions_projected, conversions_interval and conversions_unreported_days (campaign days whose conversions were not reported, left out of the conversions); then channels (per ad platform, with channel) and campaigns (per campaign, with campaign_id, name and channel), each with the same totals, the most spent first. An interval is { low, high }, or null without --sigmas or when only one day has passed.

State effect#

The command calls Echo Web's authenticated /api/analytics/mmm/forecast with ECHO_INTERNAL_BEARER at ECHO_WEB_BASE_URL; the Ad spend forecast section of the tracking screen and of Echo Desktop's GEO screen read the same (with the standard errors typed, if any), and echo-mcp runs it as echo_spend_forecast. Spend and conversions are read from ad_campaign_metrics through the campaigns of ad accounts that declare --currency, as mmm fit reads them, from the month's first day through the last whole day before now (UTC). While the month runs, each projection is the run rate: to date divided by the days elapsed and times the month's days; once it has ended, the projection is what was reported. With --sigmas, the days still to come are taken as draws like the days elapsed: the remaining sum's variance is the remaining days times the daily variance plus the remaining days squared times the daily variance over the days elapsed, and the interval is the projection plus or minus --sigmas standard errors, never below what was already reported; an ended month's interval is what was reported. It stores nothing.

Refusals#

  • A wrong invocation is refused before anything is sent: "mmm forecast does not take <flag>; it takes --month, --currency, --sigmas", "<flag> needs a value" and "mmm forecast needs <flag>".
  • Echo Web answers a bad request with "month is required as YYYY-MM: the calendar month to forecast; got <value>", "currency is required: the currency the spend is read in, as the ad accounts declare it", "sigmas, when given, must be a positive number: how many standard errors each projection's interval spans; got <value>", "<month> has not had a whole day yet, so there is no spend to forecast from" or "campaign <id> reported no spend on <day>, so the month cannot be measured"; not found with "no ad account reported spend in <currency> during <month>"; and fails with "ad_campaign_metrics holds spend of campaign <id> on <day>, which ad_campaigns does not hold". The command prints Echo Web's sentence and exits 1.