peepshow/ sinks/ event-track

Reel #34 Product analytics

peepshow sink / event-track

Event TrackOne sink for Mixpanel, Amplitude, and Segment.

Provider selected by `EVENT_TRACK_PROVIDER`; same properties, three wire formats.

What it does

Fire a single product-analytics `track` event per run to whichever provider you're using. One sink binary, three wire formats — Mixpanel (form-encoded), Amplitude (JSON), Segment (JSON with Basic auth). Same properties (`strategy`, `frames`, `codec`, `duration_s`, tags) across providers.

When to reach for it

  • Plug peepshow into an existing Mixpanel / Amplitude / Segment pipeline without standing up PostHog
  • Switch analytics providers by changing one env var — no code changes
  • EU DC / staging: override `EVENT_TRACK_ENDPOINT`

Install

npm i -g peepshow

Use it

EVENT_TRACK_PROVIDER=mixpanel \
EVENT_TRACK_TOKEN=<project-token> \
EVENT_TRACK_USER_ID=peepshow-cli \
peepshow ./clip.mp4 --sink event-track

Make it automatic

Register the sink once — every run fires it afterward. Scope by --when so it only runs for matching videos.

peepshow sinks add event-track
peepshow sinks add event-track --when extension=mp4,mov
peepshow sinks add event-track --when path=/Volumes/Work/

Configuration

  • EVENT_TRACK_PROVIDER `mixpanel` | `amplitude` | `segment`. required
  • EVENT_TRACK_TOKEN Mixpanel project token / Amplitude API key / Segment write key. required
  • EVENT_TRACK_USER_ID `distinct_id` / `user_id` / `userId` attached to the event. required
  • EVENT_TRACK_EVENT_NAME Event name. Default `peepshow_run`.
  • EVENT_TRACK_ENDPOINT Override the API URL (EU DC, staging, mock).

Use with an LLM agent

Every peepshow sink reads its config from env vars and receives a single JSON payload on stdin. An LLM agent (Claude Code, Cursor, Windsurf, Gemini, Codex) can drive the Event Track sink automatically when three things are true:

  • the env vars below are exported in the agent's shell (or a project .env it can load),
  • the peepshow CLI is on PATH — install with npm i -g peepshow,
  • a peepshow auto-sink is registered for the run (optional but recommended — makes invocation zero-argument).

1. Set the environment

# Add to ~/.zshrc, ~/.bashrc, or a project .env the agent can load
export EVENT_TRACK_PROVIDER="..."
export EVENT_TRACK_TOKEN="..."
export EVENT_TRACK_USER_ID="..."

2. Register as an auto-sink

peepshow sinks add event-track
peepshow sinks add event-track --when extension=mp4,mov

3. Example LLM session

You → drop a .mov into Claude Code.

Claude → auto-invokes /peepshow:slides ./clip.mov. peepshow extracts frames + audio, the Event Track sink forwards the run to the analytics stream as a tagged event. Claude replies with a summary and a link to the created record.

Transcript metadata (language, duration, silence ratio) tags each event.

Write your own

A sink is any executable that reads the --emit json payload on stdin. Shell, Node, Python, Go — the spec's in docs/PLUGINS.md. Register persistent ones with peepshow sinks add-cmd 'your-command'.