integration-javascript_node

Integrates PostHog analytics into server-side Node.js applications using posthog-node.

1|Updated Apr 4, 2026
One-click install
npx skills add https://github.com/stom66/dcl-bowling --skill integration-javascript-node-stom66
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: integration-javascript_node
Source: https://github.com/stom66/dcl-bowling/tree/main/.cursor/skills/posthog
Command: npx skills add https://github.com/stom66/dcl-bowling --skill integration-javascript-node-stom66

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires posthog-node, and includes references (resource) components.

What problem does it solve? Adding product analytics to a Node.js backend requires choosing the right SDK, planning meaningful events, wiring user identification, and handling error tracking correctly. This Skill guides an AI agent through a complete, phased PostHog integration so nothing important is missed. ## Core Features & Use Cases - Guided four-phase workflow: Plan events, implement capture calls, revise and validate the code, then conclude with a dashboard and setup report. - Server-side best practices: Enforces posthog-node (not posthog-js), environment-variable keys, exception autocapture, correct flush settings for long-running servers versus serverless functions, and distinct ID correlation between client and server. - Bundled reference documentation: Includes PostHog Node.js SDK API references and user-identification guides for accurate implementations. - Use Case: Point an AI coding agent at an Express or Fastify API and have it instrument checkout, signup, and webhook routes with PostHog events, error capture, and a generated analytics dashboard. ## Quick Start Ask your AI agent to use this skill to add PostHog event tracking and error monitoring to your Node.js server application.

Frequently Asked Questions about integration-javascript_node

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add PostHog analytics to a Node.js server?▼

Install the posthog-node package, initialize a PostHog client with your project token from an environment variable, and call capture() in route handlers for meaningful user actions. This skill walks through planning events, implementing them, and validating the result.

Should I use posthog-node or posthog-js on the server?▼

Use posthog-node for server-side Node.js code; posthog-js is the browser SDK and must not be used on the server. Server-side capture also does not need a reverse proxy, which only client-side JavaScript requires to avoid ad blockers.

How do I identify users with the PostHog Node SDK?▼

Call identify during login and signup events with the user's distinct ID, and pass the client-side session and distinct ID to the server via X-POSTHOG-DISTINCT-ID and X-POSTHOG-SESSION-ID headers so frontend and backend events correlate.

How should PostHog be configured for serverless functions?▼

For short-lived processes like AWS Lambda or scripts, set flushAt to 1 and flushInterval to 0 so events send immediately, and await shutdown() before exit. Long-running servers should keep the default batching behavior.

How do I track errors with PostHog in Express?▼

Call captureException(err, distinctId) in your application's error handler, such as Express error middleware, and enable enableExceptionAutocapture in the PostHog constructor options for automatic exception capture.