integration-flask

Instrument Flask applications with PostHog analytics for events and exceptions.

Updated Feb 24, 2026
One-click install
npx skills add https://github.com/FrekiManagarm/dunlo --skill integration-flask-frekimanagarm
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: integration-flask
Source: https://github.com/FrekiManagarm/dunlo/tree/main/.agents/skills/integration-flask
Command: npx skills add https://github.com/FrekiManagarm/dunlo --skill integration-flask-frekimanagarm

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Integrates PostHog event analytics into a Flask codebase so you can reliably capture product usage, identify users, and track errors without breaking existing architecture.

Core Features & Use Cases

  • PostHog setup guide for Flask: Follow a step-by-step workflow to implement initialization and event capture in a Flask application.
  • Server-side event tracking patterns: Capture key actions (like signup, login, dashboard view) using PostHog’s Flask-compatible Python SDK patterns.
  • User identification & person properties: Use the correct distinct_id approach to associate backend events with logged-in users, while keeping PII out of event properties.
  • Manual error tracking: Capture exceptions intentionally (since Flask error handlers prevent default autocapture) to support actionable error analytics.
  • Reference implementations: Use the provided Flask example and framework notes to match the expected implementation style.

Quick Start

Use the integration-flask skill to instrument your Flask app by following the referenced step workflow starting with basic-integration-1.0-begin.md, and then implement the code changes for identification, events, and manual exception capture in the corresponding files.

Frequently Asked Questions about integration-flask

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

FAQPage Schema
How do I integrate PostHog analytics into a Flask application?

To integrate PostHog analytics into a Flask application, initialize the PostHog client in your create_app() function using environment variables for API keys, then implement server-side event capture and manual exception tracking in your routes.

How do I track server-side events in Flask using PostHog?

Track server-side events in Flask using PostHog by capturing key actions such as signups, logins, and dashboard views with the Flask-compatible Python SDK, ensuring you flush events via posthog_client.shutdown handling on app termination.

Why are exceptions not being captured by PostHog in my Flask app?

Exceptions are not captured automatically because Flask error handlers prevent default autocapture; you must implement manual exception tracking to intentionally capture errors and support actionable error analytics in PostHog.

How do I identify users in PostHog without exposing PII in Flask?

Identify users in PostHog by associating backend events with logged-in users using the correct distinct_id approach, while ensuring you keep all PII out of your event properties to maintain user privacy.

Can I use PostHog feature flags in a Flask backend?

Yes, you can use PostHog feature flags in a Flask backend by instrumenting your server-side routes to check flag states, enabling you to track feature-flag usage and manage rollout strategies directly within your Python application.

Do I need to hardcode PostHog API keys in my Flask app configuration?

No, you should avoid hardcoded secrets by loading PostHog API keys from environment variables during the create_app() initialization phase to maintain secure configuration and protect your analytics credentials.