p202 report groups

Traffic grouped by up to four dimensions, nested, each group with its totals (Group Overview)

Web UIOverview › Group OverviewNew in 1.9.77
All commands

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 groups
Web UIOverview › Group Overview

02What 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
$ p202 report groups --by ppc_network,campaign --period last30
group                           Clicks  Clickthroughs  Conversions  Revenue  Cost     Profit    EPC      Avg CPC  ROI %
------------------------------  ------  -------------  -----------  -------  -------  --------  -------  -------  ---------
Owned Media                     458     458            21           4604     173      4431      10.0524  0.3777   2561.2717
› Bakery Pre-orders / Local     88      88             6            528      0        528       6        0        0
› Coffee Subscription / US      140     140            4            128      77       51        0.9143   0.55     66.2338
› Project Tool Pro Annual / US  140     140            7            3396     96       3300      24.2571  0.6857   3437.50
› Spring Collection / US        90      90             4            552      0        552       6.1333   0        0
Search                          1186    1186           56           7703     1214.15  6488.85   6.4949   1.0237   534.4356
› Coffee Subscription / US      227     227            16           564      86.26    477.74    2.4846   0.38     553.8372
› Free Trial to Paid / CA       128     128            11           319      230.40   88.60     2.4922   1.80     38.4549
› Holiday Gift Cards / AU       178     178            10           1300     85.44    1214.56   7.3034   0.48     1421.5356
› Project Tool Pro Annual / US  168     168            3            1044     403.20   640.80    6.2143   2.40     158.9286
› Spring Collection / US        277     277            10           1472     180.05   1291.95   5.3141   0.65     717.5507
› Standing Desk Launch / UK     208     208            6            3004     228.80   2775.20   14.4423  1.10     1212.9371
Social                          1257    1257           44           3530     645.83   2884.17   2.8083   0.5138   446.5835
› Bakery Pre-orders / Local     150     150            12           852      27       825       5.68     0.18     3055.5556
› Coffee Subscription / US      177     177            10           424      51.33    372.67    2.3955   0.29     726.0277
› Free Trial to Paid / CA       170     170            7            203      161.50   41.50     1.1941   0.95     25.6966
› Holiday Gift Cards / AU       110     110            3            150      34.10    115.90    1.3636   0.31     339.8827
› Spring Collection / US        420     420            10           1354     176.40   1177.60   3.2238   0.42     667.5737
› Standing Desk Launch / UK     230     230            2            547      195.50   351.50    2.3783   0.85     179.7954
Total                           2901    2901           121          15837    2032.98  13804.02  5.4592   0.7008   679.0042
Real output · p202 1.9.77 · demo dataexit 0

Profit by ppc network,campaign

  • Search$6,488.85
  • Owned Media$4,431.00
  • Social$2,884.17

Drawn from the JSON output above.

03Build your command

Pick values and the command line writes itself, quoted and ready to paste.

p202 report groups

Set flags below; the command updates as you type.

04Flags

23 flags, plus the global flags every command takes.

FlagWhat it does
--aff-campaign-idstringFilter by INTERNAL campaign id (from campaign list), not the public id in tracking URLs
--aff-network-idstringFilter by affiliate network ID
--browser-idstringFilter by browser ID (the id of a --breakdown browser row)
--bystringUp 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
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-idstringFilter by country ID
--device-typestringFilter by device type ID: 1 Desktop, 2 Mobile, 3 Tablet, 4 Bot (the ids of --breakdown device_type rows)
--ipstringOnly clicks from this one IP address, IPv4 or IPv6
--isp-idstringFilter by ISP/carrier ID (the id of a --breakdown isp row)
--keywordstringOnly clicks whose keyword contains this text (case-insensitive)
--landing-page-idstringFilter by landing page ID
--method-of-promotionstringOnly direct-link clicks or only landing-page clicks: directlink, landingpage
directlinklandingpage
--period, -pstringPeriod: today, yesterday, last7, last14, last30, last90, thismonth, lastmonth, thisyear, lastyear, alltime
todayyesterdaylast7last14last30last90thismonthlastmonththisyearlastyearalltime
--platform-idstringFilter by platform (OS) ID (the id of a --breakdown platform row)
--ppc-account-idstringFilter by PPC account ID
--ppc-network-idstringFilter by PPC network ID, or none for the clicks with no traffic source
--refererstringOnly clicks whose referring URL contains this text (case-insensitive)
--region-idstringFilter by region ID (the id of a --breakdown region row)
--showstringWhich clicks count (default all): all, real, filtered, filtered_bot, leads; real = not filtered, filtered_bot = filtered as bots, leads = converted
allrealfilteredfiltered_botleads
--sortstringOrder 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-dirstringASC or DESC (default ASC by name, DESC by a metric): ASC, DESC
ASCDESC
--text-ad-idstringFilter by text ad ID
--time-fromstringStart: 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-tostringEnd, 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, CLAUDECODE or another agent variable set, output is compact JSON and errors arrive on stderr as a JSON envelope with a hint.
  • Exit codes: 0 ok, 1 bad input, 2 auth, 3 network, 4 server error, 5 partial failure.
p202 commands report groups --json
{
  "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
    }
  ]
}