---
title: "Connect your app to PostHog"
description: "Connect your app to PostHog to capture product analytics events, evaluate feature flags, and send server-side events from your RShift Sites app."
image: "https://help.rshift.com/og.svg"
---

> Documentation Index
> Fetch the complete documentation index at: https://help.rshift.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect your app to PostHog

export const connector_0 = "PostHog"

[PostHog](https://posthog.com/) is a product analytics platform for event capture, feature flags, and experiments. The PostHog app + chat connector lets your RShift Sites app send events and evaluate flags with a PostHog project token, in the browser and from backend code.

| Use                                                          | If you want to                                                                                                |
| ------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- |
| **App + chat connector** (this page)                         | Work with a shared PostHog project token in the project chat and in your published apps                       |
| [Chat connector (MCP server)](/sites/integrations/chat-connectors/) | Let RShift Sites query your PostHog analytics, flags, and experiments as context while you build (personal to you) |

With PostHog, your app can:

* Capture product analytics events with `posthog-js` using a project token
* Evaluate feature flags for users in the browser or from backend code
* Send events from server routes to the PostHog capture API
* Build product experiences on top of analytics and feature flags

This connector syncs a **project token** (`phc_`) for PostHog's public capture and flags endpoints. Your app calls PostHog ingest hosts directly. It does not use RShift Sites' connector gateway, and it does not accept personal API keys (`phx_`).

## Common use cases and example apps

Use PostHog when your RShift Sites app needs product analytics, feature flags, or server-side event capture tied to a PostHog project.

| Example app                           | Example prompt                                                                                                     | Description                                                                                                                                                      |
| :------------------------------------ | :----------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Product analytics dashboard**       | *Use PostHog and build a SaaS app that tracks signups, feature usage, and retention events.*                       | **Instrument the core product funnel with PostHog events.**<br />The app initializes `posthog-js`, captures key actions, and sends them to your PostHog project. |
| **Feature-flagged rollout**           | *Use PostHog and gate the new onboarding flow behind a feature flag so only flagged users see it.*                 | **Ship features gradually with PostHog flags.**<br />The app evaluates a flag for each user and renders the new or old experience based on the result.           |
| **Waitlist with conversion tracking** | *Use PostHog and build a waitlist landing page that tracks page views, form starts, and successful signups.*       | **Measure landing-page conversion in PostHog.**<br />The app captures funnel events so you can see where visitors drop off.                                      |
| **In-app experiment**                 | *Use PostHog and A/B test two pricing page layouts, then track which variant converts more often.*                 | **Run a simple experiment with PostHog.**<br />The app assigns a layout from a flag and captures conversion events for each variant.                             |
| **Backend event capture**             | *Use PostHog and send a server-side signup\_completed event when a user finishes account creation on the backend.* | **Record reliable server-side events in PostHog.**<br />The app posts capture events from a backend route using the synced project token.                        |
| **Internal admin analytics**          | *Use PostHog and add event tracking to our internal admin tools so we can see which workflows get used.*           | **Understand internal tool usage.**<br />The app tracks admin actions and surfaces usage patterns in PostHog.                                                    |

## How to connect PostHog

Who can create PostHog connections depends on your plan and workspace settings. App + chat connectors are available by default on Free, Pro, and Business plans. On Enterprise plans, they are effectively disabled at first: [Who can create connections and clients](/sites/integrations/admin-controls/#who-can-create-connections-and-clients) defaults to **No one** until an admin changes it in **Connectors → Admin settings → App + chat connectors**.

You can create multiple PostHog connections using different projects or regions, which is useful for separating environments (for example, development and production).

When the connection is created, you can [link it to the projects](/sites/integrations/app-connectors/#link-a-connection-to-a-project) where you want to use it. Anyone building in a project can ask RShift Sites in the project chat to link their project to it.

### Prerequisites

Before connecting PostHog, make sure you have:

* A PostHog Cloud account and project
* The project's numeric **Project ID**
* A **project token** that starts with `phc_`
* The cloud **region** where the project is hosted (`eu` or `us`)
* Permission to **create connections** in your RShift Sites workspace (see [Who can create connections and clients](/sites/integrations/admin-controls/#who-can-create-connections-and-clients))

> **Note**
>
> Event capture, feature flags, and other PostHog usage count toward your PostHog plan. Billing and quota are handled directly by PostHog, not RShift Sites.

### Step 1: Get your PostHog project details

You need three values from PostHog: region, project ID, and project token.

To find them:

**Open your PostHog project**

Sign in to [PostHog](https://app.posthog.com/) (or your EU host if your project is on EU Cloud).

**Open project settings**

Go to **[Project settings](https://app.posthog.com/settings/project)**.

**Copy the project ID and project token**

Copy the numeric **Project ID** and a **Project API key** / project token that starts with `phc_`.

**Confirm your region**

Note whether the project is on **Europe** (`eu.i.posthog.com`) or the **United States** (`us.i.posthog.com`). See [PostHog API base URL](https://posthog.com/docs/api#base-url).

> **Danger**
>
> The project token is a public write key for capture and flags. After you link a connection to a project, RShift Sites exposes it to browser code as a `VITE_` env var. Do not paste a personal API key (`phx_`) into this connector.

See PostHog documentation for more: [Project API keys](https://posthog.com/docs/api#project-api-keys).

### Step 2: Connect PostHog to RShift Sites

You can create multiple connections using different PostHog projects or tokens.

**Open PostHog in Connectors**

Open [**Connectors**](https://lovable.dev/dashboard?connectors) and select **PostHog**. For the other places to open the catalog from, see [Where to find connectors](/sites/integrations/introduction/#where-to-find-connectors).

**Add a connection**

Click **Add connection**.

**Configure the connection**

1. **Display name**: name the connection, for example `PostHog Prod`. This name is only used inside RShift Sites to identify the connection.
2. **Region**: select **Europe (eu.i.posthog.com)** or **United States (us.i.posthog.com)** to match where your PostHog project is hosted.
3. **Project ID**: paste the numeric PostHog project ID from **Project settings**.
4. **Project token**: paste the project token that starts with `phc_`.

**Choose who can use this connection**

Under **Sharing**, the connection is private to you by default and shows a **Private** label. To share it, click **Share with others**. Then add workspace members by email, or click **Invite entire workspace** to make the connection available to everyone in your RShift Sites workspace.

    See [Who can use connections and clients](/sites/integrations/admin-controls/#who-can-use-connections-and-clients) for more information.

**Connect**

Click **Connect**. RShift Sites validates the project token against PostHog before saving the connection.

When connected, anyone building in a project can ask RShift Sites in the project chat to link their project to PostHog (based on configured connection-level access). Your RShift Sites apps can then capture events and evaluate feature flags with the synced project token and region.

## Limitations

The PostHog connector cannot:

* Accept personal API keys (`phx_`). Use a project token (`phc_`) only.
* Proxy PostHog requests through RShift Sites' connector gateway. Your app calls PostHog ingest hosts directly (`eu.i.posthog.com` or `us.i.posthog.com`).
* Cover PostHog private admin REST APIs that require a personal API key.
* Support per-end-user PostHog login. Each connection represents a single PostHog project shared across all projects linked to it.

## Manage your &#123;connector_0&#125; connection

Connections are managed from [**Connectors**](https://lovable.dev/dashboard?connectors): select **&#123;connector_0&#125;**, then open the connection.

* **Unlink projects** to remove &#123;connector_0&#125; access from specific projects while keeping the connection available for others. See [Unlink projects from a connection](/sites/integrations/app-connectors/#unlink-projects-from-a-connection) for the steps.
* **Delete the connection** to remove it from the workspace entirely. Deleting is permanent. It removes the credentials from all linked projects, and app features that use &#123;connector_0&#125; stop working until a new connection is added. See [Delete a connection](/sites/integrations/app-connectors/#delete-a-connection) for the steps and who can delete.

## Related topics

- [Chat connectors: Connect your tools to RShift Sites using MCP servers](/sites/integrations/chat-connectors/)
- [Project analytics](/sites/features/analytics/)
- [Connect your app to X (Twitter)](/sites/integrations/x/)
- [Connect your app to LinkedIn](/sites/integrations/linkedin/)

Source: https://help.rshift.com/sites/integrations/posthog/index.mdx
