From mixpanel-mcp-eu
Guides a coding agent through implementing Mixpanel analytics: Quick Start, Full Implementation, Add Tracking, or Audit. Collects requirements before writing code.
How this skill is triggered — by the user, by Claude, or both
Slash command
/mixpanel-mcp-eu:tracking-implementationThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
For any reference to `agents.md.template`, use this resource: [agents.md.template](assets/agents.md.template).
For any reference to agents.md.template, use this resource: agents.md.template.
For any reference to reference.md, use this resource: reference.md.
CRITICAL -- DO NOT WRITE ANY CODE YET
This skill is a guided conversation, not a build template. You MUST collect answers from the user before generating any implementation code. Writing Mixpanel code without the inputs below will produce a broken implementation -- wrong SDK, wrong events, missing consent gates, or duplicate data pipelines.
Before writing ANY code, you must know ALL of the following:
track_pageview: true or write manual page view events (duplicates)If you do not have explicit answers to items 2--5, ASK. Do not assume. Do not infer from the project name. Do not start building.
The sections below tell you what to ask, in what order, and what to do with the answers. Follow the conversation flow -- it exists because wrong assumptions here create irreversible rework.
Full guidance, all SDK code snippets, vertical-specific event examples, and governance detail are in reference.md. Read specific sections on demand as you work through each mode.
Before doing anything else, ask the customer which mode fits their goal:
"What brings you here today?"
- Quick Start -- Get your first events into Mixpanel in one session
- Full Implementation -- Build a complete, production-ready analytics setup from scratch
- Add Tracking -- Extend an existing Mixpanel implementation with new events
- Audit -- Review and diagnose an existing implementation
State the selected mode explicitly and offer to switch at any point.
| Mode | What it covers | Detail section |
|---|---|---|
| Quick Start | 7-step compressed flow: mandatory questions -> context -> mini tracking plan -> project setup -> implementation + identity -> Live View verification -> wrap-up | Quick Start Flow (below) |
| Full Implementation | All 8 phases (0--7) in order: Discovery -> Analytics Strategy -> Project Setup -> Data Model -> Tracking Plan -> Implementation -> Identity Management -> Data Governance | Full Greenfield Rollout (below) |
| Add Tracking | Starts with "what do you want to track?" -> checks existing schema -> designs new events -> implements and verifies | Add Tracking Mode (below) |
| Audit | Diagnoses current state -> produces prioritized fixes -> executes fixes via Add Tracking or Full Implementation | Implementation Audit Mode (below) |
This skill is implementation guidance, not legal advice. Use customer policy and counsel as source of truth when there is conflict.
| Scenario | Default behavior |
|---|---|
| Region includes EU/EEA/UK/CH or CA users | Treat consent as required before non-essential tracking; apply consent gate pattern before SDK initialization |
| Region is unknown | Ask once; if still unknown, use conservative consent-gated behavior until clarified |
| Server-side geolocation enrichment | Only forward IP when customer policy permits; if restricted, omit IP and document reduced geo resolution |
| Identity/profile enrichment | Track minimum required attributes only; avoid sensitive categories unless explicitly approved in policy |
Fail-safe: if consent status is unknown in a regulated context, delay tracking initialization and collect clarification first.
Run this before any mode if you have access to the codebase. Do not ask the customer anything yet.
Read the codebase silently and build a working picture to carry into all downstream work. This replaces most discovery questions and produces a grounded draft tracking plan before the first conversation turn.
| What to read | What to extract |
|---|---|
| Route/page files, controllers, API endpoints | Candidate events -- every meaningful user-initiated action (POST /projects, PUT /subscriptions/upgrade, checkout handler, etc.) |
| Database models or schema files | Candidate properties and their types; User Profile fields; Group entity fields if B2B |
| Auth / session files (login, signup, logout handlers) | Where to place .identify(), .people.set(), and .reset(); whether anonymous browsing exists |
Existing analytics, logging, or third-party tracking calls (GA4, Amplitude, Segment, console.log) | First-draft event names; naming inconsistencies to fix; properties already being collected |
Package files (package.json, requirements.txt, build.gradle, Package.swift, pubspec.yaml) | Exact tech stack and framework -> SDK selection; confirms platform |
Environment config files (.env, config/, settings.py) | Where tokens should be injected; whether a dev/prod split already exists |
After scanning, carry forward:
Present assumptions to the customer rather than asking from scratch. Only ask what the codebase cannot answer.
7-step compressed flow: mandatory questions -> context -> mini tracking plan -> project setup -> implementation + identity -> Live View verification -> wrap-up. Success = two events live in Mixpanel with basic identity wired in.
Read quick-start.md for the complete Quick Start flow.
All 8 phases in order: Discovery -> Analytics Strategy -> Project Setup -> Data Model -> Tracking Plan -> Implementation -> Identity Management -> Data Governance. Each phase gates the next. Includes Context Block schema, Developer Handoff Spec generation for no-codebase-access scenarios, and full close/wrap-up.
Read full-implementation.md for all phases.
Use when the customer has an existing Mixpanel implementation and wants to extend it with new events.
Start with: "What do you want to track? What question are you trying to answer?"
Then:
Check existing schema -- Before designing any new events, review what's already in the project. Check Lexicon or query existing events to understand current naming conventions, existing properties, and enum values. See reference.md Section Phase 4 -- Adding Events to an Existing Project.
Design new events -- Follow the same naming and spec conventions as Phase 4. Reuse existing property names where the same concept applies. Match established naming patterns.
Spec review -- Present the spec (event name, trigger, properties, types) for the customer's review before writing code.
Implement -- Write tracking calls using the same SDK and patterns already present in the codebase. If Pre-Flight was run, place code in the exact handler/endpoint files.
Verify -- Confirm events in Live View with correct properties and identity linkage.
Document -- Add Lexicon descriptions for all new events and properties. Update AGENTS.md in the project root with the new Mixpanel events (add rows to the tracking plan table).
Mode switching: If the existing implementation has fundamental issues (identity bugs, naming chaos, missing consent gates), recommend switching to Audit mode first, then returning to Add Tracking.
Use when the customer has an existing Mixpanel setup and wants to assess its quality or diagnose issues.
Diagnose current state:
identify() and reset() placed correctly?Produce prioritized fixes:
Rank issues by severity:
Execute fixes via Add Tracking mode (for individual events) or Full Implementation mode (for structural overhaul).
These checklists apply to Full Implementation mode. Quick Start uses Live View verification as its primary gate.
Phase 0 exit
Phase 1 exit
Phase 2 exit
Phase 3 exit
Phase 4 exit
sign_up_completed and Value Moment event fully specified (trigger + properties).snake_case, stable values).Phase 5 exit
handoff_mode: true marked in Context Block.Phase 6 exit
autocapture: true set in init; track_pageview omitted; no manual page view track() calls written.record_sessions_percent set; at least one session observed in Mixpanel Session Replay in dev.Phase 7 exit
identify, reset, and profile/super-property ordering validated.Phase 8 exit
Concrete over generic. Use the customer's product name, Value Moment name, and their two events (sign_up_completed and the Value Moment event) in summaries and next steps. In code and specs, use event and property names from their signed-off tracking plan -- no placeholders once those names are defined. Refer to specific files or flows identified in Pre-Flight when giving implementation guidance.
Cite docs when recommending a capability. When you suggest a Mixpanel feature (Lexicon, super properties, Data Standards, Event Approval, consent pattern, warehouse connector, etc.), point to the specific Mixpanel doc or the relevant section in reference.md so the customer can act on it. New customers don't know the product; a link or section reference makes the recommendation actionable.
Before stating hard limits, plan entitlements, or irreversible settings, verify against current Mixpanel docs and the customer's account plan.
Quick verification checklist:
Get these wrong and the data is permanently corrupted or very expensive to fix. These rules apply to ALL modes.
Project setup:
Identity management:
.identify(user.id) on EVERY login AND every app re-open while the user is already logged in.reset() on logout -- failing to do so merges the next user's session with the previous user$user_id -- emails change; use your database primary key.identify() before creating the user in your database.people.set() before .identify() -- profiles set before identify may not merge correctlysign_up_completed event AFTER .identify(), not before$user_id values -- not supported in Simplified API; use one stable ID from the startData model:
$ or mp_ prefixes on custom event or property namesnull or ""checkout_completed != Checkout_Completed -- enforce snake_case from day oneautocapture: true is set in the JS SDK init, do NOT also set track_pageview: true and do NOT write manual track('page_viewed', ...) calls; autocapture already fires page view events and combining them produces duplicatesdistinct_id/identity or you will get identity graph issuesCompliance and privacy:
Governance:
All detailed guidance is in reference.md, organized by phase heading.
Key sections:
Searches MemPalace before answering questions about past work, people, projects, or prior decisions. Returns verbatim stored content instead of guessing from model memory.
Guides Payload CMS config (payload.config.ts), collections, fields, hooks, access control, APIs. Debugs validation errors, security, relationships, queries, transactions, hook behavior.
Implements vector databases with Pinecone, Weaviate, Qdrant, Milvus, pgvector for semantic search, RAG, recommendations, and similarity systems. Optimizes embeddings, indexing, and hybrid search.
npx claudepluginhub mixpanel/ai-plugins --plugin mixpanel-mcp-eu