A tool for easily migrating data from Mixpanel to Posthog (self-hosted or cloud)
This is NOT an official tool. We are not affiliated with Posthog or Mixpanel
However, if you are looking to migrate from Mixpanel to Posthog like we were - we hope you find this tool useful.
You will need the following from Mixpanel:
- Service account username and password (with owner privileges)
- The project ID (found in settings -> overview)
You will be prompted in CLI to input these, or you can set the following env variables:
MIXPANEL_USERNAME=
MIXPANEL_PASSWORD=
MIXPANEL_PROJECT_ID=
# Optional override, defaults to https://data.mixpanel.com/api/2.0
MIXPANEL_API_URL
You can also put these in .env
for convenience.
You will need the following from Posthog:
- Project API key
- Personal API key
- Endpoint URL
You will be prompted in CLI for these, but can also set them in the environment:
POSTHOG_PROJECT_KEY=
POSTHOG_API_KEY=
POSTHOG_ENDPOINT=
The mixpanel export API has no pagination, the CLI will prompt you for a date range (required by Mixpanel)
If you have a very large data set, do not try to get it all at once
Mixpanel could rate limit you, your system could run out of memory and crash.
It's recommended to do smaller chunks at a time (dates are inclusive, so from_date=2023-03-01 and to_date=2023-03-01 will import 1 days worth of data)
Download the latest Release for your system.
The best way we found to migrate data is to do the following.
- Disable GeoIP app (if enabled)
- Import events (see below)
- In Mixpanel UI, export all users and columns as CSV
- Import the users (see below)
- Enable GeoIP app (if enabled)
Just run without any parameters:
./mixpanel-to-posthog
or ./mixpanel-to-posthog.exe
if using windows.
The mixpanel Web UI allows exporting users as csv format. Select all columns, all users, get a .csv file.
Run ./mixpanel-to-posthog -users-csv-file /path/to/users-export.csv
to load all users into mixpanel