Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(marketing-analytics): add counts_as_revenue to conversion goals (#72798)

Javier Bahamondes18cd1c8f858b
diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.json
index 8c7e6fb38a3a..9d6b5caf5512 100644
--- a/frontend/src/queries/schema.json
+++ b/frontend/src/queries/schema.json
@@ -14112,6 +14112,10 @@
"description": "Marks this goal as customer-defining: a conversion here means the person became a customer (e.g. a payment or subscription), not an intermediate step like a sign up. It gates customer-based metrics such as CAC and LTV:CAC, whose denominator is new customers (counted once per person via first_time_for_user) rather than every conversion. Defaults to false.",
"type": "boolean"
},
+ "counts_as_revenue": {
+ "description": "Marks this goal as revenue-bearing: the value of a conversion is a monetary amount, not a count or an arbitrary numeric property. It gates revenue metrics such as ROAS and LTV:CAC. The amount itself comes from math_property, and its currency from math_property_revenue_currency, the same shape Revenue analytics uses for revenue events. Independent of counts_as_customer: a purchase is usually both, a trial signup neither. Defaults to false.",
+ "type": "boolean"
+ },
"custom_name": {
"type": "string"
},
@@ -14202,6 +14206,10 @@
"description": "Marks this goal as customer-defining: a conversion here means the person became a customer (e.g. a payment or subscription), not an intermediate step like a sign up. It gates customer-based metrics such as CAC and LTV:CAC, whose denominator is new customers (counted once per person via first_time_for_user) rather than every conversion. Defaults to false.",
"type": "boolean"
},
+ "counts_as_revenue": {
+ "description": "Marks this goal as revenue-bearing: the value of a conversion is a monetary amount, not a count or an arbitrary numeric property. It gates revenue metrics such as ROAS and LTV:CAC. The amount itself comes from math_property, and its currency from math_property_revenue_currency, the same shape Revenue analytics uses for revenue events. Independent of counts_as_customer: a purchase is usually both, a trial signup neither. Defaults to false.",
+ "type": "boolean"
+ },
"custom_name": {
"type": "string"
},
@@ -14281,6 +14289,10 @@
"description": "Marks this goal as customer-defining: a conversion here means the person became a customer (e.g. a payment or subscription), not an intermediate step like a sign up. It gates customer-based metrics such as CAC and LTV:CAC, whose denominator is new customers (counted once per person via first_time_for_user) rather than every conversion. Defaults to false.",
"type": "boolean"
},
+ "counts_as_revenue": {
+ "description": "Marks this goal as revenue-bearing: the value of a conversion is a monetary amount, not a count or an arbitrary numeric property. It gates revenue metrics such as ROAS and LTV:CAC. The amount itself comes from math_property, and its currency from math_property_revenue_currency, the same shape Revenue analytics uses for revenue events. Independent of counts_as_customer: a purchase is usually both, a trial signup neither. Defaults to false.",
+ "type": "boolean"
+ },
"custom_name": {
"type": "string"
},
diff --git a/frontend/src/queries/schema/schema-general.ts b/frontend/src/queries/schema/schema-general.ts
index 86a75d7f3e8d..0bbb72079d50 100644
--- a/frontend/src/queries/schema/schema-general.ts
+++ b/frontend/src/queries/schema/schema-general.ts
@@ -6451,6 +6451,15 @@ export type ConversionGoalFilter = (EventsNode | ActionsNode | DataWarehouseNode
* once per person via first_time_for_user) rather than every conversion. Defaults to false.
*/
counts_as_customer?: boolean
+ /**
+ * Marks this goal as revenue-bearing: the value of a conversion is a monetary amount, not a
+ * count or an arbitrary numeric property. It gates revenue metrics such as ROAS and LTV:CAC.
+ * The amount itself comes from math_property, and its currency from
+ * math_property_revenue_currency, the same shape Revenue analytics uses for revenue events.
+ * Independent of counts_as_customer: a purchase is usually both, a trial signup neither.
+ * Defaults to false.
+ */
+ counts_as_revenue?: boolean
}
export enum AttributionMode {
diff --git a/posthog/schema.py b/posthog/schema.py
index a3558175c784..ed93f0f9562e 100644
--- a/posthog/schema.py
+++ b/posthog/schema.py
@@ -13638,6 +13638,18 @@ class ConversionGoalFilter1(BaseModel):
" first_time_for_user) rather than every conversion. Defaults to false."
),
)
+ counts_as_revenue: bool | None = Field(
+ default=None,
+ description=(
+ "Marks this goal as revenue-bearing: the value of a conversion is a"
+ " monetary amount, not a count or an arbitrary numeric property. It gates"
+ " revenue metrics such as ROAS and LTV:CAC. The amount itself comes from"
+ " math_property, and its currency from math_property_revenue_currency, the"
+ " same shape Revenue analytics uses for revenue events. Independent of"
+ " counts_as_customer: a purchase is usually both, a trial signup neither."
+ " Defaults to false."
+ ),
+ )
custom_name: str | None = None
event: str | None = Field(default=None, description="The event or `null` for all events.")
fixedProperties: list[AnyPropertyFilterDiscriminated] | None = Field(
@@ -13690,6 +13702,18 @@ class ConversionGoalFilter2(BaseModel):
" first_time_for_user) rather than every conversion. Defaults to false."
),
)
+ counts_as_revenue: bool | None = Field(
+ default=None,
+ description=(
+ "Marks this goal as revenue-bearing: the value of a conversion is a"
+ " monetary amount, not a count or an arbitrary numeric property. It gates"
+ " revenue metrics such as ROAS and LTV:CAC. The amount itself comes from"
+ " math_property, and its currency from math_property_revenue_currency, the"
+ " same shape Revenue analytics uses for revenue events. Independent of"
+ " counts_as_customer: a purchase is usually both, a trial signup neither."
+ " Defaults to false."
+ ),
+ )
custom_name: str | None = None
fixedProperties: list[AnyPropertyFilterDiscriminated] | None = Field(
default=None,
@@ -13740,6 +13764,18 @@ class ConversionGoalFilter3(BaseModel):
" first_time_for_user) rather than every conversion. Defaults to false."
),
)
+ counts_as_revenue: bool | None = Field(
+ default=None,
+ description=(
+ "Marks this goal as revenue-bearing: the value of a conversion is a"
+ " monetary amount, not a count or an arbitrary numeric property. It gates"
+ " revenue metrics such as ROAS and LTV:CAC. The amount itself comes from"
+ " math_property, and its currency from math_property_revenue_currency, the"
+ " same shape Revenue analytics uses for revenue events. Independent of"
+ " counts_as_customer: a purchase is usually both, a trial signup neither."
+ " Defaults to false."
+ ),
+ )
custom_name: str | None = None
distinct_id_field: str
dw_source_type: str | None = None
diff --git a/products/dashboards/frontend/generated/api.schemas.ts b/products/dashboards/frontend/generated/api.schemas.ts
index 977c7d9e8ecc..2639a6ea8d84 100644
--- a/products/dashboards/frontend/generated/api.schemas.ts
+++ b/products/dashboards/frontend/generated/api.schemas.ts
@@ -6451,6 +6451,8 @@ export interface ConversionGoalFilter1Api {
conversion_goal_name: string
/** Marks this goal as customer-defining: a conversion here means the person became a customer (e.g. a payment or subscription), not an intermediate step like a sign up. It gates customer-based metrics such as CAC and LTV:CAC, whose denominator is new customers (counted once per person via first_time_for_user) rather than every conversion. Defaults to false. */
counts_as_customer?: boolean | null
+ /** Marks this goal as revenue-bearing: the value of a conversion is a monetary amount, not a count or an arbitrary numeric property. It gates revenue metrics such as ROAS and LTV:CAC. The amount itself comes from math_property, and its currency from math_property_revenue_currency, the same shape Revenue analytics uses for revenue events. Independent of counts_as_customer: a purchase is usually both, a trial signup neither. Defaults to false. */
+ counts_as_revenue?: boolean | null
custom_name?: string | null
/** The event or `null` for all events. */
event?: string | null
@@ -6547,6 +6549,8 @@ export interface ConversionGoalFilter2Api {
conversion_goal_name: string
/** Marks this goal as customer-defining: a conversion here means the person became a customer (e.g. a payment or subscription), not an intermediate step like a sign up. It gates customer-based metrics such as CAC and LTV:CAC, whose denominator is new customers (counted once per person via first_time_for_user) rather than every conversion. Defaults to false. */
counts_as_customer?: boolean | null
+ /** Marks this goal as revenue-bearing: the value of a conversion is a monetary amount, not a count or an arbitrary numeric property. It gates revenue metrics such as ROAS and LTV:CAC. The amount itself comes from math_property, and its currency from math_property_revenue_currency, the same shape Revenue analytics uses for revenue events. Independent of counts_as_customer: a purchase is usually both, a trial signup neither. Defaults to false. */
+ counts_as_revenue?: boolean | null
custom_name?: string | null
/** Fixed properties in the query, can't be edited in the interface (e.g. scoping down by person) */
fixedProperties?:
@@ -6639,6 +6643,8 @@ export interface ConversionGoalFilter3Api {
conversion_goal_name: string
/** Marks this goal as customer-defining: a conversion here means the person became a customer (e.g. a payment or subscription), not an intermediate step like a sign up. It gates customer-based metrics such as CAC and LTV:CAC, whose denominator is new customers (counted once per person via first_time_for_user) rather than every conversion. Defaults to false. */
counts_as_customer?: boolean | null
+ /** Marks this goal as revenue-bearing: the value of a conversion is a monetary amount, not a count or an arbitrary numeric property. It gates revenue metrics such as ROAS and LTV:CAC. The amount itself comes from math_property, and its currency from math_property_revenue_currency, the same shape Revenue analytics uses for revenue events. Independent of counts_as_customer: a purchase is usually both, a trial signup neither. Defaults to false. */
+ counts_as_revenue?: boolean | null
custom_name?: string | null
distinct_id_field: string
dw_source_type?: string | null
diff --git a/products/product_analytics/frontend/generated/api.schemas.ts b/products/product_analytics/frontend/generated/api.schemas.ts
index 034e7f04908d..3c14d3969305 100644
--- a/products/product_analytics/frontend/generated/api.schemas.ts
+++ b/products/product_analytics/frontend/generated/api.schemas.ts
@@ -5783,6 +5783,8 @@ export interface ConversionGoalFilter1Api {
conversion_goal_name: string
/** Marks this goal as customer-defining: a conversion here means the person became a customer (e.g. a payment or subscription), not an intermediate step like a sign up. It gates customer-based metrics such as CAC and LTV:CAC, whose denominator is new customers (counted once per person via first_time_for_user) rather than every conversion. Defaults to false. */
counts_as_customer?: boolean | null
+ /** Marks this goal as revenue-bearing: the value of a conversion is a monetary amount, not a count or an arbitrary numeric property. It gates revenue metrics such as ROAS and LTV:CAC. The amount itself comes from math_property, and its currency from math_property_revenue_currency, the same shape Revenue analytics uses for revenue events. Independent of counts_as_customer: a purchase is usually both, a trial signup neither. Defaults to false. */
+ counts_as_revenue?: boolean | null
custom_name?: string | null
/** The event or `null` for all events. */
event?: string | null
@@ -5879,6 +5881,8 @@ export interface ConversionGoalFilter2Api {
conversion_goal_name: string
/** Marks this goal as customer-defining: a conversion here means the person became a customer (e.g. a payment or subscription), not an intermediate step like a sign up. It gates customer-based metrics such as CAC and LTV:CAC, whose denominator is new customers (counted once per person via first_time_for_user) rather than every conversion. Defaults to false. */
counts_as_customer?: boolean | null
+ /** Marks this goal as revenue-bearing: the value of a conversion is a monetary amount, not a count or an arbitrary numeric property. It gates revenue metrics such as ROAS and LTV:CAC. The amount itself comes from math_property, and its currency from math_property_revenue_currency, the same shape Revenue analytics uses for revenue events. Independent of counts_as_customer: a purchase is usually both, a trial signup neither. Defaults to false. */
+ counts_as_revenue?: boolean | null
custom_name?: string | null
/** Fixed properties in the query, can't be edited in the interface (e.g. scoping down by person) */
fixedProperties?:
@@ -5971,6 +5975,8 @@ export interface ConversionGoalFilter3Api {
conversion_goal_name: string
/** Marks this goal as customer-defining: a conversion here means the person became a customer (e.g. a payment or subscription), not an intermediate step like a sign up. It gates customer-based metrics such as CAC and LTV:CAC, whose denominator is new customers (counted once per person via first_time_for_user) rather than every conversion. Defaults to false. */
counts_as_customer?: boolean | null
+ /** Marks this goal as revenue-bearing: the value of a conversion is a monetary amount, not a count or an arbitrary numeric property. It gates revenue metrics such as ROAS and LTV:CAC. The amount itself comes from math_property, and its currency from math_property_revenue_currency, the same shape Revenue analytics uses for revenue events. Independent of counts_as_customer: a purchase is usually both, a trial signup neither. Defaults to false. */
+ counts_as_revenue?: boolean | null
custom_name?: string | null
distinct_id_field: string
dw_source_type?: string | null
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 5a72db8cb9d7..2493e0367eea 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -6413,6 +6413,8 @@ export namespace Schemas {
conversion_goal_name: string;
/** Marks this goal as customer-defining: a conversion here means the person became a customer (e.g. a payment or subscription), not an intermediate step like a sign up. It gates customer-based metrics such as CAC and LTV:CAC, whose denominator is new customers (counted once per person via first_time_for_user) rather than every conversion. Defaults to false. */
counts_as_customer?: boolean | null;
+ /** Marks this goal as revenue-bearing: the value of a conversion is a monetary amount, not a count or an arbitrary numeric property. It gates revenue metrics such as ROAS and LTV:CAC. The amount itself comes from math_property, and its currency from math_property_revenue_currency, the same shape Revenue analytics uses for revenue events. Independent of counts_as_customer: a purchase is usually both, a trial signup neither. Defaults to false. */
+ counts_as_revenue?: boolean | null;
custom_name?: string | null;
/** The event or `null` for all events. */
event?: string | null;
@@ -6448,6 +6450,8 @@ export namespace Schemas {
conversion_goal_name: string;
/** Marks this goal as customer-defining: a conversion here means the person became a customer (e.g. a payment or subscription), not an intermediate step like a sign up. It gates customer-based metrics such as CAC and LTV:CAC, whose denominator is new customers (counted once per person via first_time_for_user) rather than every conversion. Defaults to false. */
counts_as_customer?: boolean | null;
+ /** Marks this goal as revenue-bearing: the value of a conversion is a monetary amount, not a count or an arbitrary numeric property. It gates revenue metrics such as ROAS and LTV:CAC. The amount itself comes from math_property, and its currency from math_property_revenue_currency, the same shape Revenue analytics uses for revenue events. Independent of counts_as_customer: a purchase is usually both, a trial signup neither. Defaults to false. */
+ counts_as_revenue?: boolean | null;
custom_name?: string | null;
/** Fixed properties in the query, can't be edited in the interface (e.g. scoping down by person) */
fixedProperties?: (EventPropertyFilter | PersonPropertyFilter | PersonMetadataPropertyFilter | ElementPropertyFilter | EventMetadataPropertyFilter | SessionPropertyFilter | CohortPropertyFilter | RecordingPropertyFilter | LogEntryPropertyFilter | GroupPropertyFilter | FeaturePropertyFilter | FlagPropertyFilter | HogQLPropertyFilter | EmptyPropertyFilter | DataWarehousePropertyFilter | DataWarehousePersonPropertyFilter | ErrorTrackingIssueFilter | LogPropertyFilter | MetricPropertyFilter | SpanPropertyFilter | RevenueAnalyticsPropertyFilter | AccountCustomPropertyFilter | WorkflowVariablePropertyFilter)[] | null;
@@ -6479,6 +6483,8 @@ export namespace Schemas {
conversion_goal_name: string;
/** Marks this goal as customer-defining: a conversion here means the person became a customer (e.g. a payment or subscription), not an intermediate step like a sign up. It gates customer-based metrics such as CAC and LTV:CAC, whose denominator is new customers (counted once per person via first_time_for_user) rather than every conversion. Defaults to false. */
counts_as_customer?: boolean | null;
+ /** Marks this goal as revenue-bearing: the value of a conversion is a monetary amount, not a count or an arbitrary numeric property. It gates revenue metrics such as ROAS and LTV:CAC. The amount itself comes from math_property, and its currency from math_property_revenue_currency, the same shape Revenue analytics uses for revenue events. Independent of counts_as_customer: a purchase is usually both, a trial signup neither. Defaults to false. */
+ counts_as_revenue?: boolean | null;
custom_name?: string | null;
distinct_id_field: string;
dw_source_type?: string | null;