posthog-analytics

posthog-analytics is a skill for Claude Code from nicepkg/ai-workflow. It costs 17 tokens per session (5,256 once invoked), scanned A, a copy of posthog-analytics, MIT.

A guide for implementing PostHog, a product analytics service that records user actions and presents them in dashboards.

In plain words
What is it for?
Add event tracking, user identification, feature flags, funnels, retention measures, and project-specific analytics dashboards.
Why use it?
It helps teams measure whether users reach value, where they drop out, and which features they use. It also covers identifying users and controlling feature availability with feature flags.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

Good fit Add event tracking, user identification, feature flags, funnels, retention measures, and project-specific analytics dashboards.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/nicepkg/ai-workflow/posthog-analytics
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add nicepkg/ai-workflow --skill posthog-analytics
Clone the repo
git clone --depth 1 https://github.com/nicepkg/ai-workflow

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for posthog-analytics

README.md
[![agentmods](https://agentmods.dev/badge/skills/nicepkg/ai-workflow/posthog-analytics/github.svg)](https://agentmods.dev/skills/nicepkg/ai-workflow/posthog-analytics)
Your own site
<a href="https://agentmods.dev/skills/nicepkg/ai-workflow/posthog-analytics"><img src="https://agentmods.dev/badge/skills/nicepkg/ai-workflow/posthog-analytics/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for posthog-analytics

Your own site · 80×15
<a href="https://agentmods.dev/skills/nicepkg/ai-workflow/posthog-analytics"><img src="https://agentmods.dev/badge/skills/nicepkg/ai-workflow/posthog-analytics.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 17 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,256 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 89% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00017 $0.05256
Opus 5.5 $0.00007 $0.02102
Sonnet 5.5 $0.00003 $0.01051
Haiku 4.5 $0.00002 $0.00526

Measured 2mo ago against content hash 9bc30ee06082, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

posthog-analytics scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

89% identical to posthog-analytics — 4 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

workflows/video-creator-workflow/.claude/skills/posthog-analytics/SKILL.md · 955 lines

How it starts

The opening of the file, as written. The whole thing — 955 lines — stays where its author put it; the contents beside it link to each section on GitHub.

PostHog Analytics Skill

Load with: base.md + [framework].md

For implementing product analytics with PostHog - event tracking, user identification, feature flags, and project-specific dashboards.

Sources: PostHog Docs | Product Analytics | Feature Flags


Philosophy

Measure what matters, not everything.

Analytics should answer specific questions:

  • Are users getting value? (activation, retention)
  • Where do users struggle? (funnels, drop-offs)
  • What features drive engagement? (feature usage)
  • Is the product growing? (acquisition, referrals)

Don't track everything. Track what informs decisions.


Installation

Next.js (App Router)

npm install posthog-js
// lib/posthog.ts
import posthog from 'posthog-js';

export function initPostHog() {
  if (typeof window !== 'undefined' && !posthog.__loaded) {
    posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY!, {
      api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST || 'https://us.i.posthog.com',
      person_profiles: 'identified_only', // Only create profiles for identified users
      capture_pageview: false, // We'll handle this manually for SPA
      capture_pageleave: true,
      loaded: (posthog) => {
        if (process.env.NODE_ENV === 'development') {
          posthog.debug();
        }
      },
    });
  }
  return posthog;
}

export { posthog };
// app/providers.tsx
'use client';

import { useEffect } from 'react';
import { usePathname, useSearchParams } from 'next/navigation';
import { initPostHog, posthog } from '@/lib/posthog';

export function PostHogProvider({ children }: { children: React.ReactNode }) {
  const pathname = usePathname();
  const searchParams = useSearchParams();

  useEffect(() => {
    initPostHog();
  }, []);

  // Track pageviews
  useEffect(() => {
    if (pathname) {
      let url = window.origin + pathname;
      if (searchParams.toString()) {
        url += `?${searchParams.toString()}`;
      }
      posthog.capture('$pageview', { $current_url: url });
    }
  }, [pathname, searchParams]);

  return <>{children}</>;
}

Read the full file on GitHub · 955 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago First seen · 955 lines · 17 tokens per session scan A 9bc30ee06082

Subscribe to this mod's changes

posthog-analytics is a skill published in the GitHub repository nicepkg/ai-workflow (298 stars, last pushed 10mo ago), licensed MIT. It adds 17 tokens to every session and 5,256 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 89% identical to posthog-analytics, differing in 4 lines, and is treated as a copy.

Related

posthog-analytics compared with skills from other repositories

posthog-analytics next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
posthog-analyticsnicepkg/ai-workflowSkill29810mo agoMITA17Claude Code
headroomheadroomlabs-ai/headroomSkill81ktodayApache-2.0A76Claude Code
html-artifactslangchain-ai/open-sweSkill11ktodayMITA52Claude Code, Codex
hive.slack-notifications-setupaden-hive/hiveSkill11kyesterdayApache-2.0A136Claude Code, Codex
hive.chart-creation-foundationsaden-hive/hiveSkill11kyesterdayApache-2.0A133Claude Code, Codex
browser-edge-casesaden-hive/hiveSkill11kyesterdayApache-2.0A40Claude Code
hive.pdfaden-hive/hiveSkill11kyesterdayApache-2.0A98Claude Code, Codex