modeling-product-usage-metrics

Build retention, stickiness, and lifecycle models in HogQL or dbt.

713|118|Updated Aug 11, 2020
One-click install
npx skills add https://github.com/PostHog/posthog-foss --skill modeling-product-usage-metrics
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: modeling-product-usage-metrics
Source: https://github.com/PostHog/posthog-foss/tree/main/products/data_modeling/skills/modeling-product-usage-metrics
Command: npx skills add https://github.com/PostHog/posthog-foss --skill modeling-product-usage-metrics

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Product teams need consistent, reusable definitions of engagement metrics — retention, stickiness, and lifecycle — but these are often re-implemented ad hoc in dashboards with inconsistent logic. This Skill provides tested SQL recipes to model all three on PostHog data-warehouse views (HogQL) or in an external dbt project.

Core Features & Use Cases

  • Retention matrix: Build a cohort matrix (entry period × intervals later × % retained) with recurring or cumulative definitions, in HogQL or as a dbt fct_retention mart.
  • Stickiness distribution: Bucket users by number of active intervals to surface power users and DAU/WAU/MAU shape via fct_stickiness or the HogQL stickiness recipe.
  • Lifecycle classification: Classify users per interval as new, returning, resurrecting, or dormant to judge growth quality and spot leaky buckets.
  • Use Case: A data analyst wants to know whether weekly active users keep coming back after signup. They use the HogQL retention recipe to build a reusable warehouse view, then feed it into activation-metric validation downstream.

Quick Start

Ask the AI to build a weekly retention model for your core action event using the PostHog HogQL retention recipe.

Frequently Asked Questions about modeling-product-usage-metrics

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

FAQPage Schema
How do I build a retention cohort matrix in SQL?

Group each person's activity by week, take their first active week as the cohort, then count distinct users active in each subsequent week. The Skill provides ready HogQL and dbt recipes computing retained counts and retention rates per cohort week and weeks-later offset.

What is the difference between retention, stickiness, and lifecycle metrics?

Retention measures whether users return after their first interval as a cohort matrix. Stickiness measures how many distinct intervals users were active, surfacing power users. Lifecycle classifies users per interval as new, returning, resurrecting, or dormant to judge growth quality.

Can I use these retention models with dbt instead of PostHog?

Yes, the Skill includes dbt recipes for fct_retention, fct_stickiness, and fct_lifecycle marts built on a stg_events staging model, plus a schema.yml with uniqueness and not-null data tests. The retention model uses dbt's cross-database datediff macro.

How do I calculate DAU/WAU/MAU stickiness from event data?

Count distinct active days per person over a trailing window such as 30 days, then bucket users by that count. The stickiness recipes produce this distribution directly, and the DAU/WAU or DAU/MAU ratio is a scalar summary of the same idea.

Why does my lifecycle model show users as new at the window edge?

The lifecycle query computes first activity within the analysis window only, so users active just before it appear as new at the left boundary. Extend the window one interval earlier if that boundary classification matters for your analysis.

When should I build a warehouse view instead of using PostHog's built-in retention insight?

Use the native retention, stickiness, or lifecycle insights for quick interactive analysis. Build HogQL views or dbt marts when the metric must be reused, joined with other models, or consumed downstream, such as by activation-metric validation.