Files
zeekay e43ab1afe7 chore: rename all PostHog references to Insights/Hanzo
Bulk rename across 989 files:
- Package names: posthog-js → @hanzo/insights, posthog-node → @hanzo/insights-node, etc.
- Repository URLs: posthog/posthog-js → hanzoai/insights-js
- Brand names: PostHog → Insights
- File renames: 259 reference JSON files, source files, workflow files
- Directory rename: eslint-plugin-posthog-js → eslint-plugin-insights

Remaining: 8 refs to @posthog/rrweb-* (real npm deps, need fork+publish)
2026-03-06 01:41:12 -08:00

2.6 KiB

Insights demo project

Testing local changes to packages

This is a simple project used to test local changes to the Insights JS SDK packages.

Use the provided script that handles building, packaging, and running the dev server:

cd playground/nextjs
./bin/localdev.sh

With environment variables:

NEXT_PUBLIC_INSIGHTS_KEY='<your-local-api-key>' NEXT_PUBLIC_INSIGHTS_HOST='http://localhost:8010' ./bin/localdev.sh

This script will:

  1. Build all packages in the monorepo
  2. Package them into tarballs
  3. Install dependencies in the playground
  4. Start the dev server

Open http://localhost:3000?__insights_debug=true to see debug logs.

Manual Setup

If you prefer to run steps manually:

  1. From the root of the repo, build and package:
pnpm install
pnpm build
pnpm package
  1. From this folder, install dependencies and run dev:
pnpm install
NEXT_PUBLIC_INSIGHTS_KEY='<your-local-api-key>' NEXT_PUBLIC_INSIGHTS_HOST='http://localhost:8010' pnpm dev

How it works

The playground is excluded from the workspace (see pnpm-workspace.yaml). Dependencies are rewritten by playground/.pnpmfile.cjs to use tarballs from the target/ directory instead of workspace links. This means you must run pnpm package after making changes to see them in the playground.

Testing cross-subdomain tracking

We can locally debug the cross-domain behaviour of @hanzo/insights by editing our /etc/hosts file to point some fake subdomains to localhost. There are a few steps required to do this, these are the instructions for doing this on MacOS with Chrome:

Add the following to your /etc/host file:

127.0.0.1 www.insights.dev
127.0.0.1 app.insights.dev

To restart your DNS server on MacOS, run:

sudo killall -HUP mDNSResponder

Run this modified command to start the server. It will ask you to for sudo permissions to create a self-signed cert for https.

NEXT_PUBLIC_INSIGHTS_KEY='<your-local-api-key>' NEXT_PUBLIC_INSIGHTS_HOST='http://localhost:8000' pnpm dev-crossdomain

You can now open the subdomains we added to the host file, but you will likely see a warning about unsafe certificates. To get around this, in Chrome you can type thisisunsafe to bypass the warning. The subdomains are:

Surveys testing guide

See surveys/CONTRIBUTING.md in the main insights repo for more details