Step 1 of 70% complete
Account
Install
Verify
Track
1
Create Your PostHog Account
~2 minFirst things first! Let's get you set up with a PostHog account. You can choose between their free Cloud version or self-host.
PostHog Cloud is free up to 1M events/month - perfect for getting started!
2
Get Your Project API Key
~1 minEvery PostHog project has a unique API key. You'll need this to connect your app to PostHog.
Checklist
Go to Project Settings
Find your Project API Key
Copy it somewhere safe
Your API key looks something like: phc_xxxx... Keep it handy!
3
Install PostHog
~1 minTime to add PostHog to your project! Pick your framework below and run the install command.
javascript
npm install posthog-jsChecklist
Select your framework above
Run the install command
Verify it was added to dependencies
4
Initialize PostHog
~2 minAdd the initialization code to your app. Replace <YOUR_API_KEY> with your actual key from Step 2.
javascript
import posthog from 'posthog-js'
posthog.init('<YOUR_API_KEY>', {
api_host: 'https://app.posthog.com',
person_profiles: 'identified_only'
})Checklist
Add initialization code
Replace <YOUR_API_KEY> with your key
Save and restart your app
Make sure to initialize PostHog before your app renders!
5
Verify Installation
~1 minLet's make sure everything is working! Open your app and check for events in PostHog.
Checklist
Open your app in the browser
Click around a bit
Check PostHog Activity tab
Events might take a few seconds to appear. Refresh the Activity page!
If you see a "$pageview" event, you're golden! 🎉
6
Track Custom Events
~3 minNow for the fun part! Track specific actions that matter to your product.
javascript
// Track a custom event
posthog.capture('button_clicked', {
button_name: 'signup',
page: 'homepage'
})
// Identify a user
posthog.identify('user_123', {
email: 'user@example.com',
plan: 'premium'
})Checklist
Identify key user actions
Add tracking code
Test your custom events
Common events: signup_clicked, purchase_completed, feature_used
7
Explore Your Dashboard
~5 minYou did it! Now let's take a quick tour of what PostHog can do for you.
Checklist
Create your first Insight
Watch a Session Recording
Check out Feature Flags
PostHog can also do A/B testing, surveys, and has a built-in data warehouse!