rmnr
DocsTourSlicesBest PracticeAgentsInstall

Command Palette

Search for a command to run...

New

Slice · AI prompt

Event Tracking — P0 Instrumentation

Client SDK + Convex ingestion endpoint for structured product events. Auto-captures page_view/signup/login + UTM/referrer/first-touch attribution. Batched flush via requestIdleCallback. Targets <100ms p99 ingestion.

Resource detail View source
Copy this prompt into Claude / Codex / Cursor
event-tracking.prompt.mdmarkdown
# Install `event-tracking` — Event Tracking — P0 Instrumentation

> Client SDK + Convex ingestion endpoint for structured product events.

📚 Knowledge base : https://resource.rahmanef.com/llms.txt
📦 Slice detail   : https://resource.rahmanef.com/slices/event-tracking
🧠 JSON catalog   : https://resource.rahmanef.com/api/knowledge?slice=event-tracking
🔗 Source         : https://github.com/rahmanef63/resource-site/tree/main/template-base/frontend/slices/admin-panel/slices/events

## 1. Install

```bash
npx rahman-resources add event-tracking
# alias: npx rr add event-tracking
```

The CLI copies `template-base/frontend/slices/admin-panel/slices/events/` into your project + augments `.env.example` + installs npm deps automatically. Run it from your project root.

## 2. What it ships

- peer slices (cascade install):
  - `admin-panel` — Lives under admin slice events subfolder.
- convex feature paths: `template-base/convex/features/admin-panel`, `template-base/convex/features/analytics`

## 3. Wire it up

Run `npx rr add event-tracking`. Writes to analyticsEvents table (no new schema). Anonymous page_view allowed pre-signup; other events require workspaceId. Session id per tab (sessionStorage), first-touch UTM in localStorage. Flush every ~500ms via requestIdleCallback. Cap retry queue at 500.

## Rules of engagement

- shadcn-only UI primitives. No raw `<button>` / `<dialog>` / native date or file inputs.
- 200-line hard cap per source file (extract neighbours when over).
- All Convex queries hit an index (`.withIndex(...)`); never bare `.collect()`.
- Public mutations/queries declare `args:` validators + authz.
- Full ruleset: https://resource.rahmanef.com/best-practice

The agent will fetch /llms.txt for the full ruleset and use /api/knowledge for the JSON catalog.