PostHog Integration
Send your simulated events to PostHog for product analytics and feature flag management.
Overview
PostHog is an open-source product analytics platform with self-hosted and cloud options. MockCDP integrates with PostHog to send realistic user behavior data for testing and development.
Required Credentials
- Project API Key: Your PostHog project API key
- Host URL: PostHog instance URL (cloud or self-hosted)
Setup Instructions
1. Get Your Project API Key
- Log into your PostHog instance
- Go to Project Settings
- Navigate to Project API Key section
- Copy your Project API Key
2. Determine Your Host URL
PostHog Cloud Options:
- US Cloud:
https://us.i.posthog.com
(default) - EU Cloud:
https://eu.i.posthog.com
Self-Hosted:
- Use your custom PostHog instance URL
- Example:
https://posthog.yourcompany.com
3. Configure in MockCDP
- Navigate to Destinations in MockCDP
- Find PostHog in the list
- Toggle Enable to on
- Enter your Project API Key
- Enter your Host URL
- Click Test Credentials to verify connection
- Click Save Configuration
Event Mapping
MockCDP sends these events to PostHog:
MockCDP Event | PostHog Event | Properties |
---|---|---|
Page Viewed | $pageview | $current_url, $referrer, page_name |
Product Viewed | product_viewed | product_id, product_name, price, category |
Product Added | product_added | product_id, product_name, price, quantity |
Order Completed | order_completed | order_id, revenue, products |
User Signed Up | user_signed_up | distinct_id, email, signup_method |
Troubleshooting
Common Issues
"Invalid API Key" Error
- Verify your Project API Key is correct
- Check you're not using a Personal API Key instead
"Host Not Reachable" Error
- Verify your host URL is correct
- For self-hosted: ensure MockCDP can reach your instance
- Check for firewall or network issues
Events Not Appearing
- Events appear in real-time in PostHog
- Check the Live Events tab in PostHog
- Verify your project and date filters
Best Practices
- Test Connection: Always verify credentials before simulation
- Monitor Ingestion: Check PostHog's event ingestion rate
- Use Filters: Set up filters to identify MockCDP events
- Session Recording: Enable session recording for deeper insights
- Custom Events: Leverage custom events for specific use cases
Need Help?
Check our troubleshooting guide or contact support.