/app-stack:product-analyticsfrom app-stack
Sets up cookieless product analytics with Microsoft Clarity (default) or PostHog, including session recordings and heatmaps. Handles consent decisions and lets the agent read behavioral data without screenshots.
Ships in app-stack. 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.
Read when SKILL.md points to them.
Start the next round from what people did after release. Look at clicks, stopping points and things people never found. Set up analytics without analytics cookies, keeping only essential cookies, and let the agent read the data without asking for screenshots.
Every vendor fact carries the date it was read.
2026-10-29).references/posthog.md for anonymous, cookieless landing-page funnels and counts within a day. Queries count toward ordinary usage and AI-backed tools may incur charges. Retention, per-account use and experiments need an id that lasts (identify() or a stored id), which PostHog says makes it personal data and undoes cookieless mode. Ask the owner separately before adding a persistent id or expanding past the landing page, and build and review each as its own change. Apply legal-pages § Consent and cookie disclosure before adding cookies or any tag that requires consent.Off without a project id. An empty id means no script, no request and nothing to consent to (environments, optional feature switches). Development leaves it empty, so the owner's own testing never lands in the data.
Clarity's two halves, and only one of them is code.
window.clarity = window.clarity || function () { (window.clarity.q = window.clarity.q || []).push(arguments) }; window.clarity('consentv2', { ad_Storage: 'denied', analytics_Storage: 'denied' }). Called before the queue exists, the denial throws, and nothing else notices. Clarity then gives each page view its own id, writes no _clck or _clsk cookie, and cannot follow anyone between visits.2026-10-29).granted appears anywhere in the component or denial is not queued before adding the tag's script. With the test project's id (§ What the owner does by hand), a browser test first proves that script loaded. An unknown id gets an empty answer and loads nothing. Then visit every tagged page and read the cookie jar, localStorage, sessionStorage and IndexedDB. The privacy policy promises both halves, and a person can flip the dashboard setting. Where the local gate runs no vendor, the browser test is guarded live (the derive-tests skill: behind an explicit flag), skipping loudly without a test id, and the release-gate checklist runs it at each release that touches a tagged page or the tag. On production, the page's half is the same build the unit test held, and the dashboard's half shows only in the dashboard, so its screenshot is the evidence (§ What the owner does by hand, step 2).Add the analytics policy sentence with the tag and gate its rendering. Render it only when the project id is set, so no deploy names a tool that does not load. The legal test pins both states (apply legal-pages; ui-design, references/screens.md).
The Content-Security-Policy admits the tool's origins only once it is wired. Apply clerk-production for the CSP. Clarity's docs name *.clarity.ms and c.bing.com (read on 2026-10-29). For PostHog, use references/posthog.md.
Tag only the landing page, as a document of its own. Default to a standalone static landing document served outside the app's client router. Clarity follows the browser's same-document history and records page addresses and referrers (references/shared-app-router.md).
/ with an empty query and fragment. Require an empty referrer or an origin-only HTTP(S) referrer, and keep sensitive values out of links on the document. Leave the tag off when any check fails.Referrer-Policy: strict-origin across the site and verify the raw response on the landing page and a page reached through an id (apply clerk-production for the headers).references/shared-app-router.md for that setup. Keep its checks for same-document history, URLs, referrers, exit links, identity-provider imports and the paths the browser test walks. Keep the tag off where isolation cannot be proved.Tag another page only after the owner decides. Use the tool's strictest masking and state it in the policy.
The agent reads the data back itself. Use the vendor's MCP server. The agent uses a token the owner made (§ Reading it back). The token is an operator value, one per environment, never in the app's runtime (environments).
Prove the analytics tag follows the consent choice. Apply legal-pages § Consent and cookie disclosure for the banner, footer control and policy. Include them and the vendor settings below when explaining the change to the owner before adding a non-essential cookie. A unit test fails if the tag can load before consent. A browser test proves its scripts, requests and storage stay absent before acceptance and after refusal. When acceptance gates a cookieless tag, still queue storage denial before it starts and prove it runs cookieless.
List the owner's dashboard steps by name for the tool. Include the setting that turns cookies on if they are being added, the applicable data processing agreement, the data region and the retention period.
Read the data, answer the question and weigh it against each hypothesis. Apply propose. Clarity's server is the vendor's own (read on 2026-10-29). Add it at user or local scope, never to a committed MCP config, because the credential travels with it.
@microsoft/clarity-mcp-server, run locally with npx. It reads the owner's API token from the CLARITY_API_TOKEN environment variable (version 2.0.1, read on 2026-10-29), so the owner, with that variable loaded from the operator's file, adds the server in their own terminal as an environment value, never an argument: claude mcp add -e CLARITY_API_TOKEN="$CLARITY_API_TOKEN" --scope user clarity -- npx -y @microsoft/clarity-mcp-server. That leaves a plaintext copy in the owner's Claude Code configuration (~/.claude.json), so list it in the variables doc's copies table, and a rotation removes the server (claude mcp remove --scope user clarity) and adds it again with the new value (environments). Nobody pastes the token into the session. Its tools query the dashboard's metrics, list session recordings, and search Clarity's documentation. Clarity's export answers ten requests a project a day, about the previous one to three days, so a weekly read is seven daily reads, each kept in the repository's notes as counts and paths, with every id in an address replaced by :id; the agent spends the ten on the question asked, not on browsing.
For PostHog, follow references/posthog.md § Reading it back.Ask the owner for each dashboard action and decision by name. The agent wires the tag, denial, tests, CSP and policy line. These remain the owner's:
references/shared-app-router.md).For PostHog, use references/posthog.md § What the owner does by hand.
Decide consent and approve the policy line for either tool. For Clarity, Microsoft says it operates as a data controller, so there is no processor agreement to accept. The policy names Microsoft as a recipient acting as controller with its own privacy statement. Counsel decides how the product's own collection role is described (Clarity's FAQ, read on 2026-10-29). Apply legal-pages for the policy line.
Each rule's origin, the case that taught it, is in receipts.md beside this file; read it when a rule's edge is unclear.
Every tagged-page visit leaves no analytics cookie or stored browser id, and its recording appears in the dashboard. The agent answered a question about yesterday's visitors through MCP without asking the owner for a screenshot.
Related skills:
legal-pages (the policy line, consent and cookie disclosure)environments (empty means off; the token as an operator value)clerk-production (the CSP)propose (weighing what people did against each hypothesis)app-lifecycle (when to propose it: a landing page exists and the privacy page can promise it).What SKILL.md sets; muted values are Claude Code's defaults
2 plugins ship this exact skill · first indexed Nov 19, 2026
12 skills in this plugin
/app-lifecyclePlanning a SaaS stage, 'what's next', 'where are we', calling a stage done: the detailed path from an idea to production, each stage with its done-when./clerk-productionSetting up or changing Clerk sign-in, organizations, roles or billing on Next.js, or sign-in that does nothing or lands wrong: Clerk in production./embedded-agents'Add an agent', 'an AI assistant in the app', 'what may it do', 'agents that call agents', building, adding or wiring up an agent or agent chat in Next.js, 'Agent SDK', 'Managed Agents', 'hosted sandbox': design and build embedded Claude agents.npx claudepluginhub phuryn/product-engineering --plugin app-stackOther plugins' skills for the same job