CLI command
mmm library
The ads library: every synced ad campaign with the operator's tags and its metrics summed over the last days, best return on spend first; tagging and untagging a campaign.
Invocation#
echo-cli mmm library --days <n> [--tag <tag>]
echo-cli mmm tag --campaign <campaign-id> --tag <tag> --by <who>
echo-cli mmm untag --campaign <campaign-id> --tag <tag>Inputs and output#
library writes since and entries: per campaign, campaign_id, platform, name, status, currency, tags, impressions, clicks, spend, conversions, conversion_value, click_through, cost_per_conversion and return_on_spend (null where the denominator is nothing), the measured return highest first and the unmeasured after. tag writes the stored tag: campaign_id, tag, tagged_by, tagged_at; untag writes the tag it removed.
State effect#
The verbs call Echo Web's authenticated /api/analytics/mmm/library (GET, PUT and DELETE) with ECHO_INTERNAL_BEARER at ECHO_WEB_BASE_URL; the Ads library section of the tracking screen and of Echo Desktop's GEO screen read and tag the same, and echo-mcp runs them as echo_ads_library, echo_ads_tag and echo_ads_untag. Metrics are summed from ad_campaign_metrics from the day --days days ago; each campaign's currency is its ad account's. Tags are stored in ad_campaign_tags, one row per campaign and tag, and go when the campaign goes. --tag narrows the library to the campaigns carrying it.
Refusals#
- A wrong invocation is refused before anything is sent: "mmm <verb> does not take <flag>; it takes …", "<flag> needs a value" and "mmm <verb> needs <flag>".
- Echo Web answers a bad request with "days must be a positive whole number: the window of metrics to sum; got <value>", "campaign_id is required: the synced ad campaign to tag, as the library lists it", "tag is required: what the campaign is, such as a hook, offer or format", "tagged_by is required: who tags it", "campaign_id is required: the campaign to untag", "tag is required: the tag to remove" or "campaign <id> reported no <metric> on <day>, so its window cannot be summed"; not found with "no synced ad campaign has id <id>; echo-cli mmm library lists them" or "campaign <id> is not tagged <tag>"; a conflict with "campaign <id> is already tagged <tag> by <who>"; and fails with "ad_campaign_metrics holds metrics of campaign <id> on <day>, which ad_campaigns does not hold". The command prints Echo Web's sentence and exits 1.