01Run it
Replace the <placeholders> with your own values, or use the builder below.
p202 report crosstab02What you get
Captured from the real binary, run against a demo store with 30 days of traffic. Switch tabs to see the same run as JSON, the shape scripts and agents parse.
$ p202 report crosstab --rows ppc_account --cols country --metric profit --period last30 ppc_account Australia Canada Germany United Kingdom United States ------------------------ --------- ------ ------- -------------- ------------- Search Ads - Shopping 1214.56 -1.30 -13.20 2788.40 1293.25 Newsletter 348 762 936 1494 Social Ads - Prospecting 90.47 -40.80 392.30 1953.63 Search Ads - Brand 6.40 -57.60 -96 1354.34 Podcast Sponsorship -22.80 913.80 Social Ads - Retargeting 115.90 -0.87 373.54
$ p202 report crosstab --rows ppc_account --cols country --metric profit --period last30 --json { "data": [ { "Australia": 1214.56, "Canada": -1.3, "Germany": -13.2, "United Kingdom": 2788.4, "United States": 1293.25, "ppc_account": "Search Ads - Shopping" }, { "Australia": 348, "Canada": 762, "United Kingdom": 936, "United States": 1494, "ppc_account": "Newsletter" }, { "Canada": 90.47, "Germany": -40.8, "United Kingdom": 392.3, "United States": 1953.63, "ppc_account": "Social Ads - Prospecting" }, { "Canada": 6.4, "Germany": -57.6, "United Kingdom": -96, "United States": 1354.34, "ppc_account": "Search Ads - Brand" }, { "United Kingdom": -22.8, "United States": 913.8, "ppc_account": "Podcast Sponsorship" }, { "Australia": 115.9, "Canada": -0.87, "United States": 373.54, "ppc_account": "Social Ads - Retargeting" } ] }
03Build your command
Pick values and the command line writes itself, quoted and ready to paste.
p202 report crosstabSet flags below; the command updates as you type.
04Flags
24 flags, plus the global flags every command takes.
| Flag | What it does |
|---|---|
| --aff-campaign-idstring | Filter by INTERNAL campaign id (from campaign list), not the public id in tracking URLs |
| --aff-network-idstring | Filter by affiliate network ID |
| --browser-idstring | Filter by browser ID (the id of a --breakdown browser row) |
| --colsstring | Column dimension: campaign, aff_network, ppc_account, ppc_network, landing_page, keyword, country, city, region, browser, platform, device, isp, text_ad, ip, referer, referer_url, device_type, c1, c2, c3, c4, utm_source, utm_medium, utm_campaign, utm_term, utm_content, rotator, rotator_rule (aliases: geo=country, lp=landing_page, network=aff_network, offer=campaign, referrer=referer, referrer_url=referer_url, rule=rotator_rule, source=ppc_account)campaignaff_networkppc_accountppc_networklanding_pagekeywordcountrycityregionbrowserplatformdeviceisptext_adiprefererreferer_urldevice_typec1c2c3c4utm_sourceutm_mediumutm_campaignutm_termutm_contentrotatorrotator_rulegeo → countrylp → landing_pagenetwork → aff_networkoffer → campaignreferrer → refererreferrer_url → referer_urlrule → rotator_rulesource → ppc_account |
| --country-idstring | Filter by country ID |
| --device-typestring | Filter by device type ID: 1 Desktop, 2 Mobile, 3 Tablet, 4 Bot (the ids of --breakdown device_type rows) |
| --ipstring | Only clicks from this one IP address, IPv4 or IPv6 |
| --isp-idstring | Filter by ISP/carrier ID (the id of a --breakdown isp row) |
| --keywordstring | Only clicks whose keyword contains this text (case-insensitive) |
| --landing-page-idstring | Filter by landing page ID |
| --limit-rowsint · default 20 | Cap the number of rows fanned out |
| --method-of-promotionstring | Only direct-link clicks or only landing-page clicks: directlink, landingpagedirectlinklandingpage |
| --metricstring · default total_net | Metric to pivot: total_clicks, total_click_throughs, total_leads, total_income, total_cost, total_net, epc, avg_cpc, conv_rate, roi, cpa (aliases: clicks=total_clicks, conversions=total_leads, cost=total_cost, income=total_income, leads=total_leads, net=total_net, profit=total_net, revenue=total_income)total_clickstotal_click_throughstotal_leadstotal_incometotal_costtotal_netepcavg_cpcconv_rateroicpaclicks → total_clicksconversions → total_leadscost → total_costincome → total_incomeleads → total_leadsnet → total_netprofit → total_netrevenue → total_income |
| --period, -pstring | Period: today, yesterday, last7, last14, last30, last90, thismonth, lastmonth, thisyear, lastyear, alltimetodayyesterdaylast7last14last30last90thismonthlastmonththisyearlastyearalltime |
| --platform-idstring | Filter by platform (OS) ID (the id of a --breakdown platform row) |
| --ppc-account-idstring | Filter by PPC account ID |
| --ppc-network-idstring | Filter by PPC network ID, or none for the clicks with no traffic source |
| --refererstring | Only clicks whose referring URL contains this text (case-insensitive) |
| --region-idstring | Filter by region ID (the id of a --breakdown region row) |
| --rowsstring | Row dimension (one with an id filter): campaign, aff_network, ppc_account, ppc_network, landing_page, country, region, browser, platform, isp, text_ad, device_type (aliases: geo=country, lp=landing_page, network=aff_network, offer=campaign, source=ppc_account)campaignaff_networkppc_accountppc_networklanding_pagecountryregionbrowserplatformisptext_addevice_typegeo → countrylp → landing_pagenetwork → aff_networkoffer → campaignsource → ppc_account |
| --showstring | Which clicks count (default all): all, real, filtered, filtered_bot, leads; real = not filtered, filtered_bot = filtered as bots, leads = convertedallrealfilteredfiltered_botleads |
| --text-ad-idstring | Filter by text ad ID |
| --time-fromstring | Start: unix seconds, a date (2026-10-01, from its first second in the account's timezone) or a time with its offset (2026-10-01T09:30:00Z) |
| --time-tostring | End, inclusive: unix seconds, a date (2026-10-01, through its last second in the account's timezone) or a time with its offset |
05How it works
Pivots one metric across two dimensions by fanning out a breakdown per row. Example: report crosstab --rows ppc_account --cols country --metric profit --aff-campaign-id 90008
06For agents
Running this from an agent
- Read the same facts as JSON:
p202 commands report crosstab --json. - With
AI_AGENT,CLAUDECODEor another agent variable set, output is compact JSON and errors arrive on stderr as a JSON envelope with ahint. - Exit codes: 0 ok, 1 bad input, 2 auth, 3 network, 4 server error, 5 partial failure.
{
"path": "p202 report crosstab",
"use": "crosstab",
"short": "Two-dimension breakdown (e.g. traffic source × country) for one metric",
"long": "Pivots one metric across two dimensions by fanning out a breakdown per row.\nExample: report crosstab --rows ppc_account --cols country --metric profit --aff-campaign-id 90008",
"runnable": true,
"flags": [
{
"name": "aff-campaign-id",
"type": "string",
"default": "",
"usage": "Filter by INTERNAL campaign id (from `campaign list`), not the public id in tracking URLs",
"required": false
},
{
"name": "aff-network-id",
"type": "string",
"default": "",
"usage": "Filter by affiliate network ID",
"required": false
},
{
"name": "browser-id",
"type": "string",
"default": "",
"usage": "Filter by browser ID (the id of a `--breakdown browser` row)",
"required": false
},
{
"name": "cols",
"type": "string",
"default": "",
"usage": "Column dimension: campaign, aff_network, ppc_account, ppc_network, landing_page, keyword, country, city, region, browser, platform, device, isp, text_ad, ip, referer, referer_url, device_type, c1, c2, c3, c4, utm_source, utm_medium, utm_campaign, utm_term, utm_content, rotator, rotator_rule (aliases: geo=country, lp=landing_page, network=aff_network, offer=campaign, referrer=referer, referrer_url=referer_url, rule=rotator_rule, source=ppc_account)",
"allowed_values": [
"campaign",
"aff_network",
"ppc_account",
"ppc_network",
"landing_page",
"keyword",
"country",
"city",
"region",
"browser",
"platform",
"device",
"isp",
"text_ad",
"ip",
"referer",
"referer_url",
"device_type",
"c1",
"c2",
"c3",
"c4",
"utm_source",
"utm_medium",
"utm_campaign",
"utm_term",
"utm_content",
"rotator",
"rotator_rule"
],
"value_aliases": {
"geo": "country",
"lp": "landing_page",
"network": "aff_network",
"offer": "campaign",
"referrer": "referer",
"referrer_url": "referer_url",
"rule": "rotator_rule",
"source": "ppc_account"
},
"required": false
},
{
"name": "country-id",
"type": "string",
"default": "",
"usage": "Filter by country ID",
"required": false
},
{
"name": "device-type",
"type": "string",
"default": "",
"usage": "Filter by device type ID: 1 Desktop, 2 Mobile, 3 Tablet, 4 Bot (the ids of `--breakdown device_type` rows)",
"required": false
},
{
"name": "ip",
"type": "string",
"default": "",
"usage": "Only clicks from this one IP address, IPv4 or IPv6",
"required": false
},
{
"name": "isp-id",
"type": "string",
"default": "",
"usage": "Filter by ISP/carrier ID (the id of a `--breakdown isp` row)",
"required": false
},
{
"name": "keyword",
"type": "string",
"default": "",
"usage": "Only clicks whose keyword contains this text (case-insensitive)",
"required": false
},
{
"name": "landing-page-id",
"type": "string",
"default": "",
"usage": "Filter by landing page ID",
"required": false
},
{
"name": "limit-rows",
"type": "int",
"default": "20",
"usage": "Cap the number of rows fanned out",
"required": false
},
{
"name": "method-of-promotion",
"type": "string",
"default": "",
"usage": "Only direct-link clicks or only landing-page clicks: directlink, landingpage",
"allowed_values": [
"directlink",
"landingpage"
],
"required": false
},
{
"name": "metric",
"type": "string",
"default": "total_net",
"usage": "Metric to pivot: total_clicks, total_click_throughs, total_leads, total_income, total_cost, total_net, epc, avg_cpc, conv_rate, roi, cpa (aliases: clicks=total_clicks, conversions=total_leads, cost=total_cost, income=total_income, leads=total_leads, net=total_net, profit=total_net, revenue=total_income)",
"allowed_values": [
"total_clicks",
"total_click_throughs",
"total_leads",
"total_income",
"total_cost",
"total_net",
"epc",
"avg_cpc",
"conv_rate",
"roi",
"cpa"
],
"value_aliases": {
"clicks": "total_clicks",
"conversions": "total_leads",
"cost": "total_cost",
"income": "total_income",
"leads": "total_leads",
"net": "total_net",
"profit": "total_net",
"revenue": "total_income"
},
"required": false
},
{
"name": "period",
"shorthand": "p",
"type": "string",
"default": "",
"usage": "Period: today, yesterday, last7, last14, last30, last90, thismonth, lastmonth, thisyear, lastyear, alltime",
"allowed_values": [
"today",
"yesterday",
"last7",
"last14",
"last30",
"last90",
"thismonth",
"lastmonth",
"thisyear",
"lastyear",
"alltime"
],
"required": false
},
{
"name": "platform-id",
"type": "string",
"default": "",
"usage": "Filter by platform (OS) ID (the id of a `--breakdown platform` row)",
"required": false
},
{
"name": "ppc-account-id",
"type": "string",
"default": "",
"usage": "Filter by PPC account ID",
"required": false
},
{
"name": "ppc-network-id",
"type": "string",
"default": "",
"usage": "Filter by PPC network ID, or none for the clicks with no traffic source",
"required": false
},
{
"name": "referer",
"type": "string",
"default": "",
"usage": "Only clicks whose referring URL contains this text (case-insensitive)",
"required": false
},
{
"name": "region-id",
"type": "string",
"default": "",
"usage": "Filter by region ID (the id of a `--breakdown region` row)",
"required": false
},
{
"name": "rows",
"type": "string",
"default": "",
"usage": "Row dimension (one with an id filter): campaign, aff_network, ppc_account, ppc_network, landing_page, country, region, browser, platform, isp, text_ad, device_type (aliases: geo=country, lp=landing_page, network=aff_network, offer=campaign, source=ppc_account)",
"allowed_values": [
"campaign",
"aff_network",
"ppc_account",
"ppc_network",
"landing_page",
"country",
"region",
"browser",
"platform",
"isp",
"text_ad",
"device_type"
],
"value_aliases": {
"geo": "country",
"lp": "landing_page",
"network": "aff_network",
"offer": "campaign",
"source": "ppc_account"
},
"required": false
},
{
"name": "show",
"type": "string",
"default": "",
"usage": "Which clicks count (default all): all, real, filtered, filtered_bot, leads; real = not filtered, filtered_bot = filtered as bots, leads = converted",
"allowed_values": [
"all",
"real",
"filtered",
"filtered_bot",
"leads"
],
"required": false
},
{
"name": "text-ad-id",
"type": "string",
"default": "",
"usage": "Filter by text ad ID",
"required": false
},
{
"name": "time-from",
"type": "string",
"default": "",
"usage": "Start: unix seconds, a date (2026-10-01, from its first second in the account's timezone) or a time with its offset (2026-10-01T09:30:00Z)",
"required": false
},
{
"name": "time-to",
"type": "string",
"default": "",
"usage": "End, inclusive: unix seconds, a date (2026-10-01, through its last second in the account's timezone) or a time with its offset",
"required": false
}
]
}