Mixpanel Integration

Send live events to Product Analyst AI alongside your existing Mixpanel tracking

Overview

Mixpanel does not offer per-event webhooks — their webhook feature syncs cohort membership (user lists every 30 minutes), not individual events.

Instead, you send events to Product Analyst AI directly from your app. There are two options depending on your setup:

Add the Product Analyst AI SDK alongside Mixpanel — it autocaptures pageviews and clicks, plus you can send custom events with pai.track().

Setup

The Product Analyst AI SDK is a lightweight script (~1.5KB gzipped) that runs alongside Mixpanel with no conflicts. It autocaptures pageviews and clicks, so you get event data without manual instrumentation.

Step 1 — Get your API key

Your API key is available in Settings → Company. It starts with pai_.

Step 2 — Add the script

Add this to your <head>, alongside your existing Mixpanel snippet:

<!-- Product Analyst AI SDK -->
<script src="https://productanalyst.ai/sdk.js" data-api-key="pai_YOUR_API_KEY"></script>

Step 3 — Identify the user

After your user logs in, call pai.identify() with the same user ID you use for Mixpanel. The SDK is inert until this is called — no events are sent for anonymous visitors.

// After login — use the same user ID as Mixpanel
pai.identify(currentUserId, { plan: 'pro', role: 'admin' })

Once identified, the SDK automatically captures pageviews and clicks. On logout, call pai.reset().

Step 4 — Send custom events (optional)

For events that autocapture can't see (e.g., backend actions, multi-step flows), use pai.track() alongside your Mixpanel call:

// Track in Mixpanel
mixpanel.track('upgrade_clicked', { plan: 'pro' });

// Track in Product Analyst AI
pai.track('upgrade_clicked', { plan: 'pro' });

Step 5 — Verify

Navigate around your app after calling identify(), then ask the agent: "Show me the last events you received." You should see pageviews and clicks within a few seconds.

Deduplication

Duplicate events are silently ignored — it's safe to send the same event multiple times.

SDK reference

For the full API surface, payload format, and advanced configuration, see the SDK documentation.

Why not Mixpanel's cohort webhook?

Mixpanel's cohort sync webhook pushes user lists (add/remove members), not individual events. It syncs every 30 minutes, requires a paid Mixpanel plan, and is designed for audience targeting — not real-time event streaming.

Mixpanel Integration - Product Analyst AI