integration-javascript_node

Instrument Node.js server-side applications with PostHog event capture and error tracking.

Updated Feb 24, 2026
One-click install
npx skills add https://github.com/FrekiManagarm/dunlo --skill integration-javascript-node-frekimanagarm
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: integration-javascript_node
Source: https://github.com/FrekiManagarm/dunlo/tree/main/.agents/skills/integration-javascript_node
Command: npx skills add https://github.com/FrekiManagarm/dunlo --skill integration-javascript-node-frekimanagarm

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It helps you instrument a server-side Node.js application with PostHog event tracking so product actions, user identity, and errors become measurable in one place.

Core Features & Use Cases

  • Server-side event tracking: Adds required posthog-node capture calls to route handlers so business-critical operations are recorded (especially where client-only tracking is insufficient).
  • User identification: Implements identify flows (and correlation using X-POSTHOG-DISTINCT-ID / X-POSTHOG-SESSION-ID when frontend + backend both exist) so backend events map to the correct person.
  • Error and exception instrumentation: Captures exceptions in central error handlers using captureException for reliable debugging and stability insights.
  • Event planning and consistency checks: Guides you through building an event plan, implementing it with minimal architectural changes, and validating the results.

Quick Start

Use the integration-javascript_node skill to set up PostHog for your Node.js server-side code by following the provided workflow files starting with basic-integration-1.0-begin.md.

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 event tracking to a Node.js backend?

To add PostHog event tracking to a Node.js backend, use the posthog-node SDK to instrument server-side routes with capture calls for critical business operations like auth and webhooks. This ensures server-side actions are recorded.

How do I correlate backend PostHog events with frontend user sessions?

Correlate backend PostHog events with frontend sessions by passing X-POSTHOG-DISTINCT-ID and X-POSTHOG-SESSION-ID headers in requests. The backend uses these headers to map server-side events to the correct identified person.

Should I use posthog-js or posthog-node for server-side error capture?

You must use posthog-node for server-side error capture. Implement captureException in your central application error middleware to reliably record exceptions and debug stability issues.

When should I flush PostHog events immediately in Node.js?

Flush PostHog events immediately in Node.js for short-lived processes. Long-running servers should rely on batch behavior defaults, but short-lived scripts require immediate flushing settings to ensure events are sent before exit.

Can I use environment variables for PostHog secrets in Node.js?

Yes, you can and should use environment variables for PostHog secrets in Node.js. The integration requires environment variables to manage API keys securely without hardcoding them in your application code.