/saas-builder:saas-analyticsfrom saas-builder
Set up PostHog analytics and product analysis for a SaaS application. Event tracking, user identification, feature flags, session replay, funnel analysis, and privacy-compliant configuration. Use this skill when the user wants anything related to user analytics, PostHog, event tracking, user behaviour, feature flags, A/B testing, conversion analysis, or metric tracking. Phrases like "set up analytics", "track users", "add PostHog", "create a feature flag" trigger this skill.
Ships in saas-builder. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
This skill sets up the analytics layer for a SaaS application. You can't improve what you can't see — understanding how users use your product, where they get stuck, and why they leave is the foundation of growth.
Dependency: This skill is applied alongside or after the deployment phase of the saas-launcher orchestrator skill. It can also be used independently.
Related skills:
PostHog vs. Google Analytics:
PostHog vs. Mixpanel:
PostHog vs. Plausible:
Conclusion: PostHog is the most balanced choice for SaaS — product analytics, feature flags, and session replay in one platform.
PostHog Cloud (recommended to start): Sign up, create a project, get your API key. Free tier: 1M events/month, 5K session recordings, 1M feature flag evaluations.
Self-host: Run on your own server with Docker Compose. Advantage: data is entirely yours, zero privacy concerns. Disadvantage: server management and update responsibility. Consider when you scale or if there's a legal requirement.
Install PostHog's official posthog-js library:
npm install posthog-js
Create a PostHog Provider: Write a provider as a client component. Add it to the root layout in the App Router. Environment variables:
NEXT_PUBLIC_POSTHOG_KEY — project API key (public)NEXT_PUBLIC_POSTHOG_HOST — PostHog instance URL (https://us.i.posthog.com or https://eu.i.posthog.com for cloud)Use the EU instance if you're working with GDPR compliance in mind — data stays in Europe.
Use the posthog-node library to send events from API routes and server components. Server-side tracking is especially needed for payment events, webhook processing, and background tasks.
Consistent event naming is critical. Chaotic names make analysis impossible.
Format: object_action — lowercase, separated by underscores.
user_signed_upplan_upgradedproject_createdcheckout_startedcheckout_completedAvoid: SignUp, user-sign-up, Signed Up, signup — inconsistent naming prevents analysis.
Events every SaaS should track:
Conversion funnel:
page_viewed (properties: path, referrer)signup_started (opened the signup form)user_signed_up (registration complete, properties: method — google/magic_link)checkout_started (selected a plan, properties: plan, period)checkout_completed (payment successful, properties: plan, amount)Product usage:
feature_used (properties: feature_name)project_created / project_deletedsettings_updatedChurn signals:
plan_cancelledplan_downgradedaccount_deletedMetadata that adds context to each event:
PostHog assigns an anonymous ID to every visitor. When a user logs in, link their real identity with posthog.identify(). This merges pre-login and post-login behaviour into a single profile.
Properties to send on identify:
Call identify in the auth callback — after a successful login, before redirecting to the dashboard.
In team/organisation-based SaaS, link users to groups. This lets you answer questions like "how many active users does this company have?" Not needed for single-user SaaS.
Use PostHog's built-in feature flags instead of a separate service (LaunchDarkly, Flagsmith) — no extra cost, naturally integrated with analytics, managed in the same dashboard.
Check feature flags in API routes as well as the UI. Client-side flag checks are for UX (hide/show UI); server-side checks are mandatory for security — client-side checks can be bypassed.
PostHog's session replay records a video of what the user did. A powerful tool for understanding bug reports, identifying UX issues, and observing user behaviour.
data-posthog-mask attribute to mask specific elementsWarning: Session replay consumes a lot of quota. The free plan includes 5K recordings/month — enabling it for all traffic will drain quickly. Lower the sampling rate or activate only on specific pages.
Growth:
Revenue:
Engagement:
Churn:
Create insights on your dashboard: trend graphs, funnels, retention analysis, user paths. Share with your team and establish a weekly review ritual.
identify() first, then send events. If the order is wrong, events remain anonymous and won't merge with the profile.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub carriegale2710/skills-library --plugin saas-builder12 skills in this plugin
/saas-api-securitySet up an API security layer for a SaaS application. Rate limiting, plan-based access control, input validation, error handling, CORS, and health checks. Use this skill when the user wants anything related to API security, rate limiting, authorisation, input validation, error handling, or API protection. Phrases like "secure the API", "add rate limiting", "check the plan", "input validation" trigger this skill.
/saas-authSet up the authentication layer of a SaaS application. Covers Google OAuth, Magic Link, email/password login, JWT session management, and middleware for protected routes. Use this skill when the user wants to add authentication, set up login, or configure user sessions.
/saas-Other plugins' skills for the same job