### Instrument Product Analytics
Works with
Detect project framework and install the appropriate PostHog SDK using the project's native package manager.
Initialize the SDK and implement event tracking for key user actions, ensuring server-side events are captured where applicable.
Use environment variables for API keys and add identify calls during authentication to maintain consistent user tracking.
AI-first code editor with Composer
Before installing skills in Cursor, ensure your development environment meets these requirements:
node --versioninstrument-product-analyticsExecute the skills CLI command in your project's root directory to begin installation:
Fetches instrument-product-analytics from PostHog/skills and configures it for Cursor.
The CLI shows a list of agents. Use arrow keys and space to select Cursor:
Confirm successful installation by checking the skill directory location:
Restart Cursor to activate instrument-product-analytics. Access via /instrument-product-analytics in your agent's command palette.
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.
Submit your Claude Code skill and start earning
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
0
total installs
0
this week
15
GitHub stars
0
upvotes
Run in your terminal
0
installs
0
this week
15
stars
| name | instrument-product-analytics |
| description | >- Add PostHog product analytics events to track user behavior. Use after implementing new features or reviewing PRs to ensure meaningful user actions are captured. Also handles initial PostHog SDK setup if not yet installed. |
| metadata | author: PostHog |
Use this skill to add product analytics events (capture calls) that track meaningful user actions in new or changed code. Use it after implementing features or reviewing PRs to ensure key user behaviors are captured. If PostHog is not yet installed, this skill also covers initial SDK setup. Supports any framework or language.
Supported frameworks: Next.js, React Router, Nuxt, Vue, TanStack Start, SvelteKit, Astro, Angular, Django, Flask, FastAPI, Laravel, Ruby on Rails, Android, iOS, React Native, Expo, and more.
Follow these steps IN ORDER:
STEP 1: Analyze the codebase and detect the platform.
STEP 2: Research integration. (Skip if PostHog is already set up.) 2.1. Find the reference file below that matches the detected framework — it is the source of truth for SDK initialization, provider setup, and event capture patterns. Read it now. 2.2. If no reference matches, fall back to your general knowledge and web search. Use posthog.com/docs as the primary search source.
STEP 3: Install the PostHog SDK. (Skip if PostHog is already set up.)
STEP 4: Initialize PostHog. (Skip if PostHog is already set up.)
STEP 5: Plan event tracking.
posthog.capture() code. Make note of event name formatting. Don't duplicate existing events; supplement them.STEP 6: Implement event capture.
posthog.capture() calls with useful properties.STEP 7: Identify users.
identify() calls on the client side during login and signup events. Use the contents of login and signup forms to identify users on submit.X-POSTHOG-DISTINCT-ID and X-POSTHOG-SESSION-ID headers to the server-side code. On the server side, make sure events have a matching distinct ID.STEP 8: Add error tracking.
STEP 9: Set up environment variables.
STEP 10: Verify and clean up.
references/EXAMPLE-next-app-router.md - next-app-router example project codereferences/EXAMPLE-next-pages-router.md - next-pages-router example project codereferences/EXAMPLE-react-react-router-6.md - react-react-router-6 example project codereferences/EXAMPLE-react-react-router-7-framework.md - react-react-router-7-framework example project codereferences/EXAMPLE-react-react-router-7-data.md - react-react-router-7-data example project codereferences/EXAMPLE-react-react-router-7-declarative.md - react-react-router-7-declarative example project codereferences/EXAMPLE-nuxt-3.6.md - nuxt-3.6 example project codereferences/EXAMPLE-nuxt-4.md - nuxt-4 example project codereferences/EXAMPLE-vue-3.md - vue-3 example project codereferences/EXAMPLE-react-tanstack-router-file-based.md - react-tanstack-router-file-based example project codereferences/EXAMPLE-react-tanstack-router-code-based.md - react-tanstack-router-code-based example project codereferences/EXAMPLE-tanstack-start.md - tanstack-start example project codereferences/EXAMPLE-sveltekit.md - sveltekit example project codereferences/EXAMPLE-astro-static.md - astro-static example project codereferences/EXAMPLE-astro-view-transitions.md - astro-view-transitions example project codereferences/EXAMPLE-astro-ssr.md - astro-ssr example project codereferences/EXAMPLE-astro-hybrid.md - astro-hybrid example project codereferences/EXAMPLE-angular.md - angular example project codereferences/EXAMPLE-django.md - django example project codereferences/EXAMPLE-flask.md - flask example project codereferences/EXAMPLE-fastapi.md - fastapi example project codereferences/EXAMPLE-python.md - python example project codereferences/EXAMPLE-laravel.md - laravel example project codereferences/EXAMPLE-ruby-on-rails.md - ruby-on-rails example project codereferences/EXAMPLE-ruby.md - ruby example project codereferences/EXAMPLE-android.md - android example project codereferences/EXAMPLE-swift.md - swift example project codereferences/EXAMPLE-react-native.md - react-native example project codereferences/EXAMPLE-expo.md - expo example project codereferences/next-js.md - Next.js - docsreferences/react-router-v6.md - React router v6 - docsreferences/react-router-v7-framework-mode.md - React router v7 framework mode (remix v3) - docsreferences/react-router-v7-data-mode.md - React router v7 data mode - docsreferences/react-router-v7-declarative-mode.md - React router v7 declarative mode - docsreferences/nuxt-js-3-6.md - Nuxt.js (v3.0 to v3.6) - docsreferences/nuxt-js.md - Nuxt.js - docsreferences/vue-js.md - Vue.js - docsreferences/tanstack-start.md - Tanstack start - docsreferences/svelte.md - Svelte - docsreferences/astro.md - Astro - docsreferences/angular.md - Angular - docsreferences/django.md - Django - docsreferences/flask.md - Flask - docsreferences/python.md - Python - docsreferences/posthog-python.md - PostHog python SDKreferences/laravel.md - Laravel - docsreferences/ruby-on-rails.md - Ruby on rails - docsreferences/ruby.md - Ruby - docsreferences/android.md - Android - docsreferences/ios.md - Ios - docsreferences/react-native.md - React native - docsreferences/identify-users.md - Identify users - docsEach framework reference contains SDK-specific installation, initialization, and usage patterns. Find the one matching the user's stack.
Prerequisites
Time Estimate
15-45 minutes depending on use case complexity
Steps
Common Pitfalls
✓ Do
✗ Don't
💡 Pro Tips
✓ Use when
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid when
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
PostHog/skills
PostHog/skills
PostHog/skills
PostHog/skills
PostHog/skills
PostHog/skills
Keeps context tight: instrument-product-analytics is the kind of skill you can hand to a new teammate without a long onboarding doc.
Registry listing for instrument-product-analytics matched our evaluation — installs cleanly and behaves as described in the markdown.
Useful defaults in instrument-product-analytics — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
instrument-product-analytics fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
instrument-product-analytics is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
instrument-product-analytics fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
I recommend instrument-product-analytics for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
instrument-product-analytics fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
instrument-product-analytics reduced setup friction for our internal harness; good balance of opinion and flexibility.
Solid pick for teams standardizing on skills: instrument-product-analytics is focused, and the summary matches what you get after install.
showing 1-10 of 73