Skip to content
This repository was archived by the owner on Jan 27, 2026. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions llm-prompts/migrate-amplitude/1.0-begin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---
title: Amplitude Migration - Begin
description: Scan the project for Amplitude SDK usage and create a migration plan
---

You are migrating this project from Amplitude Analytics to PostHog.

## Step 1: Detect Amplitude Installation

Check `package.json` for any of these Amplitude packages:
- `@amplitude/analytics-browser`
- `@amplitude/analytics-node`
- `@amplitude/analytics-react-native`
- `amplitude-js`

Note which packages are installed and their versions.

## Step 2: Scan for Amplitude Code

Search the codebase for files containing Amplitude usage:

1. **Import statements** - Look for:
- `from '@amplitude/analytics-browser'`
- `from 'amplitude-js'`
- `from '@amplitude/analytics-node'`
- `from './ampli'` (generated Amplitude SDK)

2. **Initialization code** - Look for:
- `init('AMPLITUDE_API_KEY')`
- `amplitude.getInstance().init()`
- `ampli.load()`

3. **Tracking calls** - Look for:
- `track()`, `logEvent()`
- `identify()`, `setUserId()`
- `setGroup()`, `groupIdentify()`
- `revenue()`, `Revenue`
- Ampli type-safe methods like `ampli.buttonClicked()`

4. **Configuration files** - Check for Amplitude environment variables:
- `AMPLITUDE_API_KEY`
- `REACT_APP_AMPLITUDE_API_KEY`
- `NEXT_PUBLIC_AMPLITUDE_API_KEY`
- `VITE_AMPLITUDE_API_KEY`

## Step 3: Create Migration Plan

Create a file `.posthog-migration.json` at the project root with:

```json
{
"sourceProvider": "amplitude",
"detectedPackages": ["@amplitude/analytics-browser"],
"filesToMigrate": [
{
"path": "src/index.tsx",
"patterns": ["initialization", "provider-setup"]
},
{
"path": "src/components/Button.tsx",
"patterns": ["event-tracking"]
}
],
"hasAmpliSdk": false,
"ampliDirectory": null,
"environmentVariables": {
"remove": ["AMPLITUDE_API_KEY"],
"add": ["POSTHOG_KEY", "POSTHOG_HOST"]
}
}
```

## Step 4: Determine PostHog Package

Map Amplitude packages to PostHog equivalents:
- `@amplitude/analytics-browser` → `posthog-js`
- `amplitude-js` → `posthog-js`
- `@amplitude/analytics-node` → `posthog-node`

## Status

Report these status updates as you work:

- [STATUS] Checking for Amplitude installation
- [STATUS] Scanning for Amplitude usage patterns
- [STATUS] Found X files with Amplitude code
- [STATUS] Creating migration plan
Loading