> ## Documentation Index
> Fetch the complete documentation index at: https://docs.buildbetter.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# PostHog Integration (Alpha)

> Integrate BuildBetter with PostHog for comprehensive product analytics

<Note>
  **Coming Soon - Request Early Access**

  This integration is currently in Alpha development and not yet publicly available. If you're interested in early access, please contact [support@buildbetter.app](mailto:support@buildbetter.app) with "PostHog Integration Early Access" in the subject line.
</Note>

Connect your BuildBetter workspace with PostHog to gain deeper insights into user behavior, product usage, and analytics. This integration helps you understand how your team and customers interact with BuildBetter features.

## Features

* **Event Tracking**: Track key BuildBetter events in PostHog
* **User Identity Syncing**: Map BuildBetter users to PostHog profiles
* **Session Recording**: View user sessions in PostHog for deeper analysis
* **Feature Flag Access**: Control BuildBetter features using PostHog feature flags
* **Custom Dashboards**: Create custom PostHog dashboards with BuildBetter data

## Setup Instructions

### Prerequisites

* An active BuildBetter account
* A PostHog account (cloud or self-hosted)
* Admin access to both platforms

### Connecting PostHog

1. Navigate to **Settings → Integrations** in your BuildBetter dashboard
2. Find and select **PostHog** from the analytics integrations section
3. Enter your PostHog API key and project ID
4. For self-hosted PostHog instances, enter your PostHog host URL
5. Click **Connect** to establish the integration

### Configuring Event Tracking

After connecting:

1. Go to the **Event Configuration** tab
2. Select which BuildBetter events you want to track in PostHog:
   * Call recordings
   * Summaries generated
   * Document creation
   * Chat interactions
   * User logins/logouts
3. Save your configuration

## Usage

### Viewing BuildBetter Data in PostHog

Once connected, your BuildBetter data will appear in PostHog under the following events:

* `buildbetter_call_recorded`
* `buildbetter_summary_generated`
* `buildbetter_document_created`
* `buildbetter_chat_started`
* `buildbetter_feature_used`

### Creating Insights

In PostHog, you can create custom insights:

1. Go to **Insights** in your PostHog dashboard
2. Create a new insight
3. Filter for BuildBetter events
4. Build visualizations based on your specific needs

### Using Feature Flags

To control BuildBetter features with PostHog feature flags:

1. Create feature flags in PostHog
2. In BuildBetter, go to **Settings → Integrations → PostHog → Feature Flags**
3. Map PostHog feature flags to BuildBetter features
4. Test and deploy your configuration

## Troubleshooting

### Events Not Appearing

* Verify your API key is correct
* Check that the events are enabled in the configuration
* Ensure there's no network blocking between BuildBetter and PostHog

### User Identity Issues

* Make sure user identification is properly configured in both systems
* Check for any ID conflicts in your PostHog setup

## Data Privacy Considerations

When using this integration, consider:

* What user data is being shared with PostHog
* Data retention policies in PostHog
* Compliance with privacy regulations like GDPR or CCPA
