Skip to content

Commit e630325

Browse files
authored
Add Langfuse integration to docs (#2202)
* add langfuse integration to docs * add langfuse to known words * add links to langfuse page
1 parent 14c3b7e commit e630325

File tree

5 files changed

+224
-0
lines changed

5 files changed

+224
-0
lines changed

cspell.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@
161161
"Kameleoon",
162162
"Kapa",
163163
"Kapture",
164+
"Langfuse",
165+
"langfuse",
164166
"Leanplum",
165167
"Lookback",
166168
"Mailchimp",

pages/docs/quickstart/install-mixpanel.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,11 @@ next step.**
493493
title="Google Sheets"
494494
href="/docs/tracking-methods/integrations/google-sheets"
495495
/>
496+
<Cards.Card
497+
icon
498+
title="Langfuse"
499+
href="/docs/tracking-methods/integrations/langfuse"
500+
/>
496501
<Cards.Card
497502
icon
498503
title="LaunchDarkly"

pages/docs/tracking-methods/integrations.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ you're looking for [reach out to us](https://mixpanel.com/get-support).
2424
<Cards.Card icon title="Google Cloud Storage" href="/docs/tracking-methods/integrations/google-cloud-storage" />
2525
<Cards.Card icon title="Google Pubsub" href="/docs/tracking-methods/integrations/google-pubsub" />
2626
<Cards.Card icon title="Google Sheets" href="/docs/tracking-methods/integrations/google-sheets" />
27+
<Cards.Card icon title="Langfuse" href="/docs/tracking-methods/integrations/langfuse" />
2728
<Cards.Card icon title="LaunchDarkly" href="/docs/tracking-methods/integrations/launchdarkly" />
2829
<Cards.Card icon title="mParticle" href="/docs/tracking-methods/integrations/mparticle" />
2930
<Cards.Card icon title="Next.js" href="/docs/tracking-methods/integrations/nextjs" />

pages/docs/tracking-methods/integrations/_meta.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export default {
1313
"google-pubsub": "Google Pubsub",
1414
"google-sheets": "Google Sheets",
1515
"google-tag-manager": "Google Tag Manager",
16+
"langfuse": "Langfuse",
1617
"launchdarkly": "LaunchDarkly",
1718
"mparticle": "mParticle",
1819
"nextjs": "Next.js",
Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
# Langfuse
2+
3+
[Langfuse](https://langfuse.com) is an open-source LLM engineering platform that provides observability and analytics for AI applications. This integration allows you to **automatically sync LLM metrics from Langfuse into your Mixpanel dashboards**, enabling you to understand how your AI features impact user behavior and business outcomes.
4+
5+
Use this integration to answer questions like:
6+
7+
- _"Are my most active users also the ones who are most engaged with my LLM content?"_
8+
- _"Does interacting with the LLM feature relate to higher retention rates?"_
9+
- _"How does the LLM feature impact my conversion rates?"_
10+
- _"Does the user feedback captured in Langfuse correlate with user behavior in Mixpanel?"_
11+
12+
## Setup
13+
14+
### Prerequisites
15+
16+
- An active Langfuse account with a project configured
17+
- Your Mixpanel Project Token (found in Project Settings)
18+
19+
### Configure the integration
20+
21+
1. Log into your Langfuse account and navigate to your project settings
22+
2. Find the Mixpanel integration section
23+
3. Select your Mixpanel region:
24+
- **US**: api.mixpanel.com
25+
- **EU**: api-eu.mixpanel.com
26+
- **India**: api-in.mixpanel.com
27+
4. Enter your Mixpanel Project Token
28+
5. Enable the integration
29+
30+
### Data synchronization
31+
32+
Once enabled, Langfuse will:
33+
34+
- Perform an initial sync of all historical data from your Langfuse project
35+
- Automatically sync new data every hour (with a 30-minute delay)
36+
37+
Your Mixpanel dashboards will stay up to date with your latest LLM metrics.
38+
39+
## Data Schema
40+
41+
### User Matching
42+
43+
Langfuse automatically maps user identifiers to ensure seamless data integration:
44+
45+
| Langfuse Field | Mixpanel Field | Description |
46+
| ------------------------------------- | -------------- | ------------------------------------------------------------------------------------------- |
47+
| `user_id` | `distinct_id` | Primary user identifier |
48+
| Trace/generation/score timestamp | `time` | Event timestamp (milliseconds since epoch) |
49+
| `trace.metadata.$mixpanel_session_id` | `session_id` | Optional session identifier (add this to your Langfuse trace metadata for session tracking) |
50+
51+
### Events
52+
53+
The integration sends three event types to Mixpanel:
54+
55+
#### `[Langfuse] Trace`
56+
57+
Represents a complete LLM interaction (e.g., a user conversation or workflow).
58+
59+
**Properties:**
60+
61+
- `time`: Milliseconds since epoch when the event occurred
62+
- `distinct_id`: User ID or anonymous identifier
63+
- `$user_id`: User ID sent to Mixpanel's native user ID field
64+
- `$insert_id`: Unique identifier for deduplication
65+
- `session_id`: Optional session identifier (from `$mixpanel_session_id` in metadata, or falls back to Langfuse session_id)
66+
- `langfuse_trace_name`: The name of the trace
67+
- `langfuse_url`: The URL of the trace in Langfuse
68+
- `langfuse_user_url`: Deep link to the user profile in Langfuse
69+
- `langfuse_id`: The unique identifier of the trace
70+
- `langfuse_cost_usd`: The total cost associated with the trace
71+
- `langfuse_count_observations`: The number of observations (LLM calls) in the trace
72+
- `langfuse_session_id`: The session ID related to the event
73+
- `langfuse_project_id`: The project ID associated with the event
74+
- `langfuse_user_id`: User ID related to the event (defaults to `langfuse_unknown_user` if null)
75+
- `langfuse_latency`: The latency of the trace in milliseconds
76+
- `langfuse_release`: Release information associated with the trace
77+
- `langfuse_version`: The version of the trace
78+
- `langfuse_tags`: Tags associated with the trace
79+
- `langfuse_environment`: The environment associated with the trace (e.g., production, staging)
80+
- `langfuse_event_version`: The integration version of Langfuse
81+
82+
#### `[Langfuse] Generation`
83+
84+
Represents an individual LLM generation (e.g., a single API call to OpenAI, Anthropic, etc.).
85+
86+
**Properties:**
87+
88+
- `time`: Milliseconds since epoch when the generation started
89+
- `distinct_id`: User ID or anonymous identifier
90+
- `$user_id`: User ID sent to Mixpanel's native user ID field
91+
- `$insert_id`: Unique identifier for deduplication
92+
- `session_id`: Optional session identifier (from `$mixpanel_session_id` in metadata, or falls back to Langfuse session_id)
93+
- `langfuse_generation_name`: The name of the generation
94+
- `langfuse_trace_name`: Name of the trace related to the generation
95+
- `langfuse_trace_id`: The unique identifier of the trace related to the generation
96+
- `langfuse_url`: The URL of the generation in Langfuse
97+
- `langfuse_user_url`: Deep link to the user profile in Langfuse
98+
- `langfuse_id`: Unique identifier of the generation
99+
- `langfuse_cost_usd`: Computed total cost of the generation
100+
- `langfuse_input_units`: Number of tokens used in the input/prompt
101+
- `langfuse_output_units`: Number of tokens produced by the generation
102+
- `langfuse_total_units`: Total number of tokens consumed in the generation process
103+
- `langfuse_session_id`: The session ID associated with the trace of the generation
104+
- `langfuse_project_id`: The project ID where the generation occurred
105+
- `langfuse_user_id`: The user ID that started the trace linked to the generation (defaults to `langfuse_unknown_user` if unavailable)
106+
- `langfuse_latency`: The observed latency of the generation in milliseconds
107+
- `langfuse_time_to_first_token`: The time taken to generate the first token when streaming (milliseconds)
108+
- `langfuse_release`: Release information of the trace attached to the generation
109+
- `langfuse_version`: The version information about the generation
110+
- `langfuse_model`: The model used during this generation (e.g., gpt-4, claude-3-sonnet)
111+
- `langfuse_level`: The level associated with the generation
112+
- `langfuse_tags`: Tags attached to the trace of the generation
113+
- `langfuse_environment`: The environment associated with the generation
114+
- `langfuse_event_version`: The integration version with Langfuse
115+
116+
#### `[Langfuse] Score`
117+
118+
Represents user feedback, evaluations, or quality metrics.
119+
120+
**Properties:**
121+
122+
- `time`: Milliseconds since epoch when the score event occurred
123+
- `distinct_id`: User ID or anonymous identifier
124+
- `$user_id`: User ID sent to Mixpanel's native user ID field
125+
- `$insert_id`: Unique identifier for deduplication
126+
- `session_id`: Optional session identifier (from `$mixpanel_session_id` in metadata, or falls back to Langfuse session_id)
127+
- `langfuse_score_name`: The name associated with the score (e.g., "user_feedback", "accuracy")
128+
- `langfuse_score_value`: The numeric value of the score
129+
- `langfuse_score_string_value`: The string value of the score (for BOOLEAN and CATEGORICAL scores)
130+
- `langfuse_score_data_type`: The data type of the score (NUMERIC, BOOLEAN, or CATEGORICAL)
131+
- `langfuse_score_comment`: Comments attached to the score
132+
- `langfuse_score_metadata`: Additional metadata attached to the score
133+
- `langfuse_trace_name`: The name of the trace associated with the score
134+
- `langfuse_trace_id`: The unique identifier of the trace associated with the score
135+
- `langfuse_user_url`: Deep link to the user profile in Langfuse
136+
- `langfuse_id`: The unique identifier of the score
137+
- `langfuse_session_id`: The session ID related to the score's trace
138+
- `langfuse_project_id`: The project ID linked with the score's trace
139+
- `langfuse_user_id`: The user ID that triggered the trace tied to the score (defaults to `langfuse_unknown_user` if not available)
140+
- `langfuse_release`: The release information of the trace associated with the score
141+
- `langfuse_tags`: Tags related to the trace of the score
142+
- `langfuse_environment`: The environment associated with the score
143+
- `langfuse_event_version`: The integration version with Langfuse
144+
145+
## Use Cases
146+
147+
### Get Started with the Analytics for AI Dashboard Template
148+
149+
The fastest way to see value from this integration is to use Mixpanel's **Analytics for AI dashboard template**. This pre-built dashboard provides instant insights into how your LLM features are performing and how they impact user behavior.
150+
151+
[**View the Analytics for AI Dashboard Template →**](https://mixpanel.com/p/NaKPyubj6EuA4oV75taqrq)
152+
153+
The template includes ready-to-use reports for:
154+
155+
- **LLM Feature Adoption**: Track how many users are engaging with your AI features
156+
- **Cost Analysis**: Monitor your LLM spending by user and feature
157+
- **Performance Metrics**: Visualize latency, token usage, and generation times
158+
- **User Feedback**: Analyze scores and ratings from Langfuse
159+
- **Retention Impact**: Understand retention rates of AI feature users
160+
161+
### Analyze LLM Feature Adoption
162+
163+
Create funnels to track:
164+
165+
- Users who trigger `[Langfuse] Trace` events
166+
- Conversion to key actions in your product
167+
- Retention rates for AI feature users vs. non-users
168+
169+
### Monitor LLM Costs by User Segment
170+
171+
Build insights to:
172+
173+
- Group users by `langfuse_cost_usd` total spend
174+
- Segment by user properties (plan type, company size, etc.)
175+
- Identify high-cost users or sessions
176+
177+
### Correlate User Feedback with Behavior
178+
179+
Analyze how `[Langfuse] Score` events relate to:
180+
181+
- Session length and engagement
182+
- Feature usage patterns
183+
- Churn or upgrade likelihood
184+
185+
### Track Model Performance Impact
186+
187+
Compare:
188+
189+
- `langfuse_latency` across different `langfuse_model` values
190+
- Token usage efficiency (`langfuse_total_units`)
191+
- Cost differences between model versions
192+
193+
## Troubleshooting
194+
195+
**Events not appearing in Mixpanel?**
196+
197+
- Verify you selected the correct Mixpanel region in Langfuse
198+
- Confirm your Project Token is correct
199+
- Allow up to 90 minutes for the first sync to complete
200+
- Check that your Langfuse project has trace data
201+
202+
**User matching issues?**
203+
204+
- Ensure the `user_id` in Langfuse matches the `distinct_id` in Mixpanel
205+
- For session tracking, add `$mixpanel_session_id` to your Langfuse trace metadata
206+
207+
**Need additional help?**
208+
Contact Langfuse support or submit a feature request on their [ideas board](https://langfuse.com/ideas).
209+
210+
## Learn More
211+
212+
- [Langfuse Mixpanel Integration Documentation](https://langfuse.com/integrations/analytics/mixpanel)
213+
- [Langfuse Documentation](https://langfuse.com/docs)
214+
- [Langfuse GitHub](https://github.com/langfuse/langfuse)
215+
- [LLM Observability Best Practices](https://langfuse.com/docs/observability)

0 commit comments

Comments
 (0)