bootstrap-posthog

Bootstrap PostHog analytics into a Phoenix 1.8 application with server-side and client-side tracking.

1|Updated May 7, 2026
One-click install
npx skills add https://github.com/agoodway/GoodSkills --skill bootstrap-posthog
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bootstrap-posthog
Source: https://github.com/agoodway/GoodSkills/tree/main/skills/bootstrap-posthog
Command: npx skills add https://github.com/agoodway/GoodSkills --skill bootstrap-posthog

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Instrumenting a Phoenix app for PostHog analytics is error-prone and time-consuming, especially when you need both server-side tracking and client-side page view handling.

Core Features & Use Cases

  • Server-side event tracking: Adds a PostHog wrapper module with event capture, user identification, and page view tracking helpers.
  • Automatic page view tracking: Inserts an analytics plug into the browser pipeline to track GET requests and ignores common non-page routes like assets and admin paths.
  • LiveView analytics support: Provides LiveView helper functions to track events from server code and push client-side tracking events.
  • Client-side PostHog integration: Updates the root layout with the PostHog JS snippet, including user identification logic, and hooks LiveView events to PostHog captures.
  • Environment configuration: Adds base and production configuration, plus .env.sample entries for POSTHOG_API_KEY and POSTHOG_API_URL.

Quick Start

Tell the assistant: "Bootstrap PostHog analytics for my Phoenix 1.8 app and configure event tracking for page views and user identification."

Frequently Asked Questions about bootstrap-posthog

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add PostHog analytics to a Phoenix LiveView application?

Add PostHog analytics to a Phoenix LiveView application by wiring server-side event capture, automatic page-view tracking, and client-side JS hooks into your router plugs and root layout. This provides unified event instrumentation across controllers and LiveView navigation.

What's the best way to track page views server-side in Phoenix without missing LiveView navigations?

Track page views server-side by inserting an analytics plug into the browser pipeline to capture GET requests, while using LiveView helper functions to push client-side tracking events during LiveView navigation. This ensures both initial loads and subsequent navigations are captured.

Does this PostHog integration require a specific Phoenix version?

Yes, this PostHog integration targets Phoenix 1.8 applications specifically. It configures the posthog dependency, analytics context, wrapper module, router plug, and root layout JS hooks designed for the Phoenix 1.8 application structure.

How do I identify users for event tracking in Phoenix controllers and LiveViews?

Identify users for event tracking by using the provided PostHog wrapper module for server-side user identification and updating the root layout with the PostHog JS snippet that includes user identification logic for client-side tracking.

How do I configure PostHog environment variables for my Phoenix app?

Configure PostHog environment variables by adding entries for POSTHOG_API_KEY and POSTHOG_API_URL to your .env.sample file, along with setting up base and production configuration files to securely manage your analytics credentials.

Can I ignore certain routes like assets when tracking page views in Phoenix?

Yes, the automatic page view tracking plug inserted into the browser pipeline tracks GET requests but ignores common non-page routes like assets and admin paths, preventing irrelevant server-side traffic from polluting your PostHog analytics data.