Back to GrowthCues Core
Semantic LayerBigQuerySegmentUser Lifecycle

The Standard dbt Model for User Lifecycle in BigQuery with Segment using GrowthCues Core

Standardize your User Lifecycle definitions. Explore the GrowthCues Core dbt model for robust User Lifecycle calculations from Segment data in BigQuery.

For: Analytics Engineers, Founders

Standardize your User Lifecycle definitions. Explore the GrowthCues Core dbt model for robust User Lifecycle calculations from Segment data in BigQuery.

The Context Problem: Eliminating the "Truth Gap" in GTM Metrics

In rapidly growing B2B SaaS companies, asking different departments "How many active accounts do we have?" often yields conflicting answers. Product might look at Amplitude, Sales at Salesforce, and Marketing at a custom spreadsheet. This "Truth Gap" stems from inconsistent metric definitions, leading to endless debates, manual reconciliation, and a lack of confidence in data-driven decisions.

GrowthCues Core provides a standardized, open-source dbt semantic layer to ensure a single, unambiguous definition for all your B2B GTM metrics, solving this "Truth Gap" once and for all.

Architecture: Standardized B2B Metrics with GrowthCues Core and dbt

This diagram illustrates how GrowthCues Core, built with dbt, transforms raw Segment events in your BigQuery into a standardized semantic layer, consumable by BI tools, AI agents, and all GTM teams.

The "GrowthCues Core" Code Block: Defining User Lifecycle

GrowthCues Core is an MIT-licensed dbt package that provides pre-built, industry-standard logic for calculating essential B2B GTM metrics, such as User Lifecycle. It promotes a "context as code" approach by defining metrics explicitly in dbt models and schema.yml.

Here’s a conceptual dbt model example for User Lifecycle within GrowthCues Core:

-- models/marts/core/fct_account_metrics_daily.sql (Simplified for User Lifecycle)

WITH accounts AS (
    SELECT * FROM {{ ref('dim_accounts') }}
),

daily_events AS (
    SELECT
        account_id,
        DATE(timestamp) as event_date,
        COUNT(*) as daily_event_count
    FROM {{ source('your_raw_schema', 'your_events_table') }} -- From Segment
    GROUP BY 1, 2
),

user-lifecycle_calculation AS (
    SELECT
        a.account_id,
        de.event_date as metric_date,
        -- Logic for User Lifecycle calculation
        -- Example for Account Stickiness (DAA/MAA)
        -- SUM(CASE WHEN de.daily_event_count > 0 THEN 1 ELSE 0 END) OVER (PARTITION BY a.account_id ORDER BY de.event_date ROWS BETWEEN 29 PRECEDING AND CURRENT ROW) AS monthly_active_days,
        -- More complex logic depending on User Lifecycle
        1 as placeholder_metric -- Replace with actual User Lifecycle logic
    FROM accounts a
    LEFT JOIN daily_events de ON a.account_id = de.account_id
    WHERE de.event_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 90 DAY) -- Optimize scans
)

SELECT * FROM user-lifecycle_calculation

And a corresponding schema.yml entry:

# models/marts/core/schema.yml (Simplified for User Lifecycle)
version: 2

models:
  - name: fct_account_metrics_daily
    description: "Daily account-level GTM metrics derived from raw product events."
    columns:
      - name: account_id
        description: "Unique identifier for the customer account."
      - name: metric_date
        description: "The date for which the metrics are calculated."
      - name: user-lifecycle
        description: >
          [Definition] User Lifecycle: Your precise definition here.
          [Formula] The specific calculation or derivation.
          [Context] How to interpret this metric, e.g., thresholds for healthy/at-risk.

Step-by-Step: Standardize Your Metrics with GrowthCues Core and dbt

  1. Integrate GrowthCues Core: Install the GrowthCues Core dbt package into your existing dbt project.
  2. Configure Data Sources: Adapt GrowthCues Core's source definitions to point to your raw Segment event tables in BigQuery.
  3. Run dbt Models: Execute dbt run to transform your raw data into clean, standardized GTM metrics tables (e.g., fct_account_metrics_daily, fct_user_metrics_daily) in your BigQuery.
  4. Leverage the Semantic Layer: The generated tables, with their rich metadata, now serve as a single source of truth for all your GTM reporting, accessible via BI tools, SQL queries, or AI agents.
  5. Empower Your Teams: Enable your Analytics Engineers, Founders to confidently use consistent definitions of User Lifecycle across all their analyses and decisions.

The GrowthCues Core Advantage: AI-Ready, Open-Source, and Standardized

  • AI-Ready Data: Eliminates LLM hallucinations by providing structured context directly in your data warehouse.
  • Standardized Metrics: Ensures a single source of truth for all B2B GTM metrics, solving the "Truth Gap."
  • Open-Source & Extensible: MIT-licensed, offering full transparency, control, and customization over your core GTM logic.
  • Reduced Maintenance: Replaces brittle custom SQL with robust, community-driven dbt models.

Further Reading

Ready to transform your BigQuery into a proactive GTM intelligence engine?

Star GrowthCues Core on GitHub

Ready to Build with GrowthCues Core?

Open-source dbt models for product-led GTM. Start building standardized, AI-ready metrics in your data warehouse.

View on GitHub

Open Source • MIT License • Community Supported