---
title: "Connect your app to PostHog"
description: "<p><a href=\"https://posthog.com/\">PostHog</a> is a product analytics platform for event capture, feature flags, and experiments."
---

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

# Connect your app to PostHog

<p><a href="https://posthog.com/">PostHog</a> 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.</p>
<table>
<thead>
<tr>
<th>Use</th>
<th>If you want to</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>App + chat connector</strong> (this page)</td>
<td>Work with a shared PostHog project token in the project chat and in your published apps</td>
</tr>
<tr>
<td><a href="/sites/integrations/chat-connectors/">Chat connector (MCP server)</a></td>
<td>Let RShift Sites query your PostHog analytics, flags, and experiments as context while you build (personal to you)</td>
</tr>
</tbody>
</table>
<p>With PostHog, your app can:</p>
<ul>
<li>Capture product analytics events with <code>posthog-js</code> using a project token</li>
<li>Evaluate feature flags for users in the browser or from backend code</li>
<li>Send events from server routes to the PostHog capture API</li>
<li>Build product experiences on top of analytics and feature flags</li>
</ul>
<p>This connector syncs a <strong>project token</strong> (<code>phc_</code>) 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 (<code>phx_</code>).</p>
<h2>Common use cases and example apps</h2>
<p>Use PostHog when your RShift Sites app needs product analytics, feature flags, or server-side event capture tied to a PostHog project.</p>
<table>
<thead>
<tr>
<th style="text-align: left">Example app</th>
<th style="text-align: left">Example prompt</th>
<th style="text-align: left">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left"><strong>Product analytics dashboard</strong></td>
<td style="text-align: left"><em>Use PostHog and build a SaaS app that tracks signups, feature usage, and retention events.</em></td>
<td style="text-align: left"><strong>Instrument the core product funnel with PostHog events.</strong><br />The app initializes <code>posthog-js</code>, captures key actions, and sends them to your PostHog project.</td>
</tr>
<tr>
<td style="text-align: left"><strong>Feature-flagged rollout</strong></td>
<td style="text-align: left"><em>Use PostHog and gate the new onboarding flow behind a feature flag so only flagged users see it.</em></td>
<td style="text-align: left"><strong>Ship features gradually with PostHog flags.</strong><br />The app evaluates a flag for each user and renders the new or old experience based on the result.</td>
</tr>
<tr>
<td style="text-align: left"><strong>Waitlist with conversion tracking</strong></td>
<td style="text-align: left"><em>Use PostHog and build a waitlist landing page that tracks page views, form starts, and successful signups.</em></td>
<td style="text-align: left"><strong>Measure landing-page conversion in PostHog.</strong><br />The app captures funnel events so you can see where visitors drop off.</td>
</tr>
<tr>
<td style="text-align: left"><strong>In-app experiment</strong></td>
<td style="text-align: left"><em>Use PostHog and A/B test two pricing page layouts, then track which variant converts more often.</em></td>
<td style="text-align: left"><strong>Run a simple experiment with PostHog.</strong><br />The app assigns a layout from a flag and captures conversion events for each variant.</td>
</tr>
<tr>
<td style="text-align: left"><strong>Backend event capture</strong></td>
<td style="text-align: left"><em>Use PostHog and send a server-side signup_completed event when a user finishes account creation on the backend.</em></td>
<td style="text-align: left"><strong>Record reliable server-side events in PostHog.</strong><br />The app posts capture events from a backend route using the synced project token.</td>
</tr>
<tr>
<td style="text-align: left"><strong>Internal admin analytics</strong></td>
<td style="text-align: left"><em>Use PostHog and add event tracking to our internal admin tools so we can see which workflows get used.</em></td>
<td style="text-align: left"><strong>Understand internal tool usage.</strong><br />The app tracks admin actions and surfaces usage patterns in PostHog.</td>
</tr>
</tbody>
</table>
<h2>How to connect PostHog</h2>
<p>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: <a href="/sites/integrations/admin-controls/#who-can-create-connections-and-clients">Who can create connections and clients</a> defaults to <strong>No one</strong> until an admin changes it in <strong>Connectors → Admin settings → App + chat connectors</strong>.</p>
<p>You can create multiple PostHog connections using different projects or regions, which is useful for separating environments (for example, development and production).</p>
<p>When the connection is created, you can <a href="/sites/integrations/app-connectors/#link-a-connection-to-a-project">link it to the projects</a> 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.</p>
<h3>Prerequisites</h3>
<p>Before connecting PostHog, make sure you have:</p>
<ul>
<li>A PostHog Cloud account and project</li>
<li>The project's numeric <strong>Project ID</strong></li>
<li>A <strong>project token</strong> that starts with <code>phc_</code></li>
<li>The cloud <strong>region</strong> where the project is hosted (<code>eu</code> or <code>us</code>)</li>
<li>Permission to <strong>create connections</strong> in your RShift Sites workspace (see <a href="/sites/integrations/admin-controls/#who-can-create-connections-and-clients">Who can create connections and clients</a>)</li>
</ul>
<blockquote>
<p><strong>Note</strong></p>
<p>Event capture, feature flags, and other PostHog usage count toward your PostHog plan. Billing and quota are handled directly by PostHog, not RShift Sites.</p>
</blockquote>
<h3>Step 1: Get your PostHog project details</h3>
<p>You need three values from PostHog: region, project ID, and project token.</p>
<p>To find them:</p>
<p><strong>Open your PostHog project</strong></p>
<p>Sign in to <a href="https://app.posthog.com/">PostHog</a> (or your EU host if your project is on EU Cloud).</p>
<p><strong>Open project settings</strong></p>
<p>Go to <strong><a href="https://app.posthog.com/settings/project">Project settings</a></strong>.</p>
<p><strong>Copy the project ID and project token</strong></p>
<p>Copy the numeric <strong>Project ID</strong> and a <strong>Project API key</strong> / project token that starts with <code>phc_</code>.</p>
<p><strong>Confirm your region</strong></p>
<p>Note whether the project is on <strong>Europe</strong> (<code>eu.i.posthog.com</code>) or the <strong>United States</strong> (<code>us.i.posthog.com</code>). See <a href="https://posthog.com/docs/api#base-url">PostHog API base URL</a>.</p>
<blockquote>
<p><strong>Danger</strong></p>
<p>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 <code>VITE_</code> env var. Do not paste a personal API key (<code>phx_</code>) into this connector.</p>
</blockquote>
<p>See PostHog documentation for more: <a href="https://posthog.com/docs/api#project-api-keys">Project API keys</a>.</p>
<h3>Step 2: Connect PostHog to RShift Sites</h3>
<p>You can create multiple connections using different PostHog projects or tokens.</p>
<p><strong>Open PostHog in Connectors</strong></p>
<p>Open <a href="https://lovable.dev/dashboard?connectors"><strong>Connectors</strong></a> and select <strong>PostHog</strong>. For the other places to open the catalog from, see <a href="/sites/integrations/introduction/#where-to-find-connectors">Where to find connectors</a>.</p>
<p><strong>Add a connection</strong></p>
<p>Click <strong>Add connection</strong>.</p>
<p><strong>Configure the connection</strong></p>
<ol>
<li><strong>Display name</strong>: name the connection, for example <code>PostHog Prod</code>. This name is only used inside RShift Sites to identify the connection.</li>
<li><strong>Region</strong>: select <strong>Europe (eu.i.posthog.com)</strong> or <strong>United States (us.i.posthog.com)</strong> to match where your PostHog project is hosted.</li>
<li><strong>Project ID</strong>: paste the numeric PostHog project ID from <strong>Project settings</strong>.</li>
<li><strong>Project token</strong>: paste the project token that starts with <code>phc_</code>.</li>
</ol>
<p><strong>Choose who can use this connection</strong></p>
<p>Under <strong>Sharing</strong>, the connection is private to you by default and shows a <strong>Private</strong> label. To share it, click <strong>Share with others</strong>. Then add workspace members by email, or click <strong>Invite entire workspace</strong> to make the connection available to everyone in your RShift Sites workspace.</p>
<pre><code>See [Who can use connections and clients](/sites/integrations/admin-controls/#who-can-use-connections-and-clients) for more information.
</code></pre>
<p><strong>Connect</strong></p>
<p>Click <strong>Connect</strong>. RShift Sites validates the project token against PostHog before saving the connection.</p>
<p>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.</p>
<h2>Limitations</h2>
<p>The PostHog connector cannot:</p>
<ul>
<li>Accept personal API keys (<code>phx_</code>). Use a project token (<code>phc_</code>) only.</li>
<li>Proxy PostHog requests through RShift Sites' connector gateway. Your app calls PostHog ingest hosts directly (<code>eu.i.posthog.com</code> or <code>us.i.posthog.com</code>).</li>
<li>Cover PostHog private admin REST APIs that require a personal API key.</li>
<li>Support per-end-user PostHog login. Each connection represents a single PostHog project shared across all projects linked to it.</li>
</ul>
<h2>Manage your {connector_0} connection</h2>
<p>Connections are managed from <a href="https://lovable.dev/dashboard?connectors"><strong>Connectors</strong></a>: select <strong>{connector_0}</strong>, then open the connection.</p>
<ul>
<li><strong>Unlink projects</strong> to remove {connector_0} access from specific projects while keeping the connection available for others. See <a href="/sites/integrations/app-connectors/#unlink-projects-from-a-connection">Unlink projects from a connection</a> for the steps.</li>
<li><strong>Delete the connection</strong> to remove it from the workspace entirely. Deleting is permanent. It removes the credentials from all linked projects, and app features that use {connector_0} stop working until a new connection is added. See <a href="/sites/integrations/app-connectors/#delete-a-connection">Delete a connection</a> for the steps and who can delete.</li>
</ul>
<h2>Related topics</h2>
<ul>
<li><a href="/sites/integrations/chat-connectors/">Chat connectors: Connect your tools to RShift Sites using MCP servers</a></li>
<li><a href="/sites/features/analytics/">Project analytics</a></li>
<li><a href="/sites/integrations/x/">Connect your app to X (Twitter)</a></li>
<li><a href="/sites/integrations/linkedin/">Connect your app to LinkedIn</a></li>
</ul>

Source: https://rshift.helpcent.re/sites/integrations/posthog/index.mdx
