Echo/Docs

CLI command

analytics costs

Record, list and remove what a channel cost besides its ad spend.

Invocation#

Shell
echo-cli analytics costs list [--channel <channel>] | record --channel <channel> --from <YYYY-MM-DD> --to <YYYY-MM-DD> --amount <n> --currency <code> --description <text> --by <name> | remove <id>

Inputs and output#

list prints the recorded costs, newest period first; record prints the stored cost; remove prints the removed one. A channel is named the way ad_conversion_feedback_events names ad_platform, so unit-economics adds the cost to that channel, and mmm fit adds it, spread evenly over the days its period covers, to that channel's weekly spend in its currency (a channel with no ads enters the panel through its costs alone).

State effect#

record and remove call Echo Web's /api/analytics/costs operation, which writes channel_costs; the Channel costs panel on Echo Web's tracking screen lists, records and removes costs through the same operation. A cost is never negative and its period never ends before it starts; the amount is a JSON number or the text of one, which is what --amount sends.

Refusals#

  • A missing or blank field, a day that is not a calendar day, a period that ends before it starts, or an amount that is not a non-negative number is refused by Echo Web with HTTP 400 naming the field; echo-cli prints it and exits 1.
  • remove of an id no cost has is refused with HTTP 404 naming how to list costs.
  • An unknown, repeated or valueless flag, or a verb other than list, record and remove, is refused with the usage status 2.