upstack query-attribution shows which UTM source, campaign, ad set, or ad gets credit for
your orders, with revenue, new customers, spend, and ROAS on every row. It wraps
Run an attribution query, which has the
full request and response reference. How attribution works
explains how credit is assigned.
Usage
Breakdown dimensions
--dimension decides what each row is. The CLI rejects any other value before sending the
request.
Names come from your connected ad platform when the click’s IDs match its data, otherwise
from the UTM value on the click. A campaign without matching platform data shows its raw ID
as the name. Rows with no value show
(not set).
Required flags
Optional flags
-i, --output, --file, and --from-file work as described in
upstack query shared flags. --output table and csv print one
line per row with every measure column.
Filters
--filter takes the same canonical tree as every query command. Two families of fields work
here.
To filter by campaign ID, put the ID in
attribution.utm_campaign. Fields like
channel.campaign_id belong to query-ads and
query-channel-details, and this endpoint rejects them:
attribution.utm_source condition when the same campaign name shows up under more than one
channel.
orders.* conditions support every operator upstack filters lists for them, but only with
--value-source orders. With events they’re ignored.
From-file schema
--from-file takes a JSON file of parameter-style keys, the same names as the flags, not
the API request body. Flags override file values.
Response shape
results has one entry with dateRange, dimension, the filter you sent, data.primary,
and measureDetails. The sample below is a real campaign-grain response, trimmed to a few of
the measure columns.
- Rows are sorted by
orders.count(orcore.conversionswith--value-source events), highest first. - With
orders, rows carryorders.*measures. Withevents, they carrycore.conversions,core.unique_converters,core.conversion_value,core.average_conversion_value,core.cpa, andcore.roas. Both addchannel.*ad platform measures andtracked.*visitor counts.measureDetailslists every measure id on the rows, with its total. - Values are numeric strings, and zero comes back as
null. utm_adsetandutm_adappear on every row but only hold the row’s own ad set or ad at those two grains.
Examples
Errors
See Errors and edge cases
for the full list.
See also
- Run an attribution query: the API this command wraps.
- How attribution works: models, windows, and touchpoints.
- Set up UTM parameters so clicks land in the right campaign.
upstack query-ads: spend and performance per ad from the ad platforms, without attribution.upstack filters: every filter field and the contexts it applies to.upstack measures: measure ids.