Skip to content

ads-warehouse

Keeps paid-ads performance where an agent can query it as often as it likes: daily ad-level metrics pulled read-only from Meta and Google, CSV exports, CRM leads and orders, the log of ads this vault created and the manifest of each creative variant, all in one DuckDB database. The reads come from here; the writes (meta-ads, google-ads) go to the platforms. That split keeps agents off the ad APIs' rate limits and terms, and ties each ad to revenue and customer value.

  • Area: Marketing
  • Category: marketing ads
  • Level: advanced
  • Input: conversation
  • Output: document
  • Setup: api-key
  • Roles: Head of Marketing

Pulls daily ad-level spend, clicks and conversions from Meta Ads and Google Ads into a local DuckDB warehouse and joins them to CRM leads, orders and creative variants.

How you ask

  • “Pull last month's Meta ad data for the company account and show cost per lead by creative”
  • “Import this Google Ads export for client acme and tell me which ads have no conversions”
  • “Which creative variant brought the customers with the highest lifetime value?”

Inputs

  • ad-account — ad-account note with platform, account_id, currency and credential_prefix; never a credential.
  • window — First and last day, YYYY-MM-DD, in the account time zone.
  • scope — company, or a client-id under {company.clients}/
  • csv-export — Ads Manager or Google Ads export with a Day breakdown (for segments, also one device, location or hour column), or a lead or order export.
  • kind — Which table the file feeds. (ads | segments | leads | orders)
  • sql — SELECT, WITH, DESCRIBE, SHOW or SUMMARIZE; or the status command.
  • month — Month to pace, YYYY-MM; the as-of day defaults to the latest day with rows.
  • target — Monthly spend target in the account currency; absent, only the projection is printed.
  • dimension — Dimension to split by; weekday needs no segmented data. (weekday | device | geo | hour)
  • window — First and last day, YYYY-MM-DD; absent, all rows.

Outputs

  • Month-to-date spend, both projections, gap to target, required daily budget, missing days; nothing is written to the vault.
  • Per segment spend, conversions, CPA, conversions lost if cut, gained if moved (an upper bound), net and call; nothing is written to the vault.
  • Rows as a table, CSV or JSON; nothing is written to the vault.
  • Written instead of the raw pull when --segment is given; one segmented ad-day per line.
  • normalised-import (jsonl)
  • raw-pull (jsonl)
  • {scope.marketing.sea}/data/imports/{kind}/{stamp}_{file}.jsonl
  • {scope.marketing.sea}/data/raw/{platform}/{account_id}/{since}{until}.jsonl
  • {scope.marketing.sea}/data/segments/{platform}/{account_id}/{segment}{since}.jsonl}_{stamp