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_customer to conversion goals (#72301)

Javier Bahamondes18241138a1a6
diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.json
index c7dbb706d039..ca80fd55d289 100644
--- a/frontend/src/queries/schema.json
+++ b/frontend/src/queries/schema.json
@@ -14108,6 +14108,10 @@
"conversion_goal_name": {
"type": "string"
},
+ "counts_as_customer": {
+ "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"
+ },
"custom_name": {
"type": "string"
},
@@ -14194,6 +14198,10 @@
"conversion_goal_name": {
"type": "string"
},
+ "counts_as_customer": {
+ "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"
+ },
"custom_name": {
"type": "string"
},
@@ -14269,6 +14277,10 @@
"conversion_goal_name": {
"type": "string"
},
+ "counts_as_customer": {
+ "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"
+ },
"custom_name": {
"type": "string"
},
diff --git a/frontend/src/queries/schema/schema-general.ts b/frontend/src/queries/schema/schema-general.ts
index 5ab30fc940a6..2e5a70b99d66 100644
--- a/frontend/src/queries/schema/schema-general.ts
+++ b/frontend/src/queries/schema/schema-general.ts
@@ -6444,6 +6444,13 @@ export type ConversionGoalFilter = (EventsNode | ActionsNode | DataWarehouseNode
conversion_goal_id: string
conversion_goal_name: string
schema_map: SchemaMap
+ /**
+ * 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
}
export enum AttributionMode {
diff --git a/posthog/schema.py b/posthog/schema.py
index 304a5685b130..a3558175c784 100644
--- a/posthog/schema.py
+++ b/posthog/schema.py
@@ -13628,6 +13628,16 @@ class ConversionGoalFilter1(BaseModel):
)
conversion_goal_id: str
conversion_goal_name: str
+ counts_as_customer: bool | None = Field(
+ default=None,
+ 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."
+ ),
+ )
custom_name: str | None = None
event: str | None = Field(default=None, description="The event or `null` for all events.")
fixedProperties: list[AnyPropertyFilterDiscriminated] | None = Field(
@@ -13670,6 +13680,16 @@ class ConversionGoalFilter2(BaseModel):
)
conversion_goal_id: str
conversion_goal_name: str
+ counts_as_customer: bool | None = Field(
+ default=None,
+ 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."
+ ),
+ )
custom_name: str | None = None
fixedProperties: list[AnyPropertyFilterDiscriminated] | None = Field(
default=None,
@@ -13710,6 +13730,16 @@ class ConversionGoalFilter3(BaseModel):
)
conversion_goal_id: str
conversion_goal_name: str
+ counts_as_customer: bool | None = Field(
+ default=None,
+ 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."
+ ),
+ )
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 92ee93a4d3ba..7f8b0bd4bacf 100644
--- a/products/dashboards/frontend/generated/api.schemas.ts
+++ b/products/dashboards/frontend/generated/api.schemas.ts
@@ -6449,6 +6449,8 @@ export type ConversionGoalFilter1ApiSchemaMap = { [key: string]: string | unknow
export interface ConversionGoalFilter1Api {
conversion_goal_id: string
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
custom_name?: string | null
/** The event or `null` for all events. */
event?: string | null
@@ -6543,6 +6545,8 @@ export type ConversionGoalFilter2ApiSchemaMap = { [key: string]: string | unknow
export interface ConversionGoalFilter2Api {
conversion_goal_id: string
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
custom_name?: string | null
/** Fixed properties in the query, can't be edited in the interface (e.g. scoping down by person) */
fixedProperties?:
@@ -6633,6 +6637,8 @@ export type ConversionGoalFilter3ApiSchemaMap = { [key: string]: string | unknow
export interface ConversionGoalFilter3Api {
conversion_goal_id: string
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
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 76761ba11446..389a64f5ff18 100644
--- a/products/product_analytics/frontend/generated/api.schemas.ts
+++ b/products/product_analytics/frontend/generated/api.schemas.ts
@@ -5781,6 +5781,8 @@ export type ConversionGoalFilter1ApiSchemaMap = { [key: string]: string | unknow
export interface ConversionGoalFilter1Api {
conversion_goal_id: string
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
custom_name?: string | null
/** The event or `null` for all events. */
event?: string | null
@@ -5875,6 +5877,8 @@ export type ConversionGoalFilter2ApiSchemaMap = { [key: string]: string | unknow
export interface ConversionGoalFilter2Api {
conversion_goal_id: string
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
custom_name?: string | null
/** Fixed properties in the query, can't be edited in the interface (e.g. scoping down by person) */
fixedProperties?:
@@ -5965,6 +5969,8 @@ export type ConversionGoalFilter3ApiSchemaMap = { [key: string]: string | unknow
export interface ConversionGoalFilter3Api {
conversion_goal_id: string
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
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 3f00799502d0..ee35b7afeb1b 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -6411,6 +6411,8 @@ export namespace Schemas {
export interface ConversionGoalFilter1 {
conversion_goal_id: string;
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;
custom_name?: string | null;
/** The event or `null` for all events. */
event?: string | null;
@@ -6444,6 +6446,8 @@ export namespace Schemas {
export interface ConversionGoalFilter2 {
conversion_goal_id: string;
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;
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;
@@ -6473,6 +6477,8 @@ export namespace Schemas {
export interface ConversionGoalFilter3 {
conversion_goal_id: string;
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;
custom_name?: string | null;
distinct_id_field: string;
dw_source_type?: string | null;