Tooluck logoTooluck
SKILL.md

posthog-adblock-bypass

Agent skill fromLeanmcp/gateway-skills

Configure a Next.js app using posthog-js so session recording and dead-click capture survive browser ad blockers. Aliases the three blocker-flagged JS chunks (dead-clicks-autocapture.js, recorder.js, posthog-recorder.js) to bland same-origin paths via Next.js rewrites, and monkey-patches HTMLScriptElement so posthog-js requests the aliases. TRIGGER when posthog-js session replay or dead-click capture is failing in production with ERR_BLOCKED_BY_CLIENT or 404s on /static/dead-clicks-autocapture.js / /static/recorder.js / /static/posthog-recorder.js, or when the user wants to bypass ad blockers for these specific assets. Works alongside an existing PostHog reverse proxy (managed or otherwise) — only the three blocked files divert through Next.js, all other PostHog traffic stays on the original api_host. SKIP for unrelated PostHog setup, non-Next.js apps, or when capture/decide endpoints (/e/, /decide/, /array/*/config.js) are the ones being blocked — those need a different treatment.

How to install posthog-adblock-bypass

install posthog-adblock-bypass
# install the gateway-skills pack with the skills CLI
npx skills add Leanmcp/gateway-skills

# or add only this skill to Claude Code: copy the folder

skills/posthog-adblock-bypass/

# into

~/.claude/skills/posthog-adblock-bypass/ (all projects)

.claude/skills/posthog-adblock-bypass/ (one project)

skills/posthog-adblock-bypass/SKILL.md

MITFull file
1# PostHog ad-blocker bypass for Next.js
2
3## When to use this
4
5The user has posthog-js working *mostly* — events, feature flags, decide, config all reach PostHog fine — but **session recording and/or dead-click capture aren't working**, and DevTools shows:
6
7- `/static/dead-clicks-autocapture.js` failing
8- `/static/recorder.js` or `/static/posthog-recorder.js` failing
9- `ERR_BLOCKED_BY_CLIENT` or a synthesized 404 (the file actually returns 200 via `curl`)
10
11Root cause: ad blockers (uBlock Origin / Brave Shields / AdBlock Plus / EasyPrivacy) match on **filename patterns** (`recorder`, `autocapture`, `dead-clicks`) regardless of host. A reverse proxy alone doesn't help — renaming on a different host still trips the same filter. **Confirmation step**: ask the user to disable their ad blocker on the page; if the requests succeed, this skill applies.
12
13This skill applies the **surgical** fix: only those three files divert through the Next.js app under bland filenames. All other PostHog traffic (events, decide, config, recording uploads) keeps using the existing `api_host`.
14
15## Prerequisites to confirm before implementing
16
171. The project is **Next.js** (App Router or Pages Router both fine) with `posthog-js` from npm.
182. Server-side: `curl -I https://<api_host>/static/dead-clicks-autocapture.js?v=1.x` returns 200. If it returns 404, the upstream proxy is misconfigured — **fix that first**, this skill won't help.
19…

Excerpt shown under the repository's MIT license.

More skills in gateway-skills

Keep exploring

Similar skill repositories

thedotmack /

claude-mem
116k

Persistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More

CCCXGHGM+135 skills

Newsletter

Join the Community

Subscribe to our newsletter for the latest news and updates