How to connect PostHog and InsForge

InsForge is a backend-as-a-service for AI-built apps. This tutorial walks you through linking a PostHog project from the InsForge dashboard, using the embedded analytics views, and sending events from your app with the PostHog SDK.

The integration uses PostHog's provisioning API. InsForge documents their side in their setup guide.

Prerequisites

  • An InsForge project
  • A PostHog account (optional – InsForge can create one for you during setup)

Step 1: Connect PostHog in InsForge

  1. Open your InsForge project and go to the Analytics tab.
  2. Click Connect PostHog.

Connect PostHog in the InsForge dashboard

  1. Complete the connection flow:

    • Existing PostHog account: approve the OAuth consent screen, choose the organization and project, then return to InsForge. The page reloads when the link is ready.
    • New to PostHog: InsForge provisions a PostHog project via the provisioning API. You receive a welcome email to set a password, but you can use embedded analytics in InsForge before signing in to posthog.com.
  2. Open the gear icon and Analytics Config to copy your project token, host, and project ID when you need them elsewhere.

PostHog connected in InsForge

Step 2: Use embedded analytics

After connection, the Analytics tab shows PostHog data via the /query API – the same data as on posthog.com, rendered inside InsForge.

  • Use the time-range selector at the top to filter every card on the page.
  • Click Open in PostHog to open the full PostHog app for deeper analysis.

Traffic

The Traffic tab includes visitor, pageview, and bounce-rate KPIs with trend charts, plus breakdowns for top pages, countries, and device types.

Traffic analytics in InsForge

User retention

User Retention shows a weekly retention cohort based on $pageview events.

User retention in InsForge

Session replay

Session Replay lists recent recordings. Open a recording in a modal to use the PostHog player without leaving InsForge.

Step 3: Send events from your app

Connecting the dashboard does not instrument your application. You still need a PostHog SDK to capture product events.

  1. In Analytics Config, open the Setup Prompt tab.
  2. Copy the one-line prompt into Claude Code, Cursor, or another agent that runs the InsForge skill. The skill points to the PostHog SDK installation wizard, which detects your framework, installs the SDK, and configures it with your project token.

For headless or CI setups, run:

Terminal
npx @insforge/cli posthog setup

This runs the same setup flow from the terminal.

Next steps

Community questions

Was this page useful?

Questions about this page? or post a community question.