p202 event send

Send an event (or a file of events) for a click

Writessupports --staged
All commands

01Run it

Straight from the command's own help.

p202 event send --click-id 123 --name purchase --id ORD-1 --revenue 49 --props '{"plan":"pro"}'
p202 event send --click-id 123 --file events.json # a JSON list of events, or {"events": […]}

02What you get

Pick the shape you need. People get a table. Add --json, --csv or --ndjson for scripts, or -q for ids only. An AI agent gets compact JSON without asking. All output formats

03Build your command

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

p202 event send

Set flags below; the command updates as you type.

04Flags

9 flags, plus the global flags every command takes.

FlagWhat it does
--click-idstringThe click the events belong to (p202 click list)
--file, -FstringSend the events in a JSON file (- for stdin) instead of one from the flags
--idstringYour id for the event: resending it is recorded once
--idempotency-keystringRetry-safe create: the server records the response under this key and replays it on a retry with the same key and payload instead of creating a duplicate
--namestringThe event name, e.g. purchase
--occurred-atstringWhen it happened, unix seconds (default: now, by the server's clock)
--propsstringProperties as a JSON object, e.g. '{"plan":"pro"}'
--revenuestringWhat it was worth (paid by a goal valued from the event's amount)
--transaction-idstringThe network's id for it, kept on the conversion

05How it works

Stores the event on the click and evaluates the click's campaign goals, in one transaction: a goal it reaches records a conversion (and tells the traffic source when the campaign pays for it and notifies). --id is your id for the event: sending the same id again is answered as a duplicate and records nothing, so a retry is always safe.

p202 event send --click-id 123 --name purchase --id ORD-1 --revenue 49 --props '{"plan":"pro"}'
p202 event send --click-id 123 --file events.json   # a JSON list of events, or {"events": […]}

06For agents

Running this from an agent

  • Read the same facts as JSON: p202 commands event send --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.
  • This command writes. Add --staged to record it as a proposal a person applies with p202 change apply.
p202 commands event send --json
{
  "path": "p202 event send",
  "use": "send",
  "short": "Send an event (or a file of events) for a click",
  "long": "Stores the event on the click and evaluates the click's campaign goals, in one\ntransaction: a goal it reaches records a conversion (and tells the traffic source when\nthe campaign pays for it and notifies). --id is your id for the event: sending the same\nid again is answered as a duplicate and records nothing, so a retry is always safe.\n\n  p202 event send --click-id 123 --name purchase --id ORD-1 --revenue 49 --props '{\"plan\":\"pro\"}'\n  p202 event send --click-id 123 --file events.json   # a JSON list of events, or {\"events\": […]}",
  "runnable": true,
  "flags": [
    {
      "name": "click-id",
      "type": "string",
      "default": "",
      "usage": "The click the events belong to (`p202 click list`)",
      "required": false
    },
    {
      "name": "file",
      "shorthand": "F",
      "type": "string",
      "default": "",
      "usage": "Send the events in a JSON file (- for stdin) instead of one from the flags",
      "required": false
    },
    {
      "name": "id",
      "type": "string",
      "default": "",
      "usage": "Your id for the event: resending it is recorded once",
      "required": false
    },
    {
      "name": "idempotency-key",
      "type": "string",
      "default": "",
      "usage": "Retry-safe create: the server records the response under this key and replays it on a retry with the same key and payload instead of creating a duplicate",
      "required": false
    },
    {
      "name": "name",
      "type": "string",
      "default": "",
      "usage": "The event name, e.g. purchase",
      "required": false
    },
    {
      "name": "occurred-at",
      "type": "string",
      "default": "",
      "usage": "When it happened, unix seconds (default: now, by the server's clock)",
      "required": false
    },
    {
      "name": "props",
      "type": "string",
      "default": "",
      "usage": "Properties as a JSON object, e.g. '{\"plan\":\"pro\"}'",
      "required": false
    },
    {
      "name": "revenue",
      "type": "string",
      "default": "",
      "usage": "What it was worth (paid by a goal valued from the event's amount)",
      "required": false
    },
    {
      "name": "transaction-id",
      "type": "string",
      "default": "",
      "usage": "The network's id for it, kept on the conversion",
      "required": false
    }
  ]
}