Product Analytics Integration
Instrument your app with product analytics: event tracking schema design, Segment CDP, Mixpanel funnels, and privacy-compliant data collection.
Product analytics reveals how users interact with your product - where they drop off, what features they use, and who converts. Effective analytics starts with a clean event schema and a CDP (Customer Data Platform) like Segment that routes events to multiple tools.
Design your event schema before you instrument - retrofitting is expensive. Use Segment as the single collection point. Track meaningful user actions, not page views. Respect user consent. Use Mixpanel or Amplitude for product analytics, not GA4.
Workflow
- Design an event tracking schemaInconsistent event naming makes analytics unusable; a schema prevents this from day one.
- Instrument with SegmentSegment sends events to 300+ destinations - add Mixpanel, Heap, BigQuery without code changes.
- Build funnels and retention in MixpanelFunnels reveal conversion drop-offs; retention shows if features create habitual use.
- Handle identity consistentlyAnonymous-to-identified user linking is the most common analytics problem - broken identity corrupts funnels.
- Implement consent and privacyTracking without consent is a GDPR violation; tracking users who opted out creates legal and reputational risk.
Output Format
Event tracking schema doc, Segment instrumentation for identify/track/group, Mixpanel funnels for key flows, identity alias on signup, consent gating.
Examples
Track event: `analytics.track({ userId: user.id, event: "Subscription Started", properties: { plan: "pro", billingInterval: "annual", amount: 99, currency: "USD", source: "upgrade-modal" } })`Alias on signup: `analytics.alias({ userId: newUser.id, previousId: req.session.anonymousId }); analytics.identify({ userId: newUser.id, traits: { email: newUser.email, createdAt: new Date().toISOString() } })`Consent check: `if (userConsented) { analytics.track({ userId, event: "Feature Used", properties: { feature: "export" } }) }`Edge Cases & Gotchas
- Server-side vs client-side tracking: client-side tracks are blocked by ad blockers (~30% of users); use server-side tracking for critical business events (orders, signups)
- High-cardinality properties: avoid tracking unique IDs in properties that Mixpanel will use for grouping (e.g., `itemId` in a cart event) - creates cardinality explosions
- Clock drift: use server timestamp for business events; client timestamps can be wrong (user system clock). Segment allows `timestamp` override in track calls
When to Break These Rules
- For very simple apps (<1000 MAU), Google Analytics 4 is free and sufficient for basic page and event tracking without the Segment overhead.
Reference Files
Segment Node.js SDK: https://segment.com/docs/connections/sources/catalog/libraries/server/node/Mixpanel docs: https://developer.mixpanel.com/docsSegment Tracking Plan: https://segment.com/docs/protocols/Amplitude: https://amplitude.com/docs/sdks/analytics