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

  1. Log into your PostHog instance
  2. Go to Project Settings
  3. Navigate to Project API Key section
  4. 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

  1. Navigate to Destinations in MockCDP
  2. Find PostHog in the list
  3. Toggle Enable to on
  4. Enter your Project API Key
  5. Enter your Host URL
  6. Click Test Credentials to verify connection
  7. Click Save Configuration

Event Mapping

MockCDP sends these events to PostHog:

MockCDP EventPostHog EventProperties
Page Viewed$pageview$current_url, $referrer, page_name
Product Viewedproduct_viewedproduct_id, product_name, price, category
Product Addedproduct_addedproduct_id, product_name, price, quantity
Order Completedorder_completedorder_id, revenue, products
User Signed Upuser_signed_updistinct_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

  1. Test Connection: Always verify credentials before simulation
  2. Monitor Ingestion: Check PostHog's event ingestion rate
  3. Use Filters: Set up filters to identify MockCDP events
  4. Session Recording: Enable session recording for deeper insights
  5. Custom Events: Leverage custom events for specific use cases

Need Help?

Check our troubleshooting guide or contact support.