tanqoryExtMarketingPerformance
- Query
- Discounts and marketing
Sales attributed to marketing over a range of days (inclusive, in the store's time zone), read from the store's orders: an order is marketing traffic when its landing URL carries UTM parameters or it has a referring site other than the store (last non-direct click). compareFrom / compareTo add the previous period. campaignId limits every figure to the traffic of one campaign. traffic (default MARKETING) picks which traffic is attributed: ALL adds direct traffic (as the channel "Direct"), PAID / ORGANIC keep one type. attributionModel (default LAST_NON_DIRECT_CLICK): an order records one visit (its landing URL and referrer), so every model credits that visit; LAST_CLICK and ANY_CLICK also credit direct visits. Sessions are not tracked: the session fields are null.
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
attributionModel | TanqoryExtAttributionModel | Optional | |
campaignId | ID | Optional | |
compareFrom | Date | Optional | |
compareTo | Date | Optional | |
from | Date! | Required | |
to | Date! | Required | |
traffic | TanqoryExtMarketingTraffic | Optional |
Returns
TanqoryExtMarketingPerformance!
| Field | Type | Description |
|---|---|---|
attributedOrders | Int! | |
attributedSales | Decimal! | Sales of the orders attributed to marketing (or to the campaign). |
averageOrderValue | Decimal | attributedSales / attributedOrders, null without orders. |
campaigns | [TanqoryExtMarketingCampaignRow!]! | Attributed traffic grouped by campaign (utm_campaign, or the store's campaign it matches). |
channels | [TanqoryExtMarketingChannelRow!]! | Attributed traffic grouped by channel (utm_source or referring domain), largest sales first. |
compareDays | [TanqoryExtMarketingDay!] | |
currencyCode | CurrencyCode! | |
days | [TanqoryExtMarketingDay!]! | One point per day of the range (and of the comparison range, when asked). |
newCustomerOrders | Int! | |
orders | Int! | |
returningCustomerOrders | Int! | |
sessions | Int | Sessions are not tracked by this server yet: always null. |
totalSales | Decimal! | Sales of all orders in the range (the store's total sales). |
utm | [TanqoryExtMarketingUtmRow!]! | Attributed traffic grouped by UTM source / medium / campaign. |
Example request
A starting point: required arguments as variables and a few fields of the result. Replace the placeholders.
Set STORE_ID and TANQORY_ACCESS_TOKEN in your environment first (Make your first API call).
curl -X POST "https://api.tanqory.com/admin/2026-10/stores/$STORE_ID/graphql" \
-H "Authorization: Bearer $TANQORY_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
--data '{"query":"query TanqoryExtMarketingPerformance($from: Date!, $to: Date!) {\n tanqoryExtMarketingPerformance(from: $from, to: $to) {\n attributedOrders\n attributedSales\n averageOrderValue\n currencyCode\n newCustomerOrders\n orders\n returningCustomerOrders\n sessions\n totalSales\n }\n}","variables":{"from":"","to":""}}'// Node.js 18 or later (fetch is built in). Save as request.mjs and run: node request.mjs
const query = `query TanqoryExtMarketingPerformance(\$from: Date!, \$to: Date!) {
tanqoryExtMarketingPerformance(from: \$from, to: \$to) {
attributedOrders
attributedSales
averageOrderValue
currencyCode
newCustomerOrders
orders
returningCustomerOrders
sessions
totalSales
}
}`;
const variables = {
"from": "",
"to": ""
};
const res = await fetch(`https://api.tanqory.com/admin/2026-10/stores/${process.env.STORE_ID}/graphql`, {
method: 'POST',
headers: {
'Authorization': 'Bearer ' + process.env.TANQORY_ACCESS_TOKEN,
'Content-Type': 'application/json',
},
body: JSON.stringify({ query, variables }),
});
console.log(res.status, JSON.stringify(await res.json(), null, 2));# Python 3, standard library only. Save as request.py and run: python3 request.py
import json, os, urllib.request
query = """query TanqoryExtMarketingPerformance($from: Date!, $to: Date!) {
tanqoryExtMarketingPerformance(from: $from, to: $to) {
attributedOrders
attributedSales
averageOrderValue
currencyCode
newCustomerOrders
orders
returningCustomerOrders
sessions
totalSales
}
}"""
variables = json.loads("""{
"from": "",
"to": ""
}""")
req = urllib.request.Request(
"https://api.tanqory.com/admin/2026-10/stores/" + os.environ["STORE_ID"] + "/graphql",
data=json.dumps({"query": query, "variables": variables}).encode(),
headers={
"Authorization": "Bearer " + os.environ["TANQORY_ACCESS_TOKEN"],
"Content-Type": "application/json",
},
)
with urllib.request.urlopen(req) as res:
print(res.status, json.dumps(json.load(res), indent=2))