01Jobs it does
Each one is a real command line. Copy it, or open it in the builder below to change it.
nested report
Also: group by several dimensions
p202 report groups02What 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 groups --by ppc_network,campaign --period last30 group Clicks Clickthroughs Conversions Revenue Cost Profit EPC Avg CPC ROI % ------------------------------ ------ ------------- ----------- ------- ------- -------- ------- ------- --------- Owned Media 458 458 27 3585 173 3412 7.8275 0.3777 1972.2543 › Bakery Pre-orders / Local 88 88 16 939 0 939 10.6705 0 0 › Coffee Subscription / US 140 140 2 64 77 -13 0.4571 0.55 -16.8831 › Project Tool Pro Annual / US 140 140 5 1980 96 1884 14.1429 0.6857 1962.50 › Spring Collection / US 90 90 4 602 0 602 6.6889 0 0 Search 1187 1187 52 8157 1214.53 6942.47 6.8719 1.0232 571.6178 › Coffee Subscription / US 228 228 14 578 86.64 491.36 2.5351 0.38 567.1283 › Free Trial to Paid / CA 128 128 9 261 230.40 30.60 2.0391 1.80 13.2812 › Holiday Gift Cards / AU 178 178 9 1025 85.44 939.56 5.7584 0.48 1099.6723 › Project Tool Pro Annual / US 168 168 8 3264 403.20 2860.80 19.4286 2.40 709.5238 › Spring Collection / US 277 277 7 1122 180.05 941.95 4.0505 0.65 523.1602 › Standing Desk Launch / UK 208 208 5 1907 228.80 1678.20 9.1683 1.10 733.479 Social 1255 1255 41 3607 645.34 2961.66 2.8741 0.5142 458.9302 › Bakery Pre-orders / Local 149 149 7 654 26.82 627.18 4.3893 0.18 2338.4787 › Coffee Subscription / US 177 177 10 346 51.33 294.67 1.9548 0.29 574.0697 › Free Trial to Paid / CA 170 170 6 174 161.50 12.50 1.0235 0.95 7.7399 › Holiday Gift Cards / AU 109 109 4 625 33.79 591.21 5.7339 0.31 1749.6597 › Spring Collection / US 420 420 14 1808 176.40 1631.60 4.3048 0.42 924.9433 › Standing Desk Launch / UK 230 230 0 0 195.50 -195.50 0 0.85 -100 Total 2900 2900 120 15349 2032.87 13316.13 5.2928 0.701 655.0409
$ p202 report groups --by ppc_network,campaign --period last30 --json { "available_breakdowns": [ "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" ], "by": [ "ppc_network", "campaign" ], "data": [ { "avg_cpc": 0.3777292576419214, "breakdown": "ppc_network", "children": [ { "avg_cpc": 0, "breakdown": "campaign", "conv_rate": 18.181818181818183, "cpa": 0, "epc": 10.670454545454545, "id": 6, "name": "Bakery Pre-orders / Local", "roi": 0, "total_click_throughs": 88, "total_clicks": 88, "total_cost": 0, "total_income": 939, "total_leads": 16, "total_net": 939 }, { "avg_cpc": 0.55, "breakdown": "campaign", "conv_rate": 1.4285714285714286, "cpa": 38.5, "epc": 0.45714285714285713, "id": 2, "name": "Coffee Subscription / US", "roi": -16.883116883116884, "total_click_throughs": 140, "total_clicks": 140, "total_cost": 77, "total_income": 64, "total_leads": 2, "total_net": -13 }, { "avg_cpc": 0.6857142857142857, "breakdown": "campaign", "conv_rate": 3.571428571428571, "cpa": 19.2, "epc": 14.142857142857142, "id": 4, "name": "Project Tool Pro Annual / US", "roi": 1962.5, "total_click_throughs": 140, "total_clicks": 140, "total_cost": 96, "total_income": 1980, "total_leads": 5, "total_net": 1884 }, { "avg_cpc": 0, "breakdown": "campaign", "conv_rate": 4.444444444444445, "cpa": 0, "epc": 6.688888888888889, "id": 1, "name": "Spring Collection / US", "roi": 0, "total_click_throughs": 90, "total_clicks": 90, "total_cost": 0, "total_income": 602, "total_leads": 4, "total_net": 602 } ], "conv_rate": 5.895196506550218, "cpa": 6.407407407407407, "epc": 7.827510917030568, "id": 3, "name": "Owned Media", "roi": 1972.2543352601158, "total_click_throughs": 458, "total_clicks": 458, "total_cost": 173, "total_income": 3585, "total_leads": 27, "total_net": 3412 }, { "avg_cpc": 1.0231929233361414, "breakdown": "ppc_network", "children": [ { "avg_cpc": 0.38, "breakdown": "campaign", "conv_rate": 6.140350877192982, "cpa": 6.188571428571429, "epc": 2.5350877192982457, "id": 2, "name": "Coffee Subscription / US", "roi": 567.1283471837489, "total_click_throughs": 228, "total_clicks": 228, "total_cost": 86.64, "total_income": 578, "total_leads": 14, "total_net": 491.36 }, { "avg_cpc": 1.8, "breakdown": "campaign", "conv_rate": 7.03125, "cpa": 25.6, "epc": 2.0390625, "id": 5, "name": "Free Trial to Paid / CA", "roi": 13.281249999999996, "total_click_throughs": 128, "total_clicks": 128, "total_cost": 230.4, "total_income": 261, "total_leads": 9, "total_net": 30.6 }, { "avg_cpc": 0.48, "breakdown": "campaign", "conv_rate": 5.056179775280898, "cpa": 9.493333333333332, "epc": 5.758426966292135, "id": 7, "name": "Holiday Gift Cards / AU", "roi": 1099.6722846441949, "total_click_throughs": 178, "total_clicks": 178, "total_cost": 85.44, "total_income": 1025, "total_leads": 9, "total_net": 939.56 }, { "avg_cpc": 2.4, "breakdown": "campaign", "conv_rate": 4.761904761904762, "cpa": 50.4, "epc": 19.428571428571427, "id": 4, "name": "Project Tool Pro Annual / US", "roi": 709.5238095238096, "total_click_throughs": 168, "total_clicks": 168, "total_cost": 403.2, "total_income": 3264, "total_leads": 8, "total_net": 2860.8 }, { "avg_cpc": 0.65, "breakdown": "campaign", "conv_rate": 2.527075812274368, "cpa": 25.72142857142857, "epc": 4.050541516245487, "id": 1, "name": "Spring Collection / US", "roi": 523.1602332685366, "total_click_throughs": 277, "total_clicks": 277, "total_cost": 180.05, "total_income": 1122, "total_leads": 7, "total_net": 941.95 }, { "avg_cpc": 1.1, "breakdown": "campaign", "conv_rate": 2.403846153846154, "cpa": 45.760000000000005, "epc": 9.16826923076923, "id": 3, "name": "Standing Desk Launch / UK", "roi": 733.479020979021, "total_click_throughs": 208, "total_clicks": 208, "total_cost": 228.8, "total_income": 1907, "total_leads": 5, "total_net": 1678.2 } ], "conv_rate": 4.380791912384161, "cpa": 23.356346153846154, "epc": 6.871946082561078, "id": 1, "name": "Search", "roi": 571.6178274723557, "total_click_throughs": 1187, "total_clicks": 1187, "total_cost": 1214.53, "total_income": 8157, "total_leads": 52, "total_net": 6942.47 }, { "avg_cpc": 0.5142151394422311, "breakdown": "ppc_network", "children": [ { "avg_cpc": 0.18, "breakdown": "campaign", "conv_rate": 4.697986577181208, "cpa": 3.8314285714285714, "epc": 4.389261744966443, "id": 6, "name": "Bakery Pre-orders / Local", "roi": 2338.478747203579, "total_click_throughs": 149, "total_clicks": 149, "total_cost": 26.82, "total_income": 654, "total_leads": 7, "total_net": 627.18 }, { "avg_cpc": 0.29, "breakdown": "campaign", "conv_rate": 5.649717514124294, "cpa": 5.133, "epc": 1.9548022598870056, "id": 2, "name": "Coffee Subscription / US", "roi": 574.0697447886226, "total_click_throughs": 177, "total_clicks": 177, "total_cost": 51.33, "total_income": 346, "total_leads": 10, "total_net": 294.67 }, { "avg_cpc": 0.95, "breakdown": "campaign", "conv_rate": 3.5294117647058822, "cpa": 26.916666666666668, "epc": 1.0235294117647058, "id": 5, "name": "Free Trial to Paid / CA", "roi": 7.739938080495357, "total_click_throughs": 170, "total_clicks": 170, "total_cost": 161.5, "total_income": 174, "total_leads": 6, "total_net": 12.5 }, { "avg_cpc": 0.31, "breakdown": "campaign", "conv_rate": 3.669724770642202, "cpa": 8.4475, "epc": 5.73394495412844, "id": 7, "name": "Holiday Gift Cards / AU", "roi": 1749.6596626220778, "total_click_throughs": 109, "total_clicks": 109, "total_cost": 33.79, "total_income": 625, "total_leads": 4, "total_net": 591.21 }, { "avg_cpc": 0.42000000000000004, "breakdown": "campaign", "conv_rate": 3.3333333333333335, "cpa": 12.6, "epc": 4.304761904761905, "id": 1, "name": "Spring Collection / US", "roi": 924.9433106575962, "total_click_throughs": 420, "total_clicks": 420, "total_cost": 176.4, "total_income": 1808, "total_leads": 14, "total_net": 1631.6 }, { "avg_cpc": 0.85, "breakdown": "campaign", "conv_rate": 0, "cpa": 0, "epc": 0, "id": 3, "name": "Standing Desk Launch / UK", "roi": -100, "total_click_throughs": 230, "total_clicks": 230, "total_cost": 195.5, "total_income": 0, "total_leads": 0, "total_net": -195.5 } ], "conv_rate": 3.266932270916335, "cpa": 15.74, "epc": 2.8741035856573705, "id": 2, "name": "Social", "roi": 458.93017634115347, "total_click_throughs": 1255, "total_clicks": 1255, "total_cost": 645.34, "total_income": 3607, "total_leads": 41, "total_net": 2961.66 } ], "totals": { "avg_cpc": 0.7009896551724137, "conv_rate": 4.137931034482759, "cpa": 16.940583333333333, "epc": 5.292758620689655, "roi": 655.0409027630888, "total_click_throughs": 2900, "total_clicks": 2900, "total_cost": 2032.87, "total_income": 15349, "total_leads": 120, "total_net": 13316.13 } }
Profit by ppc network,campaign
Drawn from the JSON output above.
03Build your command
Pick values and the command line writes itself, quoted and ready to paste.
p202 report groupsSet flags below; the command updates as you type.
04Flags
23 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) |
| --bystring | Up to 4 dimensions, outermost first (e.g. ppc_network,campaign,keyword): 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); comma-separated for severalcampaignaff_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 |
| --method-of-promotionstring | Only direct-link clicks or only landing-page clicks: directlink, landingpagedirectlinklandingpage |
| --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) |
| --showstring | Which clicks count (default all): all, real, filtered, filtered_bot, leads; real = not filtered, filtered_bot = filtered as bots, leads = convertedallrealfilteredfiltered_botleads |
| --sortstring | Order each group's rows by name (default) or a metric: name, 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)nametotal_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 |
| --sort-dirstring | ASC or DESC (default ASC by name, DESC by a metric): ASC, DESCASCDESC |
| --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
The Overview's Group Overview: traffic grouped by up to four dimensions, one inside
the other, every group with its clicks, leads, income, cost, net and ratios. A group
is the sum of its children: the clicks a level has no value for (no keyword, no
landing page) are its [no keyword] row. Takes every report filter and period.
--json answers the tree as the server serves it (each group's children); the table,
CSV and --ndjson give one row per group, marked by level (› per level), then a Total row.
p202 report groups --by ppc_network,campaign,keyword --period last7 p202 report groups --by campaign,device_type --show real --sort clicks --json
06For agents
Running this from an agent
- Read the same facts as JSON:
p202 commands report groups --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, 6 no Pro licence on the install.
{
"path": "p202 report groups",
"use": "groups",
"short": "Traffic grouped by up to four dimensions, nested, each group with its totals (Group Overview)",
"long": "The Overview's Group Overview: traffic grouped by up to four dimensions, one inside\nthe other, every group with its clicks, leads, income, cost, net and ratios. A group\nis the sum of its children: the clicks a level has no value for (no keyword, no\nlanding page) are its `[no keyword]` row. Takes every report filter and period.\n\n--json answers the tree as the server serves it (each group's `children`); the table,\nCSV and --ndjson give one row per group, marked by level (› per level), then a Total row.\n\n p202 report groups --by ppc_network,campaign,keyword --period last7\n p202 report groups --by campaign,device_type --show real --sort clicks --json",
"runnable": true,
"tasks": [
{
"run": "p202 report groups",
"ui_pages": [
"Overview › Group Overview"
],
"phrases": [
"nested report",
"group by several dimensions"
]
}
],
"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": "by",
"type": "string",
"default": "",
"usage": "Up to 4 dimensions, outermost first (e.g. ppc_network,campaign,keyword): 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); comma-separated for several",
"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"
},
"value_list": true,
"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": "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": "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": "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": "sort",
"type": "string",
"default": "",
"usage": "Order each group's rows by name (default) or a metric: name, 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": [
"name",
"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": "sort-dir",
"type": "string",
"default": "",
"usage": "ASC or DESC (default ASC by name, DESC by a metric): ASC, DESC",
"allowed_values": [
"ASC",
"DESC"
],
"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
}
]
}