Skip to content

Commit 977cfb0

Browse files
ryancurtis1claude
andauthored
Add AI-assisted installation documentation (#2180)
* Add AI-assisted installation documentation Adds comprehensive "Install with AI" guide to help users set up Mixpanel using AI coding assistants like Claude, ChatGPT, and Cursor. Includes quickstart callout section highlighting the new installation method. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * Update AI installation docs with beta label and styling improvements - Add [beta] label to page title and navigation - Switch to ExtendedButton component for better styling - Move install-with-ai to bottom of quickstart navigation - Add margin-top to callout section for better spacing - Update cspell dictionary with new terms 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * fix bug * add import * simplify formatting * fix typo * update copy --------- Co-authored-by: Ryan Curtis <[email protected]> Co-authored-by: Claude <[email protected]>
1 parent b2361d4 commit 977cfb0

File tree

4 files changed

+244
-1
lines changed

4 files changed

+244
-1
lines changed

cspell.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
"callout",
6868
"Cartfile",
6969
"CCPA",
70+
"chatbots",
7071
"checksumming",
7172
"chmln",
7273
"Clevertap",
@@ -223,6 +224,7 @@
223224
"screenflows",
224225
"searchbox",
225226
"serviceaccount",
227+
"sessionreplay",
226228
"SFMC",
227229
"shlex",
228230
"shopify",
@@ -313,4 +315,4 @@
313315
"addWords": true
314316
}
315317
]
316-
}
318+
}

pages/docs/quickstart.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Cards } from 'nextra/components'
2+
import ExtendedButton from "/components/ExtendedButton/ExtendedButton";
23

34
# Quickstart
45

@@ -7,3 +8,14 @@ import { Cards } from 'nextra/components'
78
<Cards.Card icon title="Identify Users" href="/docs/quickstart/identify-users" />
89
<Cards.Card icon title="Capture Events" href="/docs/quickstart/track-events" />
910
</Cards>
11+
12+
### [BETA] Set up Mixpanel at the speed of AI
13+
Install Mixpanel faster and easier than ever with the AI code editor integration. The Mixpanel Installation Wizard is an interactive CLI tool that generates customized, AI-optimized SDK installation instructions for developers integrating Mixpanel analytics. It creates step-by-step guides that can be directly fed to AI coding assistants like Cursor or Claude Code to automate the integration process.
14+
<div className="extendedButtonComponent" >
15+
<br/>
16+
<ExtendedButton
17+
title="Get Started with AI"
18+
link="/docs/quickstart/install-with-ai"
19+
></ExtendedButton>
20+
</div>
21+

pages/docs/quickstart/_meta.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export default {
22
"install-mixpanel": "Install Mixpanel",
33
"identify-users": "Identify Users",
44
"capture-events": "Capture Events",
5+
"install-with-ai": "Install with AI [BETA]",
56
"tips-and-tricks": {
67
"display": "hidden"
78
},
Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
# Install with AI [BETA]
2+
3+
This guide will help you add Mixpanel analytics to your app or website using AI assistance, even if you're not a developer. The Mixpanel Installation Wizard creates step-by-step instructions that you can give to AI coding tools like Claude, ChatGPT, or Cursor.
4+
5+
## What You'll Need
6+
7+
Before starting, make sure you have:
8+
9+
- A Mixpanel account with Admin or Owner access ([sign up](https://www.mixpanel.com/signup) if you don't have one)
10+
- Access to an AI coding assistant (Claude, ChatGPT, Cursor, etc.)
11+
- Be sure to use the most advanced AI model you have access to
12+
- Your project's code files and a development or staging environment to test the changes
13+
14+
## Step 1: Get Your Mixpanel Project Token
15+
16+
1. Log into your [Mixpanel account](https://www.mixpanel.com/login)
17+
2. Go to your [project settings](https://www.mixpanel.com/settings/project) (gear icon in the bottom left)
18+
3. Click on "Overview" in the left sidebar
19+
4. Scroll down to Access Keys section and copy your "Project Token" - it looks like a long string of letters and numbers
20+
21+
(You will need to be an Admin or Owner in your project)
22+
23+
5. Keep this handy - you'll need it in the next step
24+
25+
## Step 2: Create Your AI Instructions
26+
27+
1. Simply paste this command in your terminal:
28+
```
29+
npx @mixpanel/mixpanel-wizard
30+
```
31+
2. Go through and answer a few quick questions and it will then create a customized installation guide
32+
33+
### Choose Your Settings
34+
35+
You'll need to pick three things:
36+
37+
**A. Choose Your SDK Type**
38+
39+
This depends on what type of app or website you're building:
40+
41+
- **`javascript`**
42+
- **`react-native`**
43+
- **`ios-swift`**
44+
- **`ios-objective-c`**
45+
- **`android`**
46+
- **`python`**
47+
- **`nodejs`**
48+
- **`flutter`**
49+
- **`unity`**
50+
- **`go`**
51+
- **`ruby`**
52+
- **`php`**
53+
- **`java`**
54+
55+
*Don't see your platform? Check with a developer or choose the closest match.*
56+
57+
**B. Choose Your Event Type**
58+
59+
This determines what kinds of user actions you'll track:
60+
61+
- **`ai`** - Best for AI-powered features (chatbots, AI tools, ML features)
62+
- **`ecommerce`** - Best for online stores and shopping apps
63+
- **`default`** - Good general-purpose events for most other apps
64+
65+
**C. Decide on Extra Features**
66+
67+
- **Autocapture** - Automatically tracks clicks and page views (JavaScript SDK only)
68+
- **Session Replay** - Records user sessions for debugging (JavaScript, iOS Swift, Android SDKs only)
69+
70+
*Recommendation: Enable both if they're available for your platform*
71+
72+
## Step 3: Give Instructions to Your AI Assistant
73+
74+
1. Open your AI coding tool (Claude, ChatGPT, Cursor, etc.).
75+
2. Copy over the instruction file generated from the step2 to your project.
76+
3. Make sure it has access to your project files
77+
4. Next, copy and paste this prompt into your AI Agent
78+
79+
```
80+
Let's set up Mixpanel.
81+
1. Set up mixpanel by following the steps in MIXPANEL_INSTALLATION_INSTRUCTIONS.txt. Make sure to follow the global rules specified in the MIXPANEL_INSTALLATION_INSTRUCTIONS.txt.
82+
2. After completing the steps in the installation guide, delete the MIXPANEL_INSTALLATION_INSTRUCTIONS.txt
83+
```
84+
85+
4. Let the AI complete all the steps
86+
87+
The AI will:
88+
89+
- Follow the generated setup instructions
90+
- Install the necessary code
91+
- Set up tracking for your chosen events
92+
93+
## Step 4: Test Your Installation
94+
95+
After the AI completes the setup, test that everything is working:
96+
97+
### Quick Test
98+
99+
1. Deploy the changes to your testing environment
100+
2. Use your app or website normally
101+
3. Go to your Mixpanel dashboard
102+
4. Click on "Events" in the left sidebar or visit the [Events page](https://mixpanel.com/report/events)
103+
5. You should see events flowing in as you use your app (you may need to refresh Mixpanel)
104+
105+
### What to Look For
106+
107+
Depending on your event type, you should see:
108+
109+
**For AI events:**
110+
111+
- "Launch AI" when AI features are used
112+
- "AI Prompt Sent" when users send prompts
113+
- "AI Response Sent" when AI responds
114+
115+
**For E-commerce events:**
116+
117+
- "Product Viewed" when products are viewed
118+
- "Add to Cart" when items are added to cart
119+
- "Purchase" when transactions complete
120+
121+
**For Default events:**
122+
123+
- "Sign Up" for new user registrations
124+
- "Page View" for page visits
125+
- "Search" for search queries
126+
127+
## Troubleshooting
128+
129+
### No Events Showing Up?
130+
131+
1. Check that you used the correct project token
132+
2. Verify your app is running and being used
133+
3. Wait a few minutes - sometimes there's a delay
134+
4. Check the browser console (F12) for any error messages
135+
136+
### Wrong Events Tracking?
137+
138+
1. Make sure you chose the right event type in Step 2B
139+
2. Ask your AI assistant to show you what events are being tracked
140+
3. You can always re-run the setup with different event types
141+
142+
### Need Help?
143+
144+
1. Check the Mixpanel documentation at [docs.mixpanel.com](https://docs.mixpanel.com/)
145+
2. Ask your AI assistant to explain what it installed
146+
3. Contact [Mixpanel support](https://mixpanel.com/contact-us/support/) through our help center
147+
148+
### Success! 🎉
149+
150+
Once you see events flowing into your Mixpanel dashboard, you're all set! You can now:
151+
152+
- View real-time user activity
153+
- Create reports and dashboards
154+
- Set up alerts for important events
155+
- Analyze user behavior patterns
156+
157+
The AI has set up all the technical details for you - now you can focus on understanding your users and growing your product.
158+
159+
## Command Line Mode
160+
161+
Skip the interactive prompts by providing options directly:
162+
163+
```bash
164+
# Basic usage
165+
mixpanel-wizard --token YOUR_TOKEN --sdk javascript --events ai
166+
167+
# With additional options
168+
mixpanel-wizard --token YOUR_TOKEN --sdk javascript --autocapture --sessionreplay --events ecommerce
169+
170+
# With approval for each code change
171+
mixpanel-wizard --token YOUR_TOKEN --sdk javascript --confirm-each --events ai
172+
173+
# iOS with specific package manager
174+
mixpanel-wizard --token YOUR_TOKEN --sdk ios-swift --events default
175+
```
176+
177+
### Available Options
178+
179+
| Option | Description | Values |
180+
| ----------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
181+
| `-t, --token` | Your Mixpanel project token | String |
182+
| `--sdk` | SDK type to install | `javascript`, `flutter`, `ios-objective-c`, `ios-swift`, `android`, `react-native`, `go`, `python`, `ruby`, `php`, `nodejs`,`java`, `unity` |
183+
| `--events` | Additional event type options | `ai`, `ecommerce`, `default` |
184+
| `--autocapture` | Enable autocapture (JavaScript only) | Boolean flag |
185+
| `--sessionreplay` | Enable session replay (Javascript, iOS Swift and Android Only) | Boolean flag |
186+
| `--confirm-each` | Require approval for each code change made by AI | Boolean flag |
187+
188+
### Output
189+
190+
The wizard generates a `MIXPANEL_INSTALLATION_INSTRUCTIONS.txt` file containing:
191+
192+
1. **Step 1: SDK Installation** - Platform-specific installation commands and configuration
193+
2. **Step 2: User Identification** - Code snippets for identifying users
194+
3. **Step 3: Event Tracking** - Implementation examples and event templates
195+
4. **Best Practices** - Security guidelines and recommendations
196+
197+
Simply provide the prompt from MIXPANEL_INSTALLATION_INSTRUCTIONS.txt to your AI coding agent.
198+
199+
## Event Templates
200+
201+
### Default Events
202+
203+
- **Sign Up**: Track new user acquisition with signup method and UTM parameters
204+
- **Sign In**: Monitor user login events with authentication method tracking
205+
- **Page View**: Track page/screen views with URL and title information
206+
- **Search**: Capture search queries and result counts
207+
- **Error**: Monitor application errors with error types and messages
208+
- **Purchase**: Track completed transactions with revenue and currency data
209+
- **Conversion**: Monitor key value moments specific to your product type
210+
211+
### AI Events
212+
213+
- **Launch AI**: Track AI feature engagement and measure adoption patterns
214+
- **AI Prompt Sent and Prompt Text**: Capture user prompts and analyze engagement intent
215+
- **AI Response Sent**: Monitor AI outputs with cost, token usage, and response time metrics
216+
- **API Error**: Track AI feature errors and monitor failure rates
217+
- **User Feedback**: Collect user sentiment and feedback on AI interactions
218+
- **AI Dismissed**: Monitor AI feature disengagement points
219+
- **Conversion Event**: Measure how AI features influence key business outcomes
220+
221+
### E-commerce Events
222+
223+
- **Purchase**: Track completed transactions with cart contents and total price
224+
- **Add to Cart**: Monitor shopping behavior with cart items and product categories
225+
- **Product Viewed**: Track product engagement across the purchasing funnel
226+
- **Ad Data**: Monitor advertising spend and cost data for ROI calculations
227+
228+
**⚠️ Important**: This tool generates AI-optimized installation instructions. Always review and test the generated code before deploying to production. Human oversight is strongly recommended for all integrations.

0 commit comments

Comments
 (0)