# posthog-stinger

posthog-stinger configures PostHog analytics for SvelteKit 5 apps deployed on Vercel. It fixes router pageview tracking, sets up feature flags, and handles reverse proxying.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf (Devin Desktop), Claude.ai · ★ 96 repo stars
- Author: Legion Code Inc.
- License: AGPL-3.0-or-later · policy=link-only · description only; the file stays with the author
- Source: https://github.com/legioncodeinc/vibe-coding-tools/tree/HEAD/plugins/platform-and-release-tools/skills/posthog-stinger/SKILL.md
- Updated: 2026-10-18
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/posthog-stinger

## What it does

This skill provides direct patterns for integrating client-side `posthog-js` and server-side `posthog-node` into SvelteKit 5 projects. It directly addresses the classic issue where client-side router transitions drop pageview counts. It also provides rules for identity stitching via `identify()` and `alias()`, as well as flag bootstrapping to stop interface flicker during page load.

Included reference files detail `vercel.json` rewrites designed to bypass ad blockers. You will also find privacy masking rules for session recordings, survey targeting options, B2B group analytics, and differences between EU and US cloud data endpoints.

PostHog lacks confirmed native event sampling, meaning cost management depends entirely on account billing limits and trimming down autocapture.

## Install

### Claude Code (native platform)

1. **Plugin marketplace**
In the agent chat (not a shell):
```text
/plugin marketplace add legioncodeinc/vibe-coding-tools
```
In the agent chat (not a shell):
```text
/plugin install platform-and-release-tools@wasp-nest
```
This installs the whole platform-and-release-tools plugin with all its skills

2. **Skills CLI (Vercel)**
```bash
npx skills add legioncodeinc/vibe-coding-tools --skill posthog-stinger -a claude-code
```

3. **Manually: put the files in place**
- File: `~/.claude/skills/posthog-stinger/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/posthog-stinger/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add legioncodeinc/vibe-coding-tools --skill posthog-stinger -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/posthog-stinger/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add legioncodeinc/vibe-coding-tools --skill posthog-stinger -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/posthog-stinger/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install legioncodeinc/vibe-coding-tools plugins/platform-and-release-tools/skills/posthog-stinger
```

2. **Manually: put the files in place**
- File: `.github/skills/posthog-stinger/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add legioncodeinc/vibe-coding-tools --skill posthog-stinger -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/legioncodeinc/vibe-coding-tools --path plugins/platform-and-release-tools/skills/posthog-stinger
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/posthog-stinger/SKILL.md` — The legacy .windsurf/skills/ path still works

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/legioncodeinc/vibe-coding-tools/tree/HEAD/plugins/platform-and-release-tools/skills/posthog-stinger/SKILL.md

## When to use it
- fix client-side pageview tracking in SvelteKit router
- bootstrap feature flags on the server to prevent UI flicker
- configure Vercel rewrites to proxy PostHog past ad blockers
- stitch anonymous visitor sessions using identify and alias

## Example prompts
- Set up client-side posthog-js tracking for SvelteKit 5 routes
- Configure vercel.json rewrites to proxy PostHog traffic away from ad blockers
- Show how to bootstrap feature flags on the server without UI flicker

## Similar
- [posthog-analytics](https://affpapa.org/en/nevibecode/skills/posthog-analytics.md) — skill · 827 installs
- [posthog-automation](https://affpapa.org/en/nevibecode/skills/posthog-automation.md) — skill · 121 installs
- [posthog](https://affpapa.org/en/nevibecode/skills/posthog.md) — skill · ★ 8052 repo stars
- [PostHog MCP Server](https://affpapa.org/en/nevibecode/mcp/posthog-mcp-server.md) — MCP server · ★ 41008 repo stars
- [vercel-flags](https://affpapa.org/en/nevibecode/skills/vercel-flags.md) — skill · 4 installs
- [querying-posthog-data](https://affpapa.org/en/nevibecode/skills/querying-posthog-data.md) — skill · 890 installs

From the same set: [legioncodeinc/vibe-coding-tools](https://affpapa.org/en/nevibecode/by/legioncodeinc/vibe-coding-tools.md) — 172 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
