Telemetry
SQL recipe collection

Product analytics SQL recipes

Build funnels, retention cohorts, active-user metrics, activation timing, feature adoption, churn, and upgrade analysis with SQL.

Common event contract

Fields that keep these queries reusable

  • timestamp_utc, event_name, user_id, team_id, and session_id
  • feature, source, plan, experiment_variant, and status
  • stable activation, retention, upgrade, and churn milestones

Definitions before SQL

Decisions the query cannot make for you

  1. 1Write one durable definition for activation and reuse it everywhere.
  2. 2Choose whether funnels count users, teams, sessions, or attempts.
  3. 3Keep anonymous and authenticated identity rules explicit.

Recommended sequence

Build detection first, then diagnosis

Analysis patterns

Make the result explain a decision

Define milestones first

Write durable definitions for signup, activation, adoption, retention, upgrade, and churn before calculating a funnel or cohort.

Choose the counting unit

Decide whether the analysis follows users, teams, sessions, accounts, or attempts and keep that unit consistent.

Compare like-for-like cohorts

Use complete observation windows and stable acquisition or experiment dimensions before interpreting a difference.

Complete recipes

Copy the query, then validate the assumptions

Intermediateproduct_events

Build a Signup-to-Activation Funnel in SQL

Calculate unique-user conversion through signup, onboarding, integration, and first-value milestones.

Where do new users leave before reaching first value?

See SQL and result
Advancedproduct_events

Calculate Weekly Cohort Retention

Group users by first activity week and measure the percentage returning in later weeks.

What percentage of each signup cohort returns in weeks one through twelve?

See SQL and result
Advancedproduct_events

Find Features Used Before Upgrade

Join feature events to upgrade events and rank behaviors that occur before paid conversion.

Which features are most commonly adopted before an account upgrades?

See SQL and result
Advancedproduct_events

Calculate DAU, WAU, and Product Stickiness

Measure daily and weekly active users together and calculate DAU-to-WAU stickiness from a consistent activity definition.

What share of weekly active users returns on an average day?

See SQL and result
Intermediateproduct_events

Compare Funnel Conversion by Acquisition Source

Measure signup-to-activation conversion by acquisition source while deduplicating repeated milestone events.

Which acquisition sources produce users who activate?

See SQL and result
Advancedproduct_events

Measure Time to Activation

Calculate the distribution of elapsed time between signup and a user’s first meaningful product action.

How long does it take new users to reach the first meaningful action?

See SQL and result
Advancedproduct_events

Measure Churn and Reactivation by Cohort

Classify accounts as retained, churned, or reactivated from recurring meaningful product activity.

How many accounts churned, stayed active, or returned this month?

See SQL and result
Advancedexperiment_events

Compare Experiment Conversion and Revenue Lift

Measure conversion, revenue per participant, and relative lift by experiment variant without double-counting repeated events.

Did the experiment improve conversion and revenue per assigned participant?

See SQL and result
Intermediateproduct_journey_events

Measure Product Journey Drop-Off by Session

Measure how many sessions reach each ordered product milestone and calculate both journey completion and step-to-step conversion.

Where do sessions leave the path from landing page to first query?

See SQL and result

Adapt the event contract before the threshold

Keep the analysis pattern, but validate table names, field types, business definitions, time windows, and minimum-volume rules against your own events. Every published query is also planned and executed against an empty typed table with the pinned engine.