Ads Manager ExtensionConversions, revenue and ROAS per Meta campaign, ad set or ad

Conversions, revenue and ROAS per Meta campaign, ad set or ad

The Meta rows of an explore attribution query (see POST /client/v1/data/query) for one client on the caller's roster: every conversion in the window is credited to the person's sessions in the 30 days before it, across devices and CRM contact ids, and the credit lands on the Meta campaign, ad set or ad in the session's landing URL. Spend for the same dates is joined in. The body is the same one /data/query returns for that spec, plus the conversion used, and the two share a cache.

conversion=auto (the default) picks the first source with data in the window: won CRM deals, then purchase (valued by value), then GHL order_completed (valued by activity_value), then appointment_booked, form_submitted or contact_created (no value, for cost per conversion). When none has data the answer is conversion: null with no rows. A deal counts only if its latest status is still won, the same rule attribution applies.

curl -X GET "https://mythic-analytics.gulp.workers.dev/client/v1/extension/performance?location_id=example_string&account_id=example_string&from=2024-12-25&to=2024-12-25&level=campaign&model=last&conversion=auto&value_property=example_string&pipeline=example_string&timezone=example_string" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
{
  "success": true,
  "data": {
    "conversion": {
      "conversion": "deals"
    },
    "kind": "attribution",
    "totals": {
      "conversions": 75,
      "revenue": 210258.9,
      "spend": 41200,
      "roas": 5.1,
      "cpa": 549.33,
      "ad_conversions": 3,
      "ad_revenue": 4494,
      "unmatched_ad_conversions": 0,
      "no_touchpoint": 54,
      "mixed_currency": false
    },
    "filtered": {
      "rows": 2,
      "conversions": 3,
      "revenue": 4494,
      "spend": 41200,
      "roas": 0.11,
      "cpa": 13733.33
    },
    "sampled": false,
    "rows": [
      {
        "type": "ad",
        "platform": "meta_ads",
        "account_id": "1234567890",
        "campaign_id": "120247921827310631",
        "campaign_name": "HV - FF - Creative Testing",
        "currency": "USD",
        "spend": 20600,
        "impressions": 812000,
        "clicks": 9100,
        "conversions": 1,
        "revenue": 2497,
        "persons": 1,
        "cpa": 20600,
        "roas": 0.12,
        "median_days": 3.6
      }
    ]
  }
}
GET
/client/v1/extension/performance
GET
Base URLstring

Target server for requests. Edit to use your own host.

Bearer Token
Bearer Tokenstring
Required

Agency-wide mcp_ key holding extension:read, or an agency key (ak_). A location secret key (sk_) or a client-bound mcp_ key gets 403 agency_key_required. See Using an mcp_ key over HTTP.

Agency-wide mcp_ key holding extension:read, or an agency key (ak_). A location secret key (sk_) or a client-bound mcp_ key gets 403 agency_key_required. See Using an mcp_ key over HTTP.
query
location_idstring
Required

A client on the key's roster.

query
account_idstring

Meta ad account; an act_ prefix is accepted. Omit for every account.

query
fromstring

YYYY-MM-DD. Default 30 days before today (UTC).

Format: date
query
tostring

YYYY-MM-DD inclusive. Default today.

Format: date
query
levelstring
Options: campaign, adset, ad
query
modelstring

last = last non-Direct touch.

Options: last, first, linear
query
conversionstring

auto, deals, or event:<event name>.

query
value_propertystring

With conversion=event:<name>. The numeric property holding each conversion's value.

query
pipelinestring

With conversion=deals. Exact GHL pipeline name.

query
timezonestring

IANA zone the dates are read in. Default UTC.

Request Preview
Response

Response will appear here after sending the request

Authentication

header
Authorizationstring
Required

Bearer token. Agency-wide mcp_ key holding extension:read, or an agency key (ak_). A location secret key (sk_) or a client-bound mcp_ key gets 403 agency_key_required. See Using an mcp_ key over HTTP.

Query Parameters

location_idstring
Required

A client on the key's roster.

account_idstring

Meta ad account; an act_ prefix is accepted. Omit for every account.

fromstring

YYYY-MM-DD. Default 30 days before today (UTC).

tostring

YYYY-MM-DD inclusive. Default today.

levelstring
Allowed values:campaignadsetad
modelstring

last = last non-Direct touch.

Allowed values:lastfirstlinear
conversionstring

auto, deals, or event:<event name>.

value_propertystring

With conversion=event:<name>. The numeric property holding each conversion's value.

pipelinestring

With conversion=deals. Exact GHL pipeline name.

timezonestring

IANA zone the dates are read in. Default UTC.

Responses

successboolean
dataobject

conversion (the source used, or null), totals over every conversion of the client, filtered after the Meta and account filter, sampled, rows[] (one per campaign, ad set or ad with spend, impressions, clicks, conversions, revenue, persons, cpa, roas, median_days, names and account_id), and meta.