| name | posthog-migration-deep-dive |
| description | Migrate to PostHog from Google Analytics, Mixpanel, Amplitude, or Segment.
Covers dual-write strategy, historical data import, event name mapping,
identity resolution, and feature flag based traffic shifting.
Trigger: "migrate posthog", "posthog migration", "switch to posthog",
"posthog from mixpanel", "posthog from GA", "posthog replatform".
|
| allowed-tools | Read, Write, Edit, Bash(npm:*), Bash(node:*), Bash(kubectl:*) |
| version | 1.12.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","posthog","migration"] |
| compatibility | Designed for Claude Code, also compatible with Codex and OpenClaw |
PostHog Migration Deep Dive
Current State
!npm list posthog-js posthog-node 2>/dev/null | grep posthog || echo 'No PostHog SDK found'
!npm list @segment/analytics-node mixpanel @google-analytics/data 2>/dev/null | grep -E "segment|mixpanel|google" || echo 'No competitor SDKs found'
Overview
Migrate from Google Analytics, Mixpanel, Amplitude, or Segment to PostHog using a dual-write strategy (send events to both old and new platforms) followed by gradual traffic shifting. PostHog's capture API accepts events in a format similar to Segment's track/identify calls, making migration straightforward.
Migration Types
| Source | Complexity | Duration | Key Challenge |
|---|
| Google Analytics (GA4) | Medium | 2-4 weeks | Event model is fundamentally different |
| Mixpanel | Low | 1-2 weeks | Very similar event model |
| Amplitude | Low | 1-2 weeks | Similar event model |
| Segment | Low | 1 week | PostHog has a Segment destination |
| Custom analytics | Medium | 2-4 weeks | Depends on current implementation |
Instructions
Step 1: Event Name Mapping
const EVENT_MAP: Record<string, string> = {
'Sign Up': 'user_signed_up',
'Login': 'user_logged_in',
'Page View': '$pageview',
'Button Click': 'button_clicked',
'Purchase': 'payment_completed',
'Subscription Started': 'subscription_started',
: ,
: ,
: ,
: ,
: ,
: ,
: ,
: ,
};
: <, > = {
: ,
: ,
: ,
: ,
: ,
: ,
: ,
: ,
};