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(experiments): add activation event exposure criteria (#78841)

Andersc9473120aafe
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index 5ac75cf0593c..309b6ba0afd1 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -189,6 +189,7 @@ export const FEATURE_FLAGS = {
BATCH_EXPORT_EARLIEST_BACKFILL: 'batch-export-earliest-backfill', // owner: #team-batch-exports, allow backfilling from beginning of time
CONTROL_SUPPORT_LOGIN: 'control_support_login', // owner: #team-security, used to control whether users can opt out of support impersonation
CUSTOM_CSS_THEMES: 'custom-css-themes', // owner: #team-growth, used to enable custom CSS for teams who want to have fun
+ EXPERIMENT_ACTIVATION_EVENT: 'experiment-activation-event', // owner: #team-experiments, offers an activation event on top of the default exposure instead of legacy custom exposure events
EXPERIMENT_EXPOSURE_EVENT: 'experiment-exposure-event', // owner: #team-experiments, switches new experiments to the dedicated exposure event
GAME_CENTER: 'game-center', // owner: everybody, this is just internal for now
HEDGEHOG_SKIN_SPIDERHOG: 'hedgehog-skin-spiderhog', // owner: #team-web-analytics, used to reward beta users for web analytics
diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.json
index d9a8962cd4c5..d57433711f7d 100644
--- a/frontend/src/queries/schema.json
+++ b/frontend/src/queries/schema.json
@@ -21668,6 +21668,10 @@
"additionalProperties": false,
"description": "Exposure criteria for experiment API payloads.",
"properties": {
+ "activation_config": {
+ "$ref": "#/definitions/ExperimentApiExposureConfig",
+ "description": "Additional event (or action) an entity must emit at/after their first default exposure event before they count as exposed; exposure time becomes this event's timestamp. Only valid with the default exposure event, not a custom `exposure_config`."
+ },
"exposure_config": {
"$ref": "#/definitions/ExperimentApiExposureConfig"
},
@@ -21942,6 +21946,10 @@
"ExperimentExposureCriteria": {
"additionalProperties": false,
"properties": {
+ "activation_config": {
+ "$ref": "#/definitions/ExperimentExposureConfig",
+ "description": "Additional event (or action) an entity must emit at/after their first default exposure event before they count as exposed; exposure time becomes this event's timestamp. Only valid with the default exposure event, not a custom `exposure_config`."
+ },
"exposure_config": {
"$ref": "#/definitions/ExperimentExposureConfig"
},
diff --git a/frontend/src/queries/schema/schema-general.ts b/frontend/src/queries/schema/schema-general.ts
index 3c59f6a229da..606811c1b67d 100644
--- a/frontend/src/queries/schema/schema-general.ts
+++ b/frontend/src/queries/schema/schema-general.ts
@@ -4636,6 +4636,10 @@ export type ExperimentExposureConfig = ExperimentEventExposureConfig | ActionsNo
export interface ExperimentExposureCriteria {
filterTestAccounts?: boolean
exposure_config?: ExperimentExposureConfig
+ /** Additional event (or action) an entity must emit at/after their first default exposure
+ * event before they count as exposed; exposure time becomes this event's timestamp.
+ * Only valid with the default exposure event, not a custom `exposure_config`. */
+ activation_config?: ExperimentExposureConfig
multiple_variant_handling?: 'exclude' | 'first_seen'
}
@@ -4786,6 +4790,10 @@ export interface ExperimentApiExposureConfig {
export interface ExperimentApiExposureCriteria {
filterTestAccounts?: boolean
exposure_config?: ExperimentApiExposureConfig
+ /** Additional event (or action) an entity must emit at/after their first default exposure
+ * event before they count as exposed; exposure time becomes this event's timestamp.
+ * Only valid with the default exposure event, not a custom `exposure_config`. */
+ activation_config?: ExperimentApiExposureConfig
/** How to handle entities exposed to multiple variants. 'exclude' (default) drops them from
* the analysis; 'first_seen' assigns them to the variant from their earliest exposure. */
multiple_variant_handling?: 'exclude' | 'first_seen'
diff --git a/frontend/src/scenes/experiments/ExperimentForm/ExposureCriteriaPanel.tsx b/frontend/src/scenes/experiments/ExperimentForm/ExposureCriteriaPanel.tsx
index e1c9def4f243..fcc6a8308d8b 100644
--- a/frontend/src/scenes/experiments/ExperimentForm/ExposureCriteriaPanel.tsx
+++ b/frontend/src/scenes/experiments/ExperimentForm/ExposureCriteriaPanel.tsx
@@ -17,6 +17,7 @@ import {
EXPERIMENT_EXPOSURE_EVENT,
EXPOSURE_DEFAULT_EVENT,
exposureEventLabel,
+ getActivationConfig,
resolvedExposureEvent,
} from '../exposureContract'
import { commonActionFilterProps } from '../Metrics/Selectors'
@@ -28,6 +29,12 @@ const DEFAULT_EXPOSURE_CONFIG: ExperimentEventExposureConfig = {
properties: [],
}
+const DEFAULT_ACTIVATION_CONFIG: ExperimentEventExposureConfig = {
+ kind: NodeKind.ExperimentEventExposureConfig,
+ event: '$pageview',
+ properties: [],
+}
+
type ExposureCriteriaPanelProps = {
experiment: Experiment
onChange: (exposureCriteria: ExperimentExposureCriteria) => void
@@ -64,18 +71,55 @@ function InclusionActionFilter({
)
}
+function ActivationActionFilter({
+ experiment,
+ onChange,
+}: {
+ experiment: Experiment
+ onChange: ExposureCriteriaPanelProps['onChange']
+}): JSX.Element {
+ return (
+ <ActionFilter
+ bordered
+ filters={exposureConfigToFilter(
+ experiment.exposure_criteria?.activation_config || DEFAULT_ACTIVATION_CONFIG
+ )}
+ setFilters={({ events, actions }: Partial<FilterType>): void => {
+ const entity = events?.[0] || actions?.[0]
+ if (entity) {
+ onChange({ activation_config: filterToExposureConfig(entity) })
+ }
+ }}
+ typeKey="experiment-activation-config"
+ buttonCopy="Add activation event"
+ showSeriesIndicator={false}
+ hideRename={true}
+ entitiesLimit={1}
+ mathAvailability={MathAvailability.None}
+ showNumericalPropsOnly={false}
+ actionsTaxonomicGroupTypes={[TaxonomicFilterGroupType.Events, TaxonomicFilterGroupType.Actions]}
+ propertiesTaxonomicGroupTypes={commonActionFilterProps.propertiesTaxonomicGroupTypes}
+ />
+ )
+}
+
function ExposureCriteriaFields({
experiment,
onChange,
hasFilters,
defaultExposureEvent,
+ showActivationOption,
}: {
experiment: Experiment
onChange: ExposureCriteriaPanelProps['onChange']
hasFilters: boolean
defaultExposureEvent: string
+ showActivationOption: boolean
}): JSX.Element {
- const isCustom = !!experiment.exposure_criteria?.exposure_config
+ // getActivationConfig, not a raw field check: a stored default-sentinel exposure_config
+ // still composes with activation, and the editor must classify it the way the backend does
+ const isActivation = !!getActivationConfig(experiment.exposure_criteria)
+ const isCustom = !isActivation && !!experiment.exposure_criteria?.exposure_config
return (
<div className="space-y-4">
@@ -90,11 +134,31 @@ function ExposureCriteriaFields({
<strong>exposed</strong> to the experiment.
</>
}
- selected={!isCustom}
+ selected={!isCustom && !isActivation}
onClick={() => {
- onChange({ exposure_config: undefined })
+ onChange({ exposure_config: undefined, activation_config: undefined })
}}
/>
+ {(showActivationOption || isActivation) && (
+ <SelectableCard
+ title="Activation event"
+ description={
+ <>
+ Require an additional event after <LemonTag>{defaultExposureEvent}</LemonTag>. Users
+ enter the analysis when this event follows their first exposure, and metrics count from
+ the activation event.
+ </>
+ }
+ selected={isActivation}
+ onClick={() => {
+ // Re-clicking the selected card must not reset a configured event
+ if (isActivation) {
+ return
+ }
+ onChange({ exposure_config: undefined, activation_config: DEFAULT_ACTIVATION_CONFIG })
+ }}
+ />
+ )}
<SelectableCard
title="Custom"
description={
@@ -105,8 +169,13 @@ function ExposureCriteriaFields({
}
selected={isCustom}
onClick={() => {
+ // Re-clicking the selected card must not reset a configured event
+ if (isCustom) {
+ return
+ }
onChange({
exposure_config: DEFAULT_EXPOSURE_CONFIG,
+ activation_config: undefined,
})
}}
/>
@@ -117,6 +186,11 @@ function ExposureCriteriaFields({
<InclusionActionFilter experiment={experiment} onChange={onChange} />
</div>
)}
+ {isActivation && (
+ <div className="mb-4">
+ <ActivationActionFilter experiment={experiment} onChange={onChange} />
+ </div>
+ )}
{/* Multiple Variant Handling */}
<div>
@@ -165,7 +239,13 @@ function ExposureCriteriaFields({
}
export function ExposureCriteriaPanel({ experiment, onChange, compact }: ExposureCriteriaPanelProps): JSX.Element {
- const isCustom = !!experiment.exposure_criteria?.exposure_config
+ // getActivationConfig, not a raw field check: a stored default-sentinel exposure_config
+ // still composes with activation, and the editor must classify it the way the backend does
+ const isActivation = !!getActivationConfig(experiment.exposure_criteria)
+ const isCustom = !isActivation && !!experiment.exposure_criteria?.exposure_config
+ const activationEventEnabled = useFeatureFlag('EXPERIMENT_ACTIVATION_EVENT')
+ // Keep an existing activation config editable even if the team is no longer flagged in
+ const showActivationOption = activationEventEnabled || isActivation
const experimentExposureEventEnabled = useFeatureFlag('EXPERIMENT_EXPOSURE_EVENT')
const defaultExposureEvent = resolvedExposureEvent(
experiment,
@@ -186,14 +266,24 @@ export function ExposureCriteriaPanel({ experiment, onChange, compact }: Exposur
size="small"
dropdownMatchSelectWidth={false}
dropdownPlacement="bottom-end"
- value={isCustom ? 'custom' : 'default'}
+ value={isCustom ? 'custom' : isActivation ? 'activation' : 'default'}
onChange={(value) => {
+ // Re-selecting the current mode must not reset a configured event
+ if ((value === 'custom' && isCustom) || (value === 'activation' && isActivation)) {
+ return
+ }
if (value === 'custom') {
onChange({
exposure_config: DEFAULT_EXPOSURE_CONFIG,
+ activation_config: undefined,
+ })
+ } else if (value === 'activation') {
+ onChange({
+ exposure_config: undefined,
+ activation_config: DEFAULT_ACTIVATION_CONFIG,
})
} else {
- onChange({ exposure_config: undefined })
+ onChange({ exposure_config: undefined, activation_config: undefined })
}
}}
options={[
@@ -209,6 +299,22 @@ export function ExposureCriteriaPanel({ experiment, onChange, compact }: Exposur
</div>
),
},
+ ...(showActivationOption
+ ? [
+ {
+ value: 'activation' as const,
+ label: 'Activation event',
+ labelInMenu: (
+ <div>
+ <div>Activation event</div>
+ <div className="text-xs text-muted font-normal">
+ When an additional event follows {defaultExposureEvent}
+ </div>
+ </div>
+ ),
+ },
+ ]
+ : []),
{
value: 'custom' as const,
label: 'Custom event',
@@ -225,6 +331,7 @@ export function ExposureCriteriaPanel({ experiment, onChange, compact }: Exposur
/>
</div>
{isCustom && <InclusionActionFilter experiment={experiment} onChange={onChange} />}
+ {isActivation && <ActivationActionFilter experiment={experiment} onChange={onChange} />}
</div>
<div className="flex items-center justify-between gap-2">
@@ -307,6 +414,7 @@ export function ExposureCriteriaPanel({ experiment, onChange, compact }: Exposur
onChange={onChange}
hasFilters={hasFilters}
defaultExposureEvent={defaultExposureEvent}
+ showActivationOption={showActivationOption}
/>
</div>
),
diff --git a/frontend/src/scenes/experiments/ExperimentView/ExposureCriteria.tsx b/frontend/src/scenes/experiments/ExperimentView/ExposureCriteria.tsx
index f461ba709101..4ede59c52101 100644
--- a/frontend/src/scenes/experiments/ExperimentView/ExposureCriteria.tsx
+++ b/frontend/src/scenes/experiments/ExperimentView/ExposureCriteria.tsx
@@ -5,6 +5,7 @@ import { LemonModal } from '@posthog/lemon-ui'
import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'
import { TestAccountFilterSwitch } from 'lib/components/TestAccountFiltersSwitch'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { ActionFilter } from 'scenes/insights/filters/ActionFilter/ActionFilter'
import { MathAvailability } from 'scenes/insights/filters/ActionFilter/ActionFilterRow/ActionFilterRow'
import { teamLogic } from 'scenes/teamLogic'
@@ -14,7 +15,7 @@ import { FilterType } from '~/types'
import { SelectableCard } from '../components/SelectableCard'
import { experimentLogic } from '../experimentLogic'
-import { EXPOSURE_DEFAULT_EVENT } from '../exposureContract'
+import { EXPOSURE_DEFAULT_EVENT, getActivationConfig } from '../exposureContract'
import { commonActionFilterProps } from '../Metrics/Selectors'
import { exposureConfigToFilter, filterToExposureConfig } from '../utils'
import { exposureCriteriaModalLogic } from './exposureCriteriaModalLogic'
@@ -31,6 +32,14 @@ export function ExposureCriteriaModal({ onSave }: ExposureCriteriaModalProps): J
const { currentTeam } = useValues(teamLogic)
const hasFilters = (currentTeam?.test_account_filters || []).length > 0
+ const activationEventEnabled = useFeatureFlag('EXPERIMENT_ACTIVATION_EVENT')
+ // getActivationConfig, not a raw field check: a stored default-sentinel exposure_config
+ // still composes with activation, and the editor must classify it the way the backend does
+ const isActivation = !!getActivationConfig(exposureCriteria)
+ const isCustom = !isActivation && !!exposureCriteria?.exposure_config
+ // Keep an existing activation config editable even if the team is no longer flagged in
+ const showActivationCard = activationEventEnabled || isActivation
+
return (
<LemonModal
isOpen={isExposureCriteriaModalOpen}
@@ -75,14 +84,43 @@ export function ExposureCriteriaModal({ onSave }: ExposureCriteriaModalProps): J
<strong>exposed</strong> to the experiment and included in the analysis.
</>
}
- selected={!exposureCriteria?.exposure_config}
+ selected={!isCustom && !isActivation}
onClick={() => {
setExposureCriteria({
...exposureCriteria,
exposure_config: undefined,
+ activation_config: undefined,
})
}}
/>
+ {showActivationCard && (
+ <SelectableCard
+ title="Activation event"
+ description={
+ <>
+ Require an additional event after <LemonTag>{resolvedExposureEvent}</LemonTag>. Users
+ enter the analysis when this event follows their first exposure, and metrics count from
+ the activation event.
+ </>
+ }
+ selected={isActivation}
+ onClick={() => {
+ // Re-clicking the selected card must not reset a configured event
+ if (isActivation) {
+ return
+ }
+ setExposureCriteria({
+ ...exposureCriteria,
+ exposure_config: undefined,
+ activation_config: {
+ kind: NodeKind.ExperimentEventExposureConfig,
+ event: '$pageview',
+ properties: [],
+ },
+ })
+ }}
+ />
+ )}
<SelectableCard
title="Custom"
description={
@@ -92,8 +130,12 @@ export function ExposureCriteriaModal({ onSave }: ExposureCriteriaModalProps): J
You can also filter out users you would like to exclude from the analysis.
</>
}
- selected={!!exposureCriteria?.exposure_config}
+ selected={isCustom}
onClick={() => {
+ // Re-clicking the selected card must not reset a configured event
+ if (isCustom) {
+ return
+ }
setExposureCriteria({
...exposureCriteria,
exposure_config: {
@@ -101,11 +143,12 @@ export function ExposureCriteriaModal({ onSave }: ExposureCriteriaModalProps): J
event: EXPOSURE_DEFAULT_EVENT,
properties: [],
},
+ activation_config: undefined,
})
}}
/>
</div>
- {exposureCriteria?.exposure_config && (
+ {isCustom && exposureCriteria?.exposure_config && (
<div className="mb-4">
<ActionFilter
bordered
@@ -131,6 +174,32 @@ export function ExposureCriteriaModal({ onSave }: ExposureCriteriaModalProps): J
/>
</div>
)}
+ {isActivation && exposureCriteria?.activation_config && (
+ <div className="mb-4">
+ <ActionFilter
+ bordered
+ filters={exposureConfigToFilter(exposureCriteria.activation_config)}
+ setFilters={({ events, actions }: Partial<FilterType>): void => {
+ const entity = events?.[0] || actions?.[0]
+ if (entity) {
+ setExposureCriteria({
+ ...exposureCriteria,
+ activation_config: filterToExposureConfig(entity),
+ })
+ }
+ }}
+ typeKey="experiment-activation-config"
+ buttonCopy="Add activation event"
+ showSeriesIndicator={true}
+ hideRename={true}
+ entitiesLimit={1}
+ mathAvailability={MathAvailability.None}
+ showNumericalPropsOnly={true}
+ actionsTaxonomicGroupTypes={[TaxonomicFilterGroupType.Events, TaxonomicFilterGroupType.Actions]}
+ propertiesTaxonomicGroupTypes={commonActionFilterProps.propertiesTaxonomicGroupTypes}
+ />
+ </div>
+ )}
<div className="w-[405px]">
<div className="mb-4">
<label className="block text-sm font-medium text-default mb-2">Multiple variant handling</label>
diff --git a/frontend/src/scenes/experiments/ExperimentView/Exposures.tsx b/frontend/src/scenes/experiments/ExperimentView/Exposures.tsx
index 4e1acd5bb3c9..bc6a670c894b 100644
--- a/frontend/src/scenes/experiments/ExperimentView/Exposures.tsx
+++ b/frontend/src/scenes/experiments/ExperimentView/Exposures.tsx
@@ -19,7 +19,7 @@ import { ExperimentExposureCriteria, ExperimentExposureQueryResponse } from '~/q
import { EXPERIMENT_VARIANT_MULTIPLE } from '../constants'
import { experimentLogic } from '../experimentLogic'
-import { isDefaultExposureConfig } from '../exposureContract'
+import { getActivationConfig, isDefaultExposureConfig } from '../exposureContract'
import { filterLowMultipleVariant, getExposureConfigDisplayName, resolveMultipleVariantHandling } from '../utils'
import { exposureCriteriaModalLogic } from './exposureCriteriaModalLogic'
import { buildExposureSeries } from './exposuresTransforms'
@@ -108,6 +108,11 @@ function getExposureCriteriaLabel(
exposureCriteria: ExperimentExposureCriteria | undefined,
defaultEvent: string
): string {
+ const activationConfig = getActivationConfig(exposureCriteria)
+ if (activationConfig) {
+ return `Default (${defaultEvent}) + activation (${getExposureConfigDisplayName(activationConfig)})`
+ }
+
const exposureConfig = exposureCriteria?.exposure_config
if (!exposureConfig || isDefaultExposureConfig(exposureConfig)) {
return `Default (${defaultEvent})`
diff --git a/frontend/src/scenes/experiments/MetricsView/shared/MetricHeader.tsx b/frontend/src/scenes/experiments/MetricsView/shared/MetricHeader.tsx
index 6ae1344829e6..4f712d5c4be3 100644
--- a/frontend/src/scenes/experiments/MetricsView/shared/MetricHeader.tsx
+++ b/frontend/src/scenes/experiments/MetricsView/shared/MetricHeader.tsx
@@ -13,6 +13,7 @@ import { experimentMetricsLogic } from 'scenes/experiments/experimentMetricsLogi
import { isMetricThresholdCueVisible } from 'scenes/experiments/ExperimentMetricThreshold'
import {
EXPOSURE_DEFAULT_EVENT,
+ getActivationConfig,
getExposureEventAndProperty,
resolvedExposureEvent,
} from 'scenes/experiments/exposureContract'
@@ -31,13 +32,21 @@ import { getMetricTag } from './utils'
const MAX_BREAKDOWNS = 3
-// Helper function to get the exposure event from experiment
-const getExposureEvent = (experiment: Experiment): string =>
- getExposureEventAndProperty({
- featureFlagKey: experiment.feature_flag_key,
- exposureCriteria: experiment.exposure_criteria,
- resolvedExposureEvent: resolvedExposureEvent(experiment),
- }).event ?? EXPOSURE_DEFAULT_EVENT
+// Helper function to get the exposure event from experiment. In activation mode breakdowns are
+// attributed from the activation event, so property suggestions should come from it too.
+const getExposureEvent = (experiment: Experiment): string => {
+ const activationConfig = getActivationConfig(experiment.exposure_criteria)
+ if (activationConfig && 'event' in activationConfig && activationConfig.event) {
+ return activationConfig.event
+ }
+ return (
+ getExposureEventAndProperty({
+ featureFlagKey: experiment.feature_flag_key,
+ exposureCriteria: experiment.exposure_criteria,
+ resolvedExposureEvent: resolvedExposureEvent(experiment),
+ }).event ?? EXPOSURE_DEFAULT_EVENT
+ )
+}
const AddBreakdownMenuItem = ({
experiment,
diff --git a/frontend/src/scenes/experiments/activity-descriptions/experimentChangeDescription.tsx b/frontend/src/scenes/experiments/activity-descriptions/experimentChangeDescription.tsx
index 4558a1853749..6826b893ffbf 100644
--- a/frontend/src/scenes/experiments/activity-descriptions/experimentChangeDescription.tsx
+++ b/frontend/src/scenes/experiments/activity-descriptions/experimentChangeDescription.tsx
@@ -233,6 +233,24 @@ export const getExperimentChangeDescription = (
}
return null
})
+ .with('activation_config', () => {
+ const afterConfig = typedAfter?.activation_config
+ const beforeConfig = typedBefore?.activation_config
+
+ if (equal(afterConfig, beforeConfig)) {
+ return null
+ }
+
+ if (afterConfig) {
+ const displayName = getExposureConfigDisplayName(afterConfig)
+ return (
+ <span>
+ set the activation event to <LemonTag color="purple">{displayName}</LemonTag>
+ </span>
+ )
+ }
+ return null
+ })
.exhaustive()
)
@@ -245,6 +263,9 @@ export const getExperimentChangeDescription = (
</span>
)
}
+ if (typedBefore?.activation_config && !typedAfter?.activation_config) {
+ changes.push('removed the activation event')
+ }
return changes.filter(Boolean) as (string | JSX.Element)[]
})
diff --git a/frontend/src/scenes/experiments/exposureContract.test.ts b/frontend/src/scenes/experiments/exposureContract.test.ts
index 218d519805e8..0a9508cdddac 100644
--- a/frontend/src/scenes/experiments/exposureContract.test.ts
+++ b/frontend/src/scenes/experiments/exposureContract.test.ts
@@ -1,7 +1,8 @@
-import { ExperimentExposureCriteria, NodeKind } from '~/queries/schema/schema-general'
+import { ExperimentEventExposureConfig, ExperimentExposureCriteria, NodeKind } from '~/queries/schema/schema-general'
import {
exposureEventLabel,
+ getActivationConfig,
getExposureEventAndProperty,
isDefaultExposureConfig,
resolvedExposureEvent,
@@ -119,4 +120,62 @@ describe('exposureContract', () => {
}).event
).toBe(expectedEvent)
})
+
+ // Mirrors the backend `has_activation_config` gate: activation only composes with the
+ // default exposure, so a custom exposure_config must disable it.
+ const activationConfig: ExperimentEventExposureConfig = {
+ kind: NodeKind.ExperimentEventExposureConfig,
+ event: 'activated',
+ properties: [],
+ }
+ it.each<[string, ExperimentExposureCriteria | undefined, boolean]>([
+ ['no criteria', undefined, false],
+ ['activation alone', { activation_config: activationConfig }, true],
+ [
+ 'activation with the stored default exposure config',
+ {
+ exposure_config: {
+ kind: NodeKind.ExperimentEventExposureConfig,
+ event: '$feature_flag_called',
+ properties: [],
+ },
+ activation_config: activationConfig,
+ },
+ true,
+ ],
+ [
+ 'activation with a pinned $experiment_exposure config',
+ {
+ exposure_config: {
+ kind: NodeKind.ExperimentEventExposureConfig,
+ event: '$experiment_exposure',
+ properties: [],
+ },
+ activation_config: activationConfig,
+ },
+ true,
+ ],
+ [
+ 'activation ignored under a custom exposure config',
+ {
+ exposure_config: {
+ kind: NodeKind.ExperimentEventExposureConfig,
+ event: 'checkout_started',
+ properties: [],
+ },
+ activation_config: activationConfig,
+ },
+ false,
+ ],
+ [
+ 'activation ignored under an action exposure config',
+ {
+ exposure_config: { kind: NodeKind.ActionsNode, id: 42 },
+ activation_config: activationConfig,
+ },
+ false,
+ ],
+ ])('resolves the activation config for %s', (_name, exposureCriteria, expectActive) => {
+ expect(getActivationConfig(exposureCriteria)).toEqual(expectActive ? activationConfig : undefined)
+ })
})
diff --git a/frontend/src/scenes/experiments/exposureContract.ts b/frontend/src/scenes/experiments/exposureContract.ts
index 351b4d04cb17..be8aa893e0ca 100644
--- a/frontend/src/scenes/experiments/exposureContract.ts
+++ b/frontend/src/scenes/experiments/exposureContract.ts
@@ -56,6 +56,32 @@ export function isDefaultExposureConfig(config: ExperimentExposureConfig): boole
return isEventConfig(config) && config.event === EXPOSURE_DEFAULT_EVENT
}
+/**
+ * The activation event config in effect for the criteria, or undefined when there is none.
+ * Activation only composes with the default exposure, so a custom `exposure_config` disables it
+ * (mirrors the backend's `has_activation_config`). A config pinning `$experiment_exposure` still
+ * counts as default, matching the backend's `is_default_exposure_config`.
+ */
+export function getActivationConfig(
+ exposureCriteria: ExperimentExposureCriteria | undefined
+): ExperimentExposureConfig | undefined {
+ const activationConfig = exposureCriteria?.activation_config
+ if (!activationConfig) {
+ return undefined
+ }
+ const exposureConfig = exposureCriteria?.exposure_config
+ if (
+ exposureConfig &&
+ !(
+ isEventConfig(exposureConfig) &&
+ [EXPOSURE_DEFAULT_EVENT, EXPERIMENT_EXPOSURE_EVENT].includes(exposureConfig.event)
+ )
+ ) {
+ return undefined
+ }
+ return activationConfig
+}
+
/**
* Determines which event and variant property carry the exposure for an experiment.
*
diff --git a/posthog/schema.py b/posthog/schema.py
index dedc68b85793..69b6d79f657f 100644
--- a/posthog/schema.py
+++ b/posthog/schema.py
@@ -16334,6 +16334,15 @@ class ExperimentApiExposureCriteria(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
+ activation_config: ExperimentApiExposureConfig | None = Field(
+ default=None,
+ description=(
+ "Additional event (or action) an entity must emit at/after their first"
+ " default exposure event before they count as exposed; exposure time"
+ " becomes this event's timestamp. Only valid with the default exposure"
+ " event, not a custom `exposure_config`."
+ ),
+ )
exposure_config: ExperimentApiExposureConfig | None = None
filterTestAccounts: bool | None = None
multiple_variant_handling: MultipleVariantHandling | None = Field(
@@ -24836,6 +24845,15 @@ class ExperimentExposureCriteria(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
+ activation_config: ExperimentEventExposureConfig | ActionsNode | None = Field(
+ default=None,
+ description=(
+ "Additional event (or action) an entity must emit at/after their first"
+ " default exposure event before they count as exposed; exposure time"
+ " becomes this event's timestamp. Only valid with the default exposure"
+ " event, not a custom `exposure_config`."
+ ),
+ )
exposure_config: ExperimentEventExposureConfig | ActionsNode | None = None
filterTestAccounts: bool | None = None
multiple_variant_handling: MultipleVariantHandling | None = None
diff --git a/products/experiments/backend/experiment_service.py b/products/experiments/backend/experiment_service.py
index bcdf403ae96b..dc1f305c47f8 100644
--- a/products/experiments/backend/experiment_service.py
+++ b/products/experiments/backend/experiment_service.py
@@ -60,6 +60,8 @@ from products.experiments.backend.hogql_queries import CONTROL_VARIANT_KEY, get_
from products.experiments.backend.hogql_queries.base_query_utils import is_threshold_supported_math
from products.experiments.backend.hogql_queries.experiment_metric_fingerprint import compute_metric_fingerprint
from products.experiments.backend.hogql_queries.exposure_query_logic import (
+ DEFAULT_EXPOSURE_EVENT,
+ EXPERIMENT_EXPOSURE_EVENT,
build_exposure_event_conditions,
get_exposure_event_and_property,
resolve_default_exposure_event,
@@ -657,39 +659,64 @@ class ExperimentService:
f"{type(filter_test_accounts).__name__}: {cls._safe_repr(filter_test_accounts)}."
)
- if "exposure_config" in exposure_criteria:
- exposure_config = exposure_criteria["exposure_config"]
+ # Explicit null is how API clients clear a config (the generated types are
+ # nullable), so only validate shape when a value is present.
+ if exposure_criteria.get("exposure_config") is not None:
+ cls._validate_exposure_config_shape(
+ exposure_criteria["exposure_config"], "exposure_criteria.exposure_config"
+ )
- if not isinstance(exposure_config, dict):
+ if exposure_criteria.get("activation_config") is not None:
+ cls._validate_exposure_config_shape(
+ exposure_criteria["activation_config"], "exposure_criteria.activation_config"
+ )
+ exposure_config = exposure_criteria.get("exposure_config")
+ if isinstance(exposure_config, dict) and not cls._is_default_exposure_config(exposure_config):
raise ValidationError(
- f"exposure_criteria.exposure_config must be an object, got "
- f"{type(exposure_config).__name__}. {cls.EXPOSURE_CONFIG_HINT}"
+ "exposure_criteria.activation_config requires the default exposure event; "
+ "remove either the custom exposure_config or the activation_config."
)
- # `kind` is optional; missing kind defaults to ExperimentEventExposureConfig
- # to mirror the pydantic Literal default on that model.
- kind = exposure_config.get("kind", "ExperimentEventExposureConfig")
- if kind not in cls.EXPOSURE_CONFIG_KINDS:
- raise ValidationError(
- f"exposure_criteria.exposure_config.kind must be one of "
- f"{list(cls.EXPOSURE_CONFIG_KINDS)}, got {cls._safe_repr(kind)}. "
- f"{cls.EXPOSURE_CONFIG_HINT}"
- )
+ @classmethod
+ def _is_default_exposure_config(cls, exposure_config: dict) -> bool:
+ """A config naming a default exposure event is the stored default, not a custom exposure
+ (same convention as get_exposure_config_params_for_builder)."""
+ kind = exposure_config.get("kind", "ExperimentEventExposureConfig")
+ return kind == "ExperimentEventExposureConfig" and exposure_config.get("event") in (
+ DEFAULT_EXPOSURE_EVENT,
+ EXPERIMENT_EXPOSURE_EVENT,
+ )
- model_cls = ActionsNode if kind == "ActionsNode" else ExperimentEventExposureConfig
- try:
- model_cls.model_validate(exposure_config)
- except pydantic.ValidationError as e:
- # Surface only the field locations and error types from pydantic — not the
- # echoed `input` and `url` fields, which would reflect arbitrary user data
- # back into the response.
- safe_errors = [
- {"loc": err.get("loc"), "type": err.get("type"), "msg": err.get("msg")} for err in e.errors()
- ]
- raise ValidationError(
- f"Invalid exposure_criteria.exposure_config (kind={cls._safe_repr(kind)}): "
- f"{safe_errors}. {cls.EXPOSURE_CONFIG_HINT}"
- )
+ @classmethod
+ def _validate_exposure_config_shape(cls, exposure_config: object, field_path: str) -> None:
+ if not isinstance(exposure_config, dict):
+ raise ValidationError(
+ f"{field_path} must be an object, got {type(exposure_config).__name__}. {cls.EXPOSURE_CONFIG_HINT}"
+ )
+
+ # `kind` is optional; missing kind defaults to ExperimentEventExposureConfig
+ # to mirror the pydantic Literal default on that model.
+ kind = exposure_config.get("kind", "ExperimentEventExposureConfig")
+ if kind not in cls.EXPOSURE_CONFIG_KINDS:
+ raise ValidationError(
+ f"{field_path}.kind must be one of "
+ f"{list(cls.EXPOSURE_CONFIG_KINDS)}, got {cls._safe_repr(kind)}. "
+ f"{cls.EXPOSURE_CONFIG_HINT}"
+ )
+
+ model_cls = ActionsNode if kind == "ActionsNode" else ExperimentEventExposureConfig
+ try:
+ model_cls.model_validate(exposure_config)
+ except pydantic.ValidationError as e:
+ # Surface only the field locations and error types from pydantic — not the
+ # echoed `input` and `url` fields, which would reflect arbitrary user data
+ # back into the response.
+ safe_errors = [
+ {"loc": err.get("loc"), "type": err.get("type"), "msg": err.get("msg")} for err in e.errors()
+ ]
+ raise ValidationError(
+ f"Invalid {field_path} (kind={cls._safe_repr(kind)}): {safe_errors}. {cls.EXPOSURE_CONFIG_HINT}"
+ )
# Maps the public `metric_type` literal to the pydantic class name that pydantic reports
# in `loc[0]` when validation fails. Used to narrow union-variant errors to the variant
diff --git a/products/experiments/backend/hogql_queries/experiment_exposure_query_builder.py b/products/experiments/backend/hogql_queries/experiment_exposure_query_builder.py
index 2351bbf80fa9..5d85b42cb822 100644
--- a/products/experiments/backend/hogql_queries/experiment_exposure_query_builder.py
+++ b/products/experiments/backend/hogql_queries/experiment_exposure_query_builder.py
@@ -89,15 +89,7 @@ class ExposureQueryBuilder:
"""
query = parse_select(
"""
- WITH first_exposures AS (
- SELECT
- {entity_key} AS entity_id,
- {variant_expr} AS variant,
- toDate(toString(min(timestamp))) AS day
- FROM events
- WHERE {exposure_predicate}
- GROUP BY entity_id
- )
+ WITH first_exposures AS ({first_exposures_select})
SELECT
first_exposures.day AS day,
@@ -109,15 +101,55 @@ class ExposureQueryBuilder:
ORDER BY first_exposures.day ASC
""",
placeholders={
- "entity_key": parse_expr(self.context.entity_key),
- "variant_expr": self.build_variant_expr_for_mean(),
- "exposure_predicate": self.build_exposure_predicate(),
+ "first_exposures_select": self._build_first_exposures_day_select(),
},
)
assert isinstance(query, ast.SelectQuery)
return query
+ def _build_first_exposures_day_select(self) -> ast.SelectQuery:
+ """Per-entity (entity_id, variant, day-of-first-exposure) select feeding the timeseries."""
+ if self.context.activation_config is not None:
+ query = parse_select(
+ """
+ SELECT
+ {entity_key} AS entity_id,
+ any(flag_exposures.variant) AS variant,
+ toDate(toString(min(timestamp))) AS day
+ FROM events
+ INNER JOIN ({flag_exposures}) AS flag_exposures
+ ON {entity_key} = flag_exposures.entity_id
+ WHERE {activation_predicate}
+ AND timestamp >= flag_exposures.first_flag_exposure_time
+ GROUP BY entity_id
+ """,
+ placeholders={
+ "entity_key": parse_expr(self.context.entity_key),
+ "flag_exposures": self._build_flag_exposures_subquery(),
+ "activation_predicate": self.build_activation_predicate(),
+ },
+ )
+ else:
+ query = parse_select(
+ """
+ SELECT
+ {entity_key} AS entity_id,
+ {variant_expr} AS variant,
+ toDate(toString(min(timestamp))) AS day
+ FROM events
+ WHERE {exposure_predicate}
+ GROUP BY entity_id
+ """,
+ placeholders={
+ "entity_key": parse_expr(self.context.entity_key),
+ "variant_expr": self.build_variant_expr_for_mean(),
+ "exposure_predicate": self.build_exposure_predicate(),
+ },
+ )
+ assert isinstance(query, ast.SelectQuery)
+ return query
+
def _build_precomputed_entity_id_expr(self) -> ast.Expr:
return (
parse_expr("toUUID(t.entity_id)") if self.context.entity_key == "person_id" else parse_expr("t.entity_id")
@@ -260,12 +292,119 @@ class ExposureQueryBuilder:
)
)
+ def build_exposure_step_predicate(self) -> ast.Expr:
+ """
+ Row-level predicate for rows that can serve as the funnel's exposure step (step_0).
+ In activation mode that is the activation event; qualification (at/after the first
+ flag exposure) is enforced by the exposures-CTE temporal filter, which activation
+ mode forces on for funnels.
+ """
+ if self.context.activation_config is not None:
+ return self.build_activation_predicate()
+ return self.build_exposure_predicate()
+
+ def build_exposure_step_event_predicate(self) -> ast.Expr:
+ """
+ Event-level variant of build_exposure_step_predicate (no date, variant, or
+ test-account conditions), for callers that apply those separately.
+ """
+ if self.context.activation_config is not None:
+ return event_or_action_to_filter(self.context.team, self.context.activation_config)
+ return self.build_exposure_event_predicate()
+
def select_query(self) -> ast.SelectQuery:
+ # Activation mode never reads precomputed exposures: the per-day cache is built from
+ # the flag predicate alone and cannot express the cross-day flag→activation ordering.
+ if self.context.activation_config is not None:
+ return self._build_activation_exposure_select_query()
+
if self.preaggregation_job_ids and not self.context.breakdowns:
return self.precomputed_select_query(self.preaggregation_job_ids)
return self._build_exposure_select_query()
+ def _build_flag_exposures_subquery(self) -> ast.SelectQuery:
+ """
+ Per-entity flag exposures feeding activation mode: variant assignment (with
+ multiple-variant handling) and the first default exposure time an activation
+ event must follow.
+ """
+ query = parse_select(
+ """
+ SELECT
+ {entity_key} AS entity_id,
+ {variant_expr} AS variant,
+ min(timestamp) AS first_flag_exposure_time
+ FROM events
+ WHERE {exposure_predicate}
+ GROUP BY entity_id
+ """,
+ placeholders={
+ "entity_key": parse_expr(self.context.entity_key),
+ "variant_expr": self.build_variant_expr_for_mean(),
+ "exposure_predicate": self.build_exposure_predicate(),
+ },
+ )
+ assert isinstance(query, ast.SelectQuery)
+ return query
+
+ def build_activation_predicate(self) -> ast.Expr:
+ """
+ Row predicate for activation events: date range, event/action + property filters, and
+ test-account exclusion. No variant filter: activation events don't carry flag
+ properties; the variant comes from the flag-exposure rows this joins against.
+ """
+ assert self.context.activation_config is not None
+ return _optimize_and_chain(
+ parse_expr(
+ """
+ timestamp >= {date_from}
+ AND timestamp <= {date_to}
+ AND {event_predicate}
+ AND {test_accounts_filter}
+ """,
+ placeholders={
+ "date_from": self.context.date_range_query.date_from_as_hogql(),
+ "date_to": self.context.date_range_query.date_to_as_hogql(),
+ "event_predicate": event_or_action_to_filter(self.context.team, self.context.activation_config),
+ "test_accounts_filter": self.build_test_accounts_filter(),
+ },
+ )
+ )
+
+ def _build_activation_exposure_select_query(self) -> ast.SelectQuery:
+ """
+ Activation-mode exposure select: same output shape as _build_exposure_select_query,
+ but an entity only qualifies via an activation event at/after its first flag exposure,
+ and first/last exposure times, event uuid, and session id come from activation events.
+ """
+ exposure_query = parse_select(
+ """
+ SELECT
+ {entity_key} AS entity_id,
+ any(flag_exposures.variant) AS variant,
+ min(timestamp) AS first_exposure_time,
+ max(timestamp) AS last_exposure_time,
+ argMin(uuid, timestamp) AS exposure_event_uuid,
+ argMin(`$session_id`, timestamp) AS exposure_session_id
+ -- breakdown columns added programmatically below
+ FROM events
+ INNER JOIN ({flag_exposures}) AS flag_exposures
+ ON {entity_key} = flag_exposures.entity_id
+ WHERE {activation_predicate}
+ AND timestamp >= flag_exposures.first_flag_exposure_time
+ GROUP BY entity_id
+ -- breakdown columns added programmatically below
+ """,
+ placeholders={
+ "entity_key": parse_expr(self.context.entity_key),
+ "flag_exposures": self._build_flag_exposures_subquery(),
+ "activation_predicate": self.build_activation_predicate(),
+ },
+ )
+ assert isinstance(exposure_query, ast.SelectQuery)
+ return self._finalize_exposure_select(exposure_query)
+
def _build_exposure_select_query(self) -> ast.SelectQuery:
exposure_query = parse_select(
"""
@@ -289,7 +428,9 @@ class ExposureQueryBuilder:
},
)
assert isinstance(exposure_query, ast.SelectQuery)
+ return self._finalize_exposure_select(exposure_query)
+ def _finalize_exposure_select(self, exposure_query: ast.SelectQuery) -> ast.SelectQuery:
# Inject breakdown columns into the exposure query if needed
if self.breakdown_injector:
breakdown_exprs = self.breakdown_injector.build_breakdown_exprs(table_alias="")
@@ -380,6 +521,11 @@ class ExposureQueryBuilder:
Returns:
Tuple of (query_string, placeholders_dict)
"""
+ if self.context.activation_config is not None:
+ # Callers gate on has_activation_config before precomputing; a cache built from
+ # this per-day query would count flag exposures alone and poison later reads.
+ raise ValueError("Activation-mode exposures cannot be precomputed per day")
+
# Query template with placeholders
# Note: uses < for time_window_max (exclusive end for bucket boundaries)
# vs <= in normal query (inclusive end for experiment boundary)
diff --git a/products/experiments/backend/hogql_queries/experiment_exposures_query_runner.py b/products/experiments/backend/hogql_queries/experiment_exposures_query_runner.py
index c09cd4bd9124..2656578e8cbe 100644
--- a/products/experiments/backend/hogql_queries/experiment_exposures_query_runner.py
+++ b/products/experiments/backend/hogql_queries/experiment_exposures_query_runner.py
@@ -45,7 +45,7 @@ from products.experiments.backend.hogql_queries.experiment_query_runner import (
experiment_precompute_ttl_schedule,
has_uncalculated_cohorts,
)
-from products.experiments.backend.hogql_queries.exposure_query_logic import get_entity_key
+from products.experiments.backend.hogql_queries.exposure_query_logic import get_entity_key, has_activation_config
from products.experiments.backend.models.experiment import Experiment
from products.experiments.backend.models.team_experiments_config import TeamExperimentsConfig
@@ -133,21 +133,20 @@ class ExperimentExposuresQueryRunner(QueryRunner):
)
def _get_exposure_query(self) -> ast.SelectQuery:
- (
- exposure_config,
- multiple_variant_handling,
- filter_test_accounts,
- ) = get_exposure_config_params_for_builder(self.exposure_criteria, self.team, self.experiment.start_date)
+ exposure_params = get_exposure_config_params_for_builder(
+ self.exposure_criteria, self.team, self.experiment.start_date
+ )
builder = ExperimentQueryBuilder(
team=self.team,
feature_flag_key=self.feature_flag_key,
- exposure_config=exposure_config,
- filter_test_accounts=filter_test_accounts,
- multiple_variant_handling=multiple_variant_handling,
+ exposure_config=exposure_params.exposure_config,
+ filter_test_accounts=exposure_params.filter_test_accounts,
+ multiple_variant_handling=exposure_params.multiple_variant_handling,
variants=self.variants,
date_range_query=self.date_range_query,
entity_key=get_entity_key(self.group_type_index),
+ activation_config=exposure_params.activation_config,
)
# TODO: Add query-level precomputation_mode override for ExperimentExposureQuery.
@@ -166,6 +165,9 @@ class ExperimentExposuresQueryRunner(QueryRunner):
self.experiment.end_date,
)
and not has_uncalculated_cohorts(self.team, self.exposure_criteria)
+ # Activation-mode exposures can't be cached per day: the flag→activation
+ # ordering crosses bucket boundaries.
+ and not has_activation_config(self.exposure_criteria)
):
try:
with tags_context(experiment_query_surface="precompute_build", experiment_precompute_table="exposures"):
@@ -278,12 +280,12 @@ class ExperimentExposuresQueryRunner(QueryRunner):
return None
multivariate_data = self.query.feature_flag.get("filters", {}).get("multivariate", {})
flag_variants = multivariate_data.get("variants", [])
- _, handling, _ = get_exposure_config_params_for_builder(
+ exposure_params = get_exposure_config_params_for_builder(
self.exposure_criteria, self.team, self.experiment.start_date
)
return evaluate_bias_risk(
flag_variants=flag_variants,
- multiple_variant_handling=handling,
+ multiple_variant_handling=exposure_params.multiple_variant_handling,
total_exposures=total_exposures,
)
diff --git a/products/experiments/backend/hogql_queries/experiment_funnel_actors_query_builder.py b/products/experiments/backend/hogql_queries/experiment_funnel_actors_query_builder.py
index af02193a9b6b..3b94489022b7 100644
--- a/products/experiments/backend/hogql_queries/experiment_funnel_actors_query_builder.py
+++ b/products/experiments/backend/hogql_queries/experiment_funnel_actors_query_builder.py
@@ -42,6 +42,7 @@ class ExperimentFunnelActorsQueryBuilder:
funnel_step: int,
funnel_step_breakdown: str | int | float,
include_recordings: bool,
+ activation_config: ExperimentEventExposureConfig | ActionsNode | None = None,
):
self.team = team
self.metric = metric
@@ -65,6 +66,7 @@ class ExperimentFunnelActorsQueryBuilder:
date_range_query=date_range_query,
entity_key=entity_key,
metric=metric,
+ activation_config=activation_config,
)
def build_actors_query(self) -> ast.SelectQuery:
@@ -183,7 +185,7 @@ class ExperimentFunnelActorsQueryBuilder:
funnel_steps_filter = funnel_steps_to_filter(self.team, self.metric.series)
# Build exposure predicate from the shared exposure fragment builder
- exposure_predicate = self._query_builder._exposure_query_builder().build_exposure_event_predicate()
+ exposure_predicate = self._query_builder._exposure_query_builder().build_exposure_step_event_predicate()
# Parse base query without step columns
query = cast(
@@ -230,9 +232,14 @@ class ExperimentFunnelActorsQueryBuilder:
# Ensure metric is ExperimentFunnelMetric (guaranteed by the constructor signature)
assert isinstance(self.metric, ExperimentFunnelMetric), "metric must be ExperimentFunnelMetric"
- # Determine if unordered funnel (needs temporal filter)
+ # Determine if unordered funnel (needs temporal filter). Activation mode needs it for
+ # ordered funnels too, matching the main funnel query: step_0 rows are plain
+ # activation-event matches, so events before the qualifying activation must be excluded.
is_unordered = self.metric.funnel_order_type == "unordered"
- temporal_filter = "AND metric_events.timestamp >= exposures.first_exposure_time" if is_unordered else ""
+ is_activation_mode = self._query_builder.context.activation_config is not None
+ temporal_filter = (
+ "AND metric_events.timestamp >= exposures.first_exposure_time" if is_unordered or is_activation_mode else ""
+ )
# Build conversion window
if self.metric.conversion_window is not None and self.metric.conversion_window_unit is not None:
diff --git a/products/experiments/backend/hogql_queries/experiment_funnel_query_builder.py b/products/experiments/backend/hogql_queries/experiment_funnel_query_builder.py
index 51d99ca2951c..5bbc936a3053 100644
--- a/products/experiments/backend/hogql_queries/experiment_funnel_query_builder.py
+++ b/products/experiments/backend/hogql_queries/experiment_funnel_query_builder.py
@@ -70,6 +70,11 @@ class FunnelQueryBuilder:
# Route DW funnels to legacy path which supports UNION ALL
if isinstance(self._b.metric, ExperimentFunnelMetric) and self.has_datawarehouse_steps():
return False
+ # Activation-mode exposure is a join against flag exposures, not a single-event
+ # predicate, so it cannot be inlined into the single-scan WHERE and its step_0
+ # variant attribution. The legacy path consumes the exposures CTE as a black box.
+ if self._b.context.activation_config is not None:
+ return False
return True
def build_funnel_query_legacy(self) -> ast.SelectQuery:
@@ -160,8 +165,16 @@ class FunnelQueryBuilder:
# because the funnel UDF doesn't filter out events before the exposure.
# Ordered funnels don't need this - the UDF handles temporal ordering internally.
- # Build the JOIN clause with conditional temporal filter
- temporal_filter = "AND metric_events.timestamp >= exposures.first_exposure_time" if is_unordered_funnel else ""
+ # Build the JOIN clause with conditional temporal filter. Activation mode needs it
+ # for ordered funnels too: step_0 rows are plain activation-event matches, and the
+ # UDF's ordering cannot express "at/after the first flag exposure", so events before
+ # the qualifying activation must be excluded here.
+ is_activation_mode = self._b.context.activation_config is not None
+ temporal_filter = (
+ "AND metric_events.timestamp >= exposures.first_exposure_time"
+ if is_unordered_funnel or is_activation_mode
+ else ""
+ )
# DW steps join via events_join_key (e.g. properties.$user_id) → data_warehouse_join_key
# (e.g. userid). The exposure CTE uses person_id (UUID) as entity_id. To bridge
@@ -214,7 +227,7 @@ class FunnelQueryBuilder:
)
placeholders: dict[str, ast.Expr | ast.SelectQuery] = {
- "exposure_predicate": self._b._build_exposure_predicate(),
+ "exposure_predicate": self._b._build_exposure_step_predicate(),
"variant_property": self._b._build_variant_property(),
"variant_expr": self.build_variant_expr_for_funnel(),
"entity_key": parse_expr(self._b.entity_key),
@@ -580,7 +593,7 @@ class FunnelQueryBuilder:
# Use FunnelStepBuilder abstraction for boolean columns
step_builder = FunnelStepBuilder(self._b.metric.series, self._b.team)
- exposure_filter = self._b._build_exposure_predicate()
+ exposure_filter = self._b._build_exposure_step_predicate()
return step_builder.build_boolean_columns(exposure_filter)
def build_funnel_steps_filter(self) -> ast.Expr:
@@ -712,7 +725,7 @@ class FunnelQueryBuilder:
# - step_N (event/action): if(step_filter, 1, 0)
# - step_N (DW): 0 (always 0 in events subquery)
- exposure_filter = self._b._build_exposure_predicate()
+ exposure_filter = self._b._build_exposure_step_predicate()
# step_0: exposure
step_0 = ast.Alias(
@@ -791,11 +804,11 @@ class FunnelQueryBuilder:
# Combine step matching with time range
where: ast.Expr
if event_action_filters:
- step_match = ast.Or(exprs=[self._b._build_exposure_predicate(), ast.Or(exprs=event_action_filters)])
+ step_match = ast.Or(exprs=[self._b._build_exposure_step_predicate(), ast.Or(exprs=event_action_filters)])
where = ast.And(exprs=[time_range_filter, step_match])
else:
# Only exposure events (all steps are DW)
- where = ast.And(exprs=[time_range_filter, self._b._build_exposure_predicate()])
+ where = ast.And(exprs=[time_range_filter, self._b._build_exposure_step_predicate()])
# Build query
query = ast.SelectQuery(
diff --git a/products/experiments/backend/hogql_queries/experiment_query_builder.py b/products/experiments/backend/hogql_queries/experiment_query_builder.py
index f99c098260b0..fa218d238df1 100644
--- a/products/experiments/backend/hogql_queries/experiment_query_builder.py
+++ b/products/experiments/backend/hogql_queries/experiment_query_builder.py
@@ -1,3 +1,4 @@
+from dataclasses import dataclass
from datetime import datetime
from typing import Optional, Union
@@ -50,6 +51,7 @@ from products.experiments.backend.hogql_queries.experiment_ratio_query_builder i
from products.experiments.backend.hogql_queries.experiment_retention_query_builder import RetentionQueryBuilder
from products.experiments.backend.hogql_queries.exposure_query_logic import (
DEFAULT_EXPOSURE_EVENT,
+ is_default_exposure_config,
normalize_to_exposure_criteria,
resolve_default_exposure_event,
)
@@ -67,14 +69,25 @@ def resolve_exposure_config_for_builder(
return exposure_config
+@dataclass(frozen=True, kw_only=True)
+class ExposureQueryParams:
+ """Exposure-related parameters required by the query builder, resolved from stored criteria."""
+
+ exposure_config: ExperimentEventExposureConfig | ActionsNode
+ activation_config: ExperimentEventExposureConfig | ActionsNode | None
+ multiple_variant_handling: MultipleVariantHandling
+ filter_test_accounts: bool
+
+
def get_exposure_config_params_for_builder(
exposure_criteria: Union[ExperimentExposureCriteria, dict, None],
team: Team,
start_date: Optional[datetime],
-) -> tuple[ExperimentEventExposureConfig | ActionsNode, MultipleVariantHandling, bool]:
+) -> ExposureQueryParams:
"""Returns exposure-related parameters required by the query builder."""
criteria = normalize_to_exposure_criteria(exposure_criteria)
exposure_config: ExperimentEventExposureConfig | ActionsNode
+ activation_config: ExperimentEventExposureConfig | ActionsNode | None = None
if criteria is None:
exposure_config = ExperimentEventExposureConfig(
event=resolve_default_exposure_event(team, start_date), properties=[]
@@ -96,10 +109,20 @@ def get_exposure_config_params_for_builder(
exposure_config = resolve_exposure_config_for_builder(criteria.exposure_config, team, start_date)
else:
exposure_config = criteria.exposure_config
+ # Activation only composes with the default exposure; a custom exposure_config
+ # disables it (validation rejects the combination, but stored data predating it
+ # must not silently change semantics).
+ if is_default_exposure_config(criteria.exposure_config):
+ activation_config = criteria.activation_config
filter_test_accounts = bool(criteria.filterTestAccounts) if criteria.filterTestAccounts is not None else True
multiple_variant_handling = criteria.multiple_variant_handling or MultipleVariantHandling.EXCLUDE
- return (exposure_config, multiple_variant_handling, filter_test_accounts)
+ return ExposureQueryParams(
+ exposure_config=exposure_config,
+ activation_config=activation_config,
+ multiple_variant_handling=multiple_variant_handling,
+ filter_test_accounts=filter_test_accounts,
+ )
class ExperimentQueryBuilder:
@@ -119,6 +142,7 @@ class ExperimentQueryBuilder:
breakdowns: list[Breakdown] | None = None,
only_count_matured_users: bool = False,
cuped_config: CupedQueryConfig | None = None,
+ activation_config: ExperimentEventExposureConfig | ActionsNode | None = None,
):
self.team = team
self.metric = metric
@@ -128,6 +152,7 @@ class ExperimentQueryBuilder:
self.date_range_query = date_range_query
self.entity_key = entity_key
self.exposure_config = exposure_config
+ self.activation_config = activation_config
self.filter_test_accounts = filter_test_accounts
self.multiple_variant_handling = multiple_variant_handling
self.breakdowns = breakdowns or []
@@ -135,6 +160,12 @@ class ExperimentQueryBuilder:
self.preaggregation_job_ids: list[str] | None = None
self.metric_events_preaggregation_job_ids: list[str] | None = None
self.cuped_config = cuped_config or CupedQueryConfig()
+ # ponytail: funnel CUPED sources its pre-exposure covariate from the metric_events
+ # scan, but activation mode forces the temporal filter that removes those rows, so
+ # the covariate would silently be 0 for everyone. Disable it until the covariate
+ # gets its own pre-window scan.
+ if activation_config is not None and isinstance(metric, ExperimentFunnelMetric):
+ self.cuped_config = CupedQueryConfig(enabled=False, lookback_days=self.cuped_config.lookback_days)
# Experiment-level invariants, gathered into a single frozen context for
# later extracted modules to consume. Additive: every self.* attribute
@@ -151,6 +182,7 @@ class ExperimentQueryBuilder:
breakdowns=tuple(self.breakdowns),
only_count_matured_users=self.only_count_matured_users,
cuped_config=self.cuped_config,
+ activation_config=self.activation_config,
)
# Experiment queries group by (variant, breakdown_values), so the row count is
@@ -654,6 +686,13 @@ class ExperimentQueryBuilder:
"""
return self._exposure_query_builder().build_exposure_predicate()
+ def _build_exposure_step_predicate(self) -> ast.Expr:
+ """
+ Predicate for rows that can serve as the funnel's exposure step (step_0); the
+ activation predicate in activation mode, the exposure predicate otherwise.
+ """
+ return self._exposure_query_builder().build_exposure_step_predicate()
+
def _get_exposure_query(self) -> ast.SelectQuery:
return self._exposure_query_builder().select_query()
diff --git a/products/experiments/backend/hogql_queries/experiment_query_context.py b/products/experiments/backend/hogql_queries/experiment_query_context.py
index 97da7004e93f..2549f3269700 100644
--- a/products/experiments/backend/hogql_queries/experiment_query_context.py
+++ b/products/experiments/backend/hogql_queries/experiment_query_context.py
@@ -29,6 +29,9 @@ class ExperimentQueryContext:
breakdowns: tuple[Breakdown, ...]
only_count_matured_users: bool
cuped_config: CupedQueryConfig
+ # When set, an entity only counts as exposed once it emits this event at/after its first
+ # default exposure event, and that activation event's timestamp becomes the exposure time.
+ activation_config: ExperimentEventExposureConfig | ActionsNode | None = None
@dataclass(frozen=True)
diff --git a/products/experiments/backend/hogql_queries/experiment_query_runner.py b/products/experiments/backend/hogql_queries/experiment_query_runner.py
index c0d8159e0acf..ba154b73439e 100644
--- a/products/experiments/backend/hogql_queries/experiment_query_runner.py
+++ b/products/experiments/backend/hogql_queries/experiment_query_runner.py
@@ -70,6 +70,7 @@ from products.experiments.backend.hogql_queries.experiment_query_context import
from products.experiments.backend.hogql_queries.exposure_query_logic import (
get_entity_key,
get_multiple_variant_handling_from_experiment,
+ has_activation_config,
)
from products.experiments.backend.hogql_queries.utils import (
aggregate_variants_across_breakdowns,
@@ -419,6 +420,11 @@ class ExperimentQueryRunner(QueryRunner):
):
return False
+ # Activation-mode exposures can't be cached per day: the flag→activation ordering
+ # crosses bucket boundaries.
+ if has_activation_config(self.experiment.exposure_criteria):
+ return False
+
return not has_uncalculated_cohorts(self.team, self.experiment.exposure_criteria, self.metric)
def _precompute_skip_reason(self) -> Optional[str]:
@@ -434,6 +440,8 @@ class ExperimentQueryRunner(QueryRunner):
self.experiment.end_date,
):
return "min_runtime"
+ if has_activation_config(self.experiment.exposure_criteria):
+ return "activation_config"
if has_uncalculated_cohorts(self.team, self.experiment.exposure_criteria, self.metric):
return "cohort_not_calculated"
if self.is_data_warehouse_query:
@@ -508,20 +516,16 @@ class ExperimentQueryRunner(QueryRunner):
)
# Get the "missing" (not directly accessible) parameters required for the builder
- (
- exposure_config,
- multiple_variant_handling,
- filter_test_accounts,
- ) = get_exposure_config_params_for_builder(
+ exposure_params = get_exposure_config_params_for_builder(
self.experiment.exposure_criteria, self.team, self.experiment.start_date
)
builder = ExperimentQueryBuilder(
team=self.team,
feature_flag_key=self.feature_flag_key,
- exposure_config=exposure_config,
- filter_test_accounts=filter_test_accounts,
- multiple_variant_handling=multiple_variant_handling,
+ exposure_config=exposure_params.exposure_config,
+ filter_test_accounts=exposure_params.filter_test_accounts,
+ multiple_variant_handling=exposure_params.multiple_variant_handling,
variants=self.variants,
date_range_query=self.date_range_query,
entity_key=self.entity_key,
@@ -529,6 +533,7 @@ class ExperimentQueryRunner(QueryRunner):
breakdowns=self._get_breakdowns_for_builder(),
only_count_matured_users=self.experiment.only_count_matured_users,
cuped_config=self.cuped_config,
+ activation_config=exposure_params.activation_config,
)
should_precompute = self._should_precompute()
@@ -883,15 +888,20 @@ class ExperimentQueryRunner(QueryRunner):
from posthog.schema import ActionsNode, ExperimentEventExposureConfig
exposure_config: ExperimentEventExposureConfig | ActionsNode
+ activation_config: ExperimentEventExposureConfig | ActionsNode | None = None
if self.actors_query.exposureConfig is not None:
+ # An explicit override replaces the whole exposure definition, including any
+ # stored activation event.
exposure_config = resolve_exposure_config_for_builder(
self.actors_query.exposureConfig, self.team, self.experiment.start_date
)
else:
# Same resolution as the main experiment query, so the actor list matches the counts.
- exposure_config, _, _ = get_exposure_config_params_for_builder(
+ exposure_params = get_exposure_config_params_for_builder(
self.experiment.exposure_criteria, self.team, self.experiment.start_date
)
+ exposure_config = exposure_params.exposure_config
+ activation_config = exposure_params.activation_config
# Get multiple variant handling
if self.actors_query.multipleVariantHandling is not None:
@@ -955,6 +965,7 @@ class ExperimentQueryRunner(QueryRunner):
funnel_step=funnel_step,
funnel_step_breakdown=funnel_step_breakdown,
include_recordings=self.actors_query.includeRecordings or False,
+ activation_config=activation_config,
)
# Step 0 is the exposure step: return everyone exposed to the variant,
diff --git a/products/experiments/backend/hogql_queries/exposure_query_logic.py b/products/experiments/backend/hogql_queries/exposure_query_logic.py
index e26e48a292f6..2dac69dd9536 100644
--- a/products/experiments/backend/hogql_queries/exposure_query_logic.py
+++ b/products/experiments/backend/hogql_queries/exposure_query_logic.py
@@ -114,18 +114,41 @@ def normalize_to_exposure_criteria(
if isinstance(exposure_criteria, dict):
# Create a copy to avoid mutating the input
criteria_copy = exposure_criteria.copy()
- # Also normalize nested exposure_config if present
- if criteria_copy.get("exposure_config"):
- exposure_config = criteria_copy["exposure_config"]
- if isinstance(exposure_config, dict):
- if _is_actions_node_dict(exposure_config):
- criteria_copy["exposure_config"] = ActionsNode.model_validate(exposure_config)
+ # Also normalize nested configs if present
+ for config_key in ("exposure_config", "activation_config"):
+ config = criteria_copy.get(config_key)
+ if config and isinstance(config, dict):
+ if _is_actions_node_dict(config):
+ criteria_copy[config_key] = ActionsNode.model_validate(config)
else:
- criteria_copy["exposure_config"] = ExperimentEventExposureConfig.model_validate(exposure_config)
+ criteria_copy[config_key] = ExperimentEventExposureConfig.model_validate(config)
return ExperimentExposureCriteria.model_validate(criteria_copy)
+def is_default_exposure_config(config: Union[ActionsNode, ExperimentEventExposureConfig, None]) -> bool:
+ """A missing config or one naming a default exposure event is the default exposure, not a
+ custom one (same convention as get_exposure_event_and_property)."""
+ if config is None:
+ return True
+ return isinstance(config, ExperimentEventExposureConfig) and config.event in (
+ DEFAULT_EXPOSURE_EVENT,
+ EXPERIMENT_EXPOSURE_EVENT,
+ )
+
+
+def has_activation_config(exposure_criteria: Union[ExperimentExposureCriteria, dict, None]) -> bool:
+ """Whether the criteria put the experiment in activation mode: an activation event on top of
+ the default exposure. A custom exposure_config disables activation (validation rejects the
+ combination, but stored data predating it must not change semantics)."""
+ criteria = normalize_to_exposure_criteria(exposure_criteria)
+ return (
+ criteria is not None
+ and criteria.activation_config is not None
+ and is_default_exposure_config(criteria.exposure_config)
+ )
+
+
def get_multiple_variant_handling_from_experiment(
exposure_criteria: Union[ExperimentExposureCriteria, dict, None],
) -> MultipleVariantHandling:
diff --git a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_activation_config.ambr b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_activation_config.ambr
new file mode 100644
index 000000000000..091925245de2
--- /dev/null
+++ b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_activation_config.ambr
@@ -0,0 +1,278 @@
+# serializer version: 1
+# name: TestExperimentActivationConfig.test_exposures_timeseries_counts_users_on_activation_day
+ '''
+ WITH first_exposures AS
+ (SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
+ any(flag_exposures.variant) AS variant,
+ toDateOrNull(toString(min(toTimeZone(events.timestamp, 'UTC')))) AS day
+ FROM events
+ LEFT OUTER JOIN
+ (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,
+ person_distinct_id_overrides.distinct_id AS distinct_id
+ FROM person_distinct_id_overrides
+ WHERE equals(person_distinct_id_overrides.team_id, 99999)
+ GROUP BY person_distinct_id_overrides.distinct_id
+ HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
+ LEFT JOIN
+ (SELECT person.id AS id,
+ replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'email'), ''), 'null'), '^"|"$', '') AS properties___email
+ FROM person
+ WHERE and(equals(person.team_id, 99999), in(tuple(person.id, person.version),
+ (SELECT person.id AS id, max(person.version) AS version
+ FROM person
+ WHERE equals(person.team_id, 99999)
+ GROUP BY person.id
+ HAVING and(equals(argMax(person.is_deleted, person.version), 0), less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))))))) SETTINGS optimize_aggregation_in_order=1) AS events__person ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), events__person.id)
+ INNER JOIN
+ (SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
+ if(greater(uniqExact(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', '')), 1), '$multiple', any(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''))) AS variant,
+ min(toTimeZone(events.timestamp, 'UTC')) AS first_flag_exposure_time
+ FROM events
+ LEFT OUTER JOIN
+ (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,
+ person_distinct_id_overrides.distinct_id AS distinct_id
+ FROM person_distinct_id_overrides
+ WHERE equals(person_distinct_id_overrides.team_id, 99999)
+ GROUP BY person_distinct_id_overrides.distinct_id
+ HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
+ LEFT JOIN
+ (SELECT person.id AS id,
+ replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'email'), ''), 'null'), '^"|"$', '') AS properties___email
+ FROM person
+ WHERE and(equals(person.team_id, 99999), in(tuple(person.id, person.version),
+ (SELECT person.id AS id, max(person.version) AS version
+ FROM person
+ WHERE equals(person.team_id, 99999)
+ GROUP BY person.id
+ HAVING and(equals(argMax(person.is_deleted, person.version), 0), less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))))))) SETTINGS optimize_aggregation_in_order=1) AS events__person ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), events__person.id)
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(events__person.properties___email), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ GROUP BY entity_id) AS flag_exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), flag_exposures.entity_id)
+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), equals(events.event, 'activated'), ifNull(notILike(toString(events__person.properties___email), '%@posthog.com%'), 1)), greaterOrEquals(events.timestamp, flag_exposures.first_flag_exposure_time))
+ GROUP BY entity_id)
+ SELECT first_exposures.day AS day,
+ first_exposures.variant AS variant,
+ count(first_exposures.entity_id) AS exposed_count
+ FROM first_exposures
+ WHERE notEmpty(variant)
+ GROUP BY first_exposures.day,
+ first_exposures.variant
+ ORDER BY first_exposures.day ASC
+ LIMIT 5000 SETTINGS readonly=2,
+ max_execution_time=600,
+ allow_experimental_object_type=1,
+ max_ast_elements=4000000,
+ max_expanded_ast_elements=4000000,
+ max_bytes_before_external_group_by=0,
+ transform_null_in=1,
+ optimize_min_equality_disjunction_chain_length=4294967295,
+ optimize_rewrite_aggregate_function_with_if=0,
+ optimize_min_inequality_conjunction_chain_length=4294967295,
+ allow_experimental_join_condition=1,
+ use_hive_partitioning=0
+ '''
+# ---
+# name: TestExperimentActivationConfig.test_funnel_metric_counts_conversions_after_activation_only
+ '''
+ WITH exposures AS
+ (SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
+ any(flag_exposures.variant) AS variant,
+ min(toTimeZone(events.timestamp, 'UTC')) AS first_exposure_time,
+ max(toTimeZone(events.timestamp, 'UTC')) AS last_exposure_time,
+ argMin(events.uuid, toTimeZone(events.timestamp, 'UTC')) AS exposure_event_uuid,
+ argMin(events.`$session_id`, toTimeZone(events.timestamp, 'UTC')) AS exposure_session_id
+ FROM events
+ LEFT OUTER JOIN
+ (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,
+ person_distinct_id_overrides.distinct_id AS distinct_id
+ FROM person_distinct_id_overrides
+ WHERE equals(person_distinct_id_overrides.team_id, 99999)
+ GROUP BY person_distinct_id_overrides.distinct_id
+ HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
+ LEFT JOIN
+ (SELECT person.id AS id,
+ replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'email'), ''), 'null'), '^"|"$', '') AS properties___email
+ FROM person
+ WHERE and(equals(person.team_id, 99999), in(tuple(person.id, person.version),
+ (SELECT person.id AS id, max(person.version) AS version
+ FROM person
+ WHERE equals(person.team_id, 99999)
+ GROUP BY person.id
+ HAVING and(equals(argMax(person.is_deleted, person.version), 0), less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))))))) SETTINGS optimize_aggregation_in_order=1) AS events__person ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), events__person.id)
+ INNER JOIN
+ (SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
+ if(greater(uniqExact(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', '')), 1), '$multiple', any(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''))) AS variant,
+ min(toTimeZone(events.timestamp, 'UTC')) AS first_flag_exposure_time
+ FROM events
+ LEFT OUTER JOIN
+ (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,
+ person_distinct_id_overrides.distinct_id AS distinct_id
+ FROM person_distinct_id_overrides
+ WHERE equals(person_distinct_id_overrides.team_id, 99999)
+ GROUP BY person_distinct_id_overrides.distinct_id
+ HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
+ LEFT JOIN
+ (SELECT person.id AS id,
+ replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'email'), ''), 'null'), '^"|"$', '') AS properties___email
+ FROM person
+ WHERE and(equals(person.team_id, 99999), in(tuple(person.id, person.version),
+ (SELECT person.id AS id, max(person.version) AS version
+ FROM person
+ WHERE equals(person.team_id, 99999)
+ GROUP BY person.id
+ HAVING and(equals(argMax(person.is_deleted, person.version), 0), less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))))))) SETTINGS optimize_aggregation_in_order=1) AS events__person ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), events__person.id)
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(events__person.properties___email), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ GROUP BY entity_id) AS flag_exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), flag_exposures.entity_id)
+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), equals(events.event, 'activated'), ifNull(notILike(toString(events__person.properties___email), '%@posthog.com%'), 1)), greaterOrEquals(events.timestamp, flag_exposures.first_flag_exposure_time))
+ GROUP BY entity_id),
+ metric_events AS
+ (SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
+ replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', '') AS variant,
+ toTimeZone(events.timestamp, 'UTC') AS timestamp,
+ events.uuid AS uuid,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), equals(events.event, 'activated'), ifNull(notILike(toString(events__person.properties___email), '%@posthog.com%'), 1)) AS step_0,
+ if(equals(events.event, 'purchase'), 1, 0) AS step_1
+ FROM events
+ LEFT OUTER JOIN
+ (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,
+ person_distinct_id_overrides.distinct_id AS distinct_id
+ FROM person_distinct_id_overrides
+ WHERE equals(person_distinct_id_overrides.team_id, 99999)
+ GROUP BY person_distinct_id_overrides.distinct_id
+ HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
+ LEFT JOIN
+ (SELECT person.id AS id,
+ replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'email'), ''), 'null'), '^"|"$', '') AS properties___email
+ FROM person
+ WHERE and(equals(person.team_id, 99999), in(tuple(person.id, person.version),
+ (SELECT person.id AS id, max(person.version) AS version
+ FROM person
+ WHERE equals(person.team_id, 99999)
+ GROUP BY person.id
+ HAVING and(equals(argMax(person.is_deleted, person.version), 0), less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))))))) SETTINGS optimize_aggregation_in_order=1) AS events__person ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), events__person.id)
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), equals(events.event, 'activated'), ifNull(notILike(toString(events__person.properties___email), '%@posthog.com%'), 1)), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), equals(events.event, 'purchase'))))),
+ entity_metrics AS
+ (SELECT exposures.entity_id AS entity_id,
+ exposures.variant AS variant,
+ arraySort(x -> minus(0, x.1), arrayMap(result -> tuple(result.1, if(and(ifNull(greaterOrEquals(result.1, 0), 0), ifNull(greater(length(result.4), result.1), 0)), if(ifNull(greater(length(arrayElement(result.4, plus(result.1, 1))), 0), 0), toString(arrayElement(result.4, plus(result.1, 1))[1]), ''), '')), aggregate_funnel_array(2, 94608000, 'first_touch', 'ordered', array(array('')), [], arraySort(t -> t.1, arrayFilter(t -> and(isNotNull(t.1), isNotNull(t.2)), groupArray(tuple(accurateCastOrNull(toTimeZone(metric_events.timestamp, 'UTC'), 'Float64'), metric_events.uuid, array(''), arrayFilter(x -> ifNull(greater(x, 0), 0), [multiply(1, metric_events.step_0), multiply(2, metric_events.step_1)]))))))))[1] AS value
+ FROM exposures
+ LEFT JOIN metric_events ON and(equals(exposures.entity_id, metric_events.entity_id), greaterOrEquals(toTimeZone(metric_events.timestamp, 'UTC'), toTimeZone(exposures.first_exposure_time, 'UTC')))
+ GROUP BY exposures.entity_id,
+ exposures.variant)
+ SELECT entity_metrics.variant AS variant,
+ count(entity_metrics.entity_id) AS num_users,
+ countIf(ifNull(equals((entity_metrics.value).1, 1), 0)) AS total_sum,
+ countIf(ifNull(equals((entity_metrics.value).1, 1), 0)) AS total_sum_of_squares,
+ tuple(countIf(ifNull(greaterOrEquals((entity_metrics.value).1, 1), 0))) AS step_counts
+ FROM entity_metrics
+ WHERE notEmpty(variant)
+ GROUP BY entity_metrics.variant
+ LIMIT 50000 SETTINGS readonly=2,
+ max_execution_time=600,
+ allow_experimental_object_type=1,
+ max_ast_elements=4000000,
+ max_expanded_ast_elements=4000000,
+ max_bytes_before_external_group_by=39728447488,
+ transform_null_in=1,
+ optimize_min_equality_disjunction_chain_length=4294967295,
+ optimize_rewrite_aggregate_function_with_if=0,
+ optimize_min_inequality_conjunction_chain_length=4294967295,
+ allow_experimental_join_condition=1,
+ use_hive_partitioning=0
+ '''
+# ---
+# name: TestExperimentActivationConfig.test_mean_metric_anchors_exposure_on_activation_event
+ '''
+ WITH exposures AS
+ (SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
+ any(flag_exposures.variant) AS variant,
+ min(toTimeZone(events.timestamp, 'UTC')) AS first_exposure_time,
+ max(toTimeZone(events.timestamp, 'UTC')) AS last_exposure_time,
+ argMin(events.uuid, toTimeZone(events.timestamp, 'UTC')) AS exposure_event_uuid,
+ argMin(events.`$session_id`, toTimeZone(events.timestamp, 'UTC')) AS exposure_session_id
+ FROM events
+ LEFT OUTER JOIN
+ (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,
+ person_distinct_id_overrides.distinct_id AS distinct_id
+ FROM person_distinct_id_overrides
+ WHERE equals(person_distinct_id_overrides.team_id, 99999)
+ GROUP BY person_distinct_id_overrides.distinct_id
+ HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
+ LEFT JOIN
+ (SELECT person.id AS id,
+ replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'email'), ''), 'null'), '^"|"$', '') AS properties___email
+ FROM person
+ WHERE and(equals(person.team_id, 99999), in(tuple(person.id, person.version),
+ (SELECT person.id AS id, max(person.version) AS version
+ FROM person
+ WHERE equals(person.team_id, 99999)
+ GROUP BY person.id
+ HAVING and(equals(argMax(person.is_deleted, person.version), 0), less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))))))) SETTINGS optimize_aggregation_in_order=1) AS events__person ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), events__person.id)
+ INNER JOIN
+ (SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
+ if(greater(uniqExact(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', '')), 1), '$multiple', any(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''))) AS variant,
+ min(toTimeZone(events.timestamp, 'UTC')) AS first_flag_exposure_time
+ FROM events
+ LEFT OUTER JOIN
+ (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,
+ person_distinct_id_overrides.distinct_id AS distinct_id
+ FROM person_distinct_id_overrides
+ WHERE equals(person_distinct_id_overrides.team_id, 99999)
+ GROUP BY person_distinct_id_overrides.distinct_id
+ HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
+ LEFT JOIN
+ (SELECT person.id AS id,
+ replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'email'), ''), 'null'), '^"|"$', '') AS properties___email
+ FROM person
+ WHERE and(equals(person.team_id, 99999), in(tuple(person.id, person.version),
+ (SELECT person.id AS id, max(person.version) AS version
+ FROM person
+ WHERE equals(person.team_id, 99999)
+ GROUP BY person.id
+ HAVING and(equals(argMax(person.is_deleted, person.version), 0), less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))))))) SETTINGS optimize_aggregation_in_order=1) AS events__person ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), events__person.id)
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(events__person.properties___email), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ GROUP BY entity_id) AS flag_exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), flag_exposures.entity_id)
+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), equals(events.event, 'activated'), ifNull(notILike(toString(events__person.properties___email), '%@posthog.com%'), 1)), greaterOrEquals(events.timestamp, flag_exposures.first_flag_exposure_time))
+ GROUP BY entity_id),
+ metric_events AS
+ (SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
+ toTimeZone(events.timestamp, 'UTC') AS timestamp,
+ coalesce(accurateCastOrNull(1, 'Float64'), 0) AS value
+ FROM events
+ LEFT OUTER JOIN
+ (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,
+ person_distinct_id_overrides.distinct_id AS distinct_id
+ FROM person_distinct_id_overrides
+ WHERE equals(person_distinct_id_overrides.team_id, 99999)
+ GROUP BY person_distinct_id_overrides.distinct_id
+ HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),
+ entity_metrics AS
+ (SELECT exposures.entity_id AS entity_id,
+ exposures.variant AS variant,
+ sum(coalesce(accurateCastOrNull(metric_events.value, 'Float64'), 0)) AS value
+ FROM exposures
+ LEFT JOIN metric_events ON and(equals(exposures.entity_id, metric_events.entity_id), greaterOrEquals(toTimeZone(metric_events.timestamp, 'UTC'), toTimeZone(exposures.first_exposure_time, 'UTC')))
+ GROUP BY exposures.entity_id,
+ exposures.variant)
+ SELECT entity_metrics.variant AS variant,
+ count(entity_metrics.entity_id) AS num_users,
+ sum(entity_metrics.value) AS total_sum,
+ sum(power(entity_metrics.value, 2)) AS total_sum_of_squares
+ FROM entity_metrics
+ GROUP BY entity_metrics.variant
+ LIMIT 50000 SETTINGS join_algorithm='grace_hash',
+ grace_hash_join_initial_buckets=2,
+ readonly=2,
+ max_execution_time=600,
+ allow_experimental_object_type=1,
+ max_ast_elements=4000000,
+ max_expanded_ast_elements=4000000,
+ max_bytes_before_external_group_by=39728447488,
+ transform_null_in=1,
+ optimize_min_equality_disjunction_chain_length=4294967295,
+ optimize_rewrite_aggregate_function_with_if=0,
+ optimize_min_inequality_conjunction_chain_length=4294967295,
+ allow_experimental_join_condition=1,
+ use_hive_partitioning=0
+ '''
+# ---
diff --git a/products/experiments/backend/hogql_queries/test/experiment_query_runner/test_activation_config.py b/products/experiments/backend/hogql_queries/test/experiment_query_runner/test_activation_config.py
new file mode 100644
index 000000000000..660fb1f44fd0
--- /dev/null
+++ b/products/experiments/backend/hogql_queries/test/experiment_query_runner/test_activation_config.py
@@ -0,0 +1,235 @@
+from datetime import datetime
+from typing import cast
+
+from freezegun import freeze_time
+from posthog.test.base import _create_event, _create_person, flush_persons_and_events, snapshot_clickhouse_queries
+
+from django.forms.models import model_to_dict
+from django.test import override_settings
+
+from posthog.schema import (
+ EventsNode,
+ ExperimentExposureQuery,
+ ExperimentFunnelMetric,
+ ExperimentMeanMetric,
+ ExperimentQuery,
+ ExperimentQueryResponse,
+)
+
+from products.analytics_platform.backend.models.preaggregation_job import PreaggregationJob
+from products.experiments.backend.hogql_queries.experiment_exposures_query_runner import ExperimentExposuresQueryRunner
+from products.experiments.backend.hogql_queries.experiment_query_runner import ExperimentQueryRunner
+from products.experiments.backend.hogql_queries.test.experiment_query_runner.base import ExperimentQueryRunnerBaseTest
+
+ACTIVATION_CRITERIA = {
+ "activation_config": {
+ "kind": "ExperimentEventExposureConfig",
+ "event": "activated",
+ "properties": [],
+ }
+}
+
+
+@override_settings(IN_UNIT_TESTING=True)
+class TestExperimentActivationConfig(ExperimentQueryRunnerBaseTest):
+ snapshot_replace_all_numbers = True
+
+ def _create_flag_exposure(self, distinct_id, feature_flag, variant, timestamp):
+ _create_event(
+ team=self.team,
+ event="$feature_flag_called",
+ distinct_id=distinct_id,
+ timestamp=timestamp,
+ properties={
+ "$feature_flag_response": variant,
+ "$feature_flag": feature_flag.key,
+ },
+ )
+
+ # Activation and metric events deliberately carry no $feature/<key> property:
+ # activation mode must work without flag properties stamped on other events.
+ def _create_plain_event(self, distinct_id, event, timestamp):
+ _create_event(
+ team=self.team,
+ event=event,
+ distinct_id=distinct_id,
+ timestamp=timestamp,
+ properties={},
+ )
+
+ def _create_activation_experiment(self, feature_flag):
+ experiment = self.create_experiment(
+ feature_flag=feature_flag,
+ start_date=datetime(2020, 1, 1),
+ end_date=datetime(2020, 1, 10),
+ )
+ experiment.stats_config = {"method": "frequentist"}
+ experiment.exposure_criteria = ACTIVATION_CRITERIA
+ return experiment
+
+ def _seed_mean_scenario(self, feature_flag):
+ for variant, extra_purchases in (("control", 0), ("test", 1)):
+ for i in range(3):
+ user = f"user_{variant}_{i}"
+ _create_person(distinct_ids=[user], team_id=self.team.pk)
+ self._create_flag_exposure(user, feature_flag, variant, "2020-01-02T12:00:00Z")
+ # Purchase between flag exposure and activation must not count
+ self._create_plain_event(user, "purchase", "2020-01-02T12:10:00Z")
+ self._create_plain_event(user, "activated", "2020-01-02T12:30:00Z")
+ self._create_plain_event(user, "purchase", "2020-01-02T12:40:00Z")
+ for j in range(extra_purchases):
+ self._create_plain_event(user, "purchase", f"2020-01-02T12:5{j}:00Z")
+
+ # Flag exposure but never activated: not part of the analysis
+ _create_person(distinct_ids=["user_flag_only"], team_id=self.team.pk)
+ self._create_flag_exposure("user_flag_only", feature_flag, "control", "2020-01-02T12:00:00Z")
+ self._create_plain_event("user_flag_only", "purchase", "2020-01-02T12:10:00Z")
+
+ # Activated only before the flag exposure: ordering not satisfied
+ _create_person(distinct_ids=["user_pre_activation"], team_id=self.team.pk)
+ self._create_plain_event("user_pre_activation", "activated", "2020-01-02T11:00:00Z")
+ self._create_flag_exposure("user_pre_activation", feature_flag, "control", "2020-01-02T12:00:00Z")
+ self._create_plain_event("user_pre_activation", "purchase", "2020-01-02T12:10:00Z")
+
+ # Saw both variants: excluded by default multiple-variant handling
+ _create_person(distinct_ids=["user_multi_variant"], team_id=self.team.pk)
+ self._create_flag_exposure("user_multi_variant", feature_flag, "control", "2020-01-02T12:00:00Z")
+ self._create_flag_exposure("user_multi_variant", feature_flag, "test", "2020-01-02T12:05:00Z")
+ self._create_plain_event("user_multi_variant", "activated", "2020-01-02T12:30:00Z")
+ self._create_plain_event("user_multi_variant", "purchase", "2020-01-02T12:40:00Z")
+
+ flush_persons_and_events()
+
+ def _assert_mean_scenario_results(self, experiment, metric):
+ query = ExperimentQuery(experiment_id=experiment.id, kind="ExperimentQuery", metric=metric)
+ result = cast(ExperimentQueryResponse, ExperimentQueryRunner(query=query, team=self.team).calculate())
+
+ assert result.baseline is not None
+ assert result.variant_results is not None
+ self.assertEqual(len(result.variant_results), 1)
+
+ control_variant = result.baseline
+ test_variant = result.variant_results[0]
+
+ self.assertEqual(control_variant.number_of_samples, 3)
+ self.assertEqual(test_variant.number_of_samples, 3)
+ self.assertEqual(control_variant.sum, 3)
+ self.assertEqual(test_variant.sum, 6)
+
+ @freeze_time("2020-01-10T12:00:00Z")
+ @snapshot_clickhouse_queries
+ def test_mean_metric_anchors_exposure_on_activation_event(self):
+ feature_flag = self.create_feature_flag()
+ experiment = self._create_activation_experiment(feature_flag)
+
+ metric = ExperimentMeanMetric(source=EventsNode(event="purchase"))
+ experiment.metrics = [metric.model_dump(mode="json")]
+ experiment.save()
+
+ self._seed_mean_scenario(feature_flag)
+ self._assert_mean_scenario_results(experiment, metric)
+
+ @freeze_time("2020-01-10T12:00:00Z")
+ def test_team_precomputation_does_not_change_activation_results(self):
+ self._setup_precomputation_test(True)
+
+ feature_flag = self.create_feature_flag()
+ experiment = self._create_activation_experiment(feature_flag)
+
+ metric = ExperimentMeanMetric(source=EventsNode(event="purchase"))
+ experiment.metrics = [metric.model_dump(mode="json")]
+ self._save_experiment_with_precomputation(experiment, True)
+
+ self._seed_mean_scenario(feature_flag)
+ # The per-day exposure cache is built from the flag predicate alone: reading it would
+ # pull flag-only and pre-activation users into the denominator and anchor metrics on
+ # the flag time. Activation mode must produce identical results with precompute on.
+ self._assert_mean_scenario_results(experiment, metric)
+ self.assertEqual(PreaggregationJob.objects.count(), 0)
+
+ @freeze_time("2020-01-10T12:00:00Z")
+ @snapshot_clickhouse_queries
+ def test_funnel_metric_counts_conversions_after_activation_only(self):
+ feature_flag = self.create_feature_flag()
+ experiment = self._create_activation_experiment(feature_flag)
+
+ metric = ExperimentFunnelMetric(series=[EventsNode(event="purchase")])
+ experiment.metrics = [metric.model_dump(mode="json")]
+ experiment.save()
+
+ for variant in ("control", "test"):
+ # Converts: flag -> activated -> purchase
+ converter = f"user_{variant}_converts"
+ _create_person(distinct_ids=[converter], team_id=self.team.pk)
+ self._create_flag_exposure(converter, feature_flag, variant, "2020-01-02T12:00:00Z")
+ self._create_plain_event(converter, "activated", "2020-01-02T12:30:00Z")
+ self._create_plain_event(converter, "purchase", "2020-01-02T12:40:00Z")
+
+ # Exposed, but purchased before activating: no conversion
+ early_buyer = f"user_{variant}_early"
+ _create_person(distinct_ids=[early_buyer], team_id=self.team.pk)
+ self._create_flag_exposure(early_buyer, feature_flag, variant, "2020-01-02T12:00:00Z")
+ self._create_plain_event(early_buyer, "purchase", "2020-01-02T12:10:00Z")
+ self._create_plain_event(early_buyer, "activated", "2020-01-02T12:30:00Z")
+
+ flush_persons_and_events()
+
+ query = ExperimentQuery(experiment_id=experiment.id, kind="ExperimentQuery", metric=metric)
+ result = cast(ExperimentQueryResponse, ExperimentQueryRunner(query=query, team=self.team).calculate())
+
+ assert result.baseline is not None
+ assert result.variant_results is not None
+
+ control_variant = result.baseline
+ test_variant = result.variant_results[0]
+
+ self.assertEqual(control_variant.number_of_samples, 2)
+ self.assertEqual(test_variant.number_of_samples, 2)
+ self.assertEqual(control_variant.sum, 1) # success_count
+ self.assertEqual(test_variant.sum, 1) # success_count
+
+ @freeze_time("2020-01-10T12:00:00Z")
+ @snapshot_clickhouse_queries
+ def test_exposures_timeseries_counts_users_on_activation_day(self):
+ feature_flag = self.create_feature_flag()
+ experiment = self._create_activation_experiment(feature_flag)
+ experiment.save()
+
+ # Control: flag on Jan 2, activated on Jan 4 -> exposed on Jan 4
+ _create_person(distinct_ids=["user_control"], team_id=self.team.pk)
+ self._create_flag_exposure("user_control", feature_flag, "control", "2020-01-02T12:00:00Z")
+ self._create_plain_event("user_control", "activated", "2020-01-04T12:00:00Z")
+
+ # Control: flag only, never activated -> not exposed
+ _create_person(distinct_ids=["user_control_flag_only"], team_id=self.team.pk)
+ self._create_flag_exposure("user_control_flag_only", feature_flag, "control", "2020-01-02T12:00:00Z")
+
+ # Test: flag and activation on Jan 2 -> exposed on Jan 2
+ _create_person(distinct_ids=["user_test"], team_id=self.team.pk)
+ self._create_flag_exposure("user_test", feature_flag, "test", "2020-01-02T12:00:00Z")
+ self._create_plain_event("user_test", "activated", "2020-01-02T13:00:00Z")
+
+ flush_persons_and_events()
+
+ query = ExperimentExposureQuery(
+ kind="ExperimentExposureQuery",
+ experiment_id=experiment.id,
+ experiment_name=experiment.name,
+ feature_flag=model_to_dict(feature_flag),
+ holdout=None,
+ start_date=experiment.start_date.isoformat() if experiment.start_date else None,
+ end_date=experiment.end_date.isoformat() if experiment.end_date else None,
+ exposure_criteria=experiment.exposure_criteria,
+ )
+ response = ExperimentExposuresQueryRunner(team=self.team, query=query).calculate()
+
+ self.assertEqual(response.total_exposures, {"control": 1, "test": 1})
+
+ control_series = next(series for series in response.timeseries if series.variant == "control")
+ test_series = next(series for series in response.timeseries if series.variant == "test")
+
+ # Cumulative counts flip to 1 on the activation day, not the flag day
+ control_first_exposed_day = control_series.days[control_series.exposure_counts.index(1)]
+ test_first_exposed_day = test_series.days[test_series.exposure_counts.index(1)]
+ self.assertEqual(control_first_exposed_day, "2020-01-04")
+ self.assertEqual(test_first_exposed_day, "2020-01-02")
diff --git a/products/experiments/backend/hogql_queries/test/test_experiment_exposure_preaggregation.py b/products/experiments/backend/hogql_queries/test/test_experiment_exposure_preaggregation.py
index 46c20e7bf52f..6e52950e9880 100644
--- a/products/experiments/backend/hogql_queries/test/test_experiment_exposure_preaggregation.py
+++ b/products/experiments/backend/hogql_queries/test/test_experiment_exposure_preaggregation.py
@@ -67,7 +67,7 @@ class TestExperimentExposurePreaggregation(ExperimentQueryRunnerBaseTest):
return cast(ExperimentQueryResponse, runner.calculate())
def _build_lazy_computation_builder(self, experiment, feature_flag, metric) -> ExperimentQueryBuilder:
- exposure_config, multiple_variant_handling, filter_test_accounts = get_exposure_config_params_for_builder(
+ exposure_params = get_exposure_config_params_for_builder(
experiment.exposure_criteria, experiment.team, experiment.start_date
)
as_of = experiment.end_date or datetime.now(UTC)
@@ -75,9 +75,9 @@ class TestExperimentExposurePreaggregation(ExperimentQueryRunnerBaseTest):
return ExperimentQueryBuilder(
team=self.team,
feature_flag_key=feature_flag.key,
- exposure_config=exposure_config,
- filter_test_accounts=filter_test_accounts,
- multiple_variant_handling=multiple_variant_handling,
+ exposure_config=exposure_params.exposure_config,
+ filter_test_accounts=exposure_params.filter_test_accounts,
+ multiple_variant_handling=exposure_params.multiple_variant_handling,
variants=[v["key"] for v in feature_flag.variants],
date_range_query=QueryDateRange(
date_range=date_range, team=self.team, interval=IntervalType.DAY, now=as_of
diff --git a/products/experiments/backend/hogql_queries/test/test_experiment_funnel_metric_events_preaggregation.py b/products/experiments/backend/hogql_queries/test/test_experiment_funnel_metric_events_preaggregation.py
index 505e0fdaa99b..29b7048e4d91 100644
--- a/products/experiments/backend/hogql_queries/test/test_experiment_funnel_metric_events_preaggregation.py
+++ b/products/experiments/backend/hogql_queries/test/test_experiment_funnel_metric_events_preaggregation.py
@@ -54,7 +54,7 @@ class TestExperimentFunnelMetricEventsPreaggregation(ExperimentQueryRunnerBaseTe
def _build_lazy_computation_builder(
self, experiment, feature_flag, metric, as_of: datetime | None = None
) -> ExperimentQueryBuilder:
- exposure_config, multiple_variant_handling, filter_test_accounts = get_exposure_config_params_for_builder(
+ exposure_params = get_exposure_config_params_for_builder(
experiment.exposure_criteria, experiment.team, experiment.start_date
)
as_of = as_of if as_of is not None else datetime.now(UTC)
@@ -62,9 +62,9 @@ class TestExperimentFunnelMetricEventsPreaggregation(ExperimentQueryRunnerBaseTe
return ExperimentQueryBuilder(
team=self.team,
feature_flag_key=feature_flag.key,
- exposure_config=exposure_config,
- filter_test_accounts=filter_test_accounts,
- multiple_variant_handling=multiple_variant_handling,
+ exposure_config=exposure_params.exposure_config,
+ filter_test_accounts=exposure_params.filter_test_accounts,
+ multiple_variant_handling=exposure_params.multiple_variant_handling,
variants=[v["key"] for v in feature_flag.variants],
date_range_query=QueryDateRange(
date_range=date_range,
diff --git a/products/experiments/backend/hogql_queries/test/test_experiment_mean_metric_events_preaggregation.py b/products/experiments/backend/hogql_queries/test/test_experiment_mean_metric_events_preaggregation.py
index be21c129b453..ee0d111ba251 100644
--- a/products/experiments/backend/hogql_queries/test/test_experiment_mean_metric_events_preaggregation.py
+++ b/products/experiments/backend/hogql_queries/test/test_experiment_mean_metric_events_preaggregation.py
@@ -36,7 +36,7 @@ class TestExperimentMeanMetricEventsPreaggregation(ExperimentQueryRunnerBaseTest
def _build_lazy_computation_builder(
self, experiment, feature_flag, metric, as_of: datetime | None = None
) -> ExperimentQueryBuilder:
- exposure_config, multiple_variant_handling, filter_test_accounts = get_exposure_config_params_for_builder(
+ exposure_params = get_exposure_config_params_for_builder(
experiment.exposure_criteria, experiment.team, experiment.start_date
)
as_of = as_of if as_of is not None else datetime.now(UTC)
@@ -44,9 +44,9 @@ class TestExperimentMeanMetricEventsPreaggregation(ExperimentQueryRunnerBaseTest
return ExperimentQueryBuilder(
team=self.team,
feature_flag_key=feature_flag.key,
- exposure_config=exposure_config,
- filter_test_accounts=filter_test_accounts,
- multiple_variant_handling=multiple_variant_handling,
+ exposure_config=exposure_params.exposure_config,
+ filter_test_accounts=exposure_params.filter_test_accounts,
+ multiple_variant_handling=exposure_params.multiple_variant_handling,
variants=[v["key"] for v in feature_flag.variants],
date_range_query=QueryDateRange(
date_range=date_range,
diff --git a/products/experiments/backend/hogql_queries/test/test_experiment_retention_metric_events_preaggregation.py b/products/experiments/backend/hogql_queries/test/test_experiment_retention_metric_events_preaggregation.py
index 5469d22cc944..849b25f502a4 100644
--- a/products/experiments/backend/hogql_queries/test/test_experiment_retention_metric_events_preaggregation.py
+++ b/products/experiments/backend/hogql_queries/test/test_experiment_retention_metric_events_preaggregation.py
@@ -65,7 +65,7 @@ class TestExperimentRetentionMetricEventsPreaggregation(ExperimentQueryRunnerBas
def _build_lazy_computation_builder(
self, experiment, feature_flag, metric, as_of: datetime | None = None
) -> ExperimentQueryBuilder:
- exposure_config, multiple_variant_handling, filter_test_accounts = get_exposure_config_params_for_builder(
+ exposure_params = get_exposure_config_params_for_builder(
experiment.exposure_criteria, experiment.team, experiment.start_date
)
as_of = as_of if as_of is not None else datetime.now(UTC)
@@ -73,9 +73,9 @@ class TestExperimentRetentionMetricEventsPreaggregation(ExperimentQueryRunnerBas
return ExperimentQueryBuilder(
team=self.team,
feature_flag_key=feature_flag.key,
- exposure_config=exposure_config,
- filter_test_accounts=filter_test_accounts,
- multiple_variant_handling=multiple_variant_handling,
+ exposure_config=exposure_params.exposure_config,
+ filter_test_accounts=exposure_params.filter_test_accounts,
+ multiple_variant_handling=exposure_params.multiple_variant_handling,
variants=[v["key"] for v in feature_flag.variants],
date_range_query=QueryDateRange(
date_range=date_range,
diff --git a/products/experiments/backend/hogql_queries/test/test_exposure_query_logic.py b/products/experiments/backend/hogql_queries/test/test_exposure_query_logic.py
index cf0b143387d6..959c8a034d15 100644
--- a/products/experiments/backend/hogql_queries/test/test_exposure_query_logic.py
+++ b/products/experiments/backend/hogql_queries/test/test_exposure_query_logic.py
@@ -105,6 +105,15 @@ class TestNormalizeToExposureCriteria:
assert isinstance(result.exposure_config, ExperimentEventExposureConfig)
assert result.exposure_config.event == "test_event"
+ def test_converts_nested_activation_config(self):
+ input_dict = {"activation_config": {"event": "purchase", "properties": []}}
+
+ result = normalize_to_exposure_criteria(input_dict)
+
+ assert result is not None
+ assert isinstance(result.activation_config, ExperimentEventExposureConfig)
+ assert result.activation_config.event == "purchase"
+
def test_preserves_already_typed_object(self):
typed_criteria = ExperimentExposureCriteria()
diff --git a/products/experiments/backend/test/test_experiment_service.py b/products/experiments/backend/test/test_experiment_service.py
index f356fc3e78fe..d1166fb48361 100644
--- a/products/experiments/backend/test/test_experiment_service.py
+++ b/products/experiments/backend/test/test_experiment_service.py
@@ -796,6 +796,19 @@ class TestExperimentService(APIBaseTest):
{"exposure_config": {"kind": "ActionsNode"}},
"Invalid exposure_criteria.exposure_config (kind='ActionsNode')",
),
+ (
+ "activation_config_not_a_dict",
+ {"activation_config": "purchase"},
+ "exposure_criteria.activation_config must be an object, got str",
+ ),
+ (
+ "activation_config_with_custom_exposure",
+ {
+ "exposure_config": {"event": "$pageview", "properties": []},
+ "activation_config": {"event": "purchase", "properties": []},
+ },
+ "exposure_criteria.activation_config requires the default exposure event",
+ ),
]
)
def test_validate_experiment_exposure_criteria_rejects_invalid_payloads(
@@ -834,6 +847,35 @@ class TestExperimentService(APIBaseTest):
"event_payload_without_explicit_kind",
{"exposure_config": {"event": "$pageview", "properties": []}},
),
+ (
+ "activation_payload",
+ {"activation_config": {"event": "purchase", "properties": []}},
+ ),
+ (
+ "explicit_null_configs",
+ {"exposure_config": None, "activation_config": None},
+ ),
+ (
+ "null_activation_with_custom_exposure",
+ {
+ "exposure_config": {"event": "$pageview", "properties": []},
+ "activation_config": None,
+ },
+ ),
+ (
+ "activation_with_default_exposure_config",
+ {
+ "exposure_config": {"event": "$feature_flag_called", "properties": []},
+ "activation_config": {"event": "purchase", "properties": []},
+ },
+ ),
+ (
+ "activation_with_pinned_exposure_event",
+ {
+ "exposure_config": {"event": "$experiment_exposure", "properties": []},
+ "activation_config": {"event": "purchase", "properties": []},
+ },
+ ),
]
)
def test_validate_experiment_exposure_criteria_accepts_valid_payloads(
diff --git a/products/experiments/frontend/generated/api.schemas.ts b/products/experiments/frontend/generated/api.schemas.ts
index 5d57c0f0b332..4b2ea4a55af1 100644
--- a/products/experiments/frontend/generated/api.schemas.ts
+++ b/products/experiments/frontend/generated/api.schemas.ts
@@ -1244,6 +1244,8 @@ export const MultipleVariantHandlingApi = {
} as const
export interface ExperimentApiExposureCriteriaApi {
+ /** Additional event (or action) an entity must emit at/after their first default exposure event before they count as exposed; exposure time becomes this event's timestamp. Only valid with the default exposure event, not a custom `exposure_config`. */
+ activation_config?: ExperimentApiExposureConfigApi | null
exposure_config?: ExperimentApiExposureConfigApi | null
filterTestAccounts?: boolean | null
/** How to handle entities exposed to multiple variants. 'exclude' (default) drops them from the analysis; 'first_seen' assigns them to the variant from their earliest exposure. */
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 3861475393da..2754bfbf41b6 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -29175,6 +29175,8 @@ export namespace Schemas {
}
export interface ExperimentApiExposureCriteria {
+ /** Additional event (or action) an entity must emit at/after their first default exposure event before they count as exposed; exposure time becomes this event's timestamp. Only valid with the default exposure event, not a custom `exposure_config`. */
+ activation_config?: ExperimentApiExposureConfig | null;
exposure_config?: ExperimentApiExposureConfig | null;
filterTestAccounts?: boolean | null;
/** How to handle entities exposed to multiple variants. 'exclude' (default) drops them from the analysis; 'first_seen' assigns them to the variant from their earliest exposure. */
@@ -29491,6 +29493,8 @@ export namespace Schemas {
}
export interface ExperimentExposureCriteria {
+ /** Additional event (or action) an entity must emit at/after their first default exposure event before they count as exposed; exposure time becomes this event's timestamp. Only valid with the default exposure event, not a custom `exposure_config`. */
+ activation_config?: ExperimentEventExposureConfig | ActionsNode | null;
exposure_config?: ExperimentEventExposureConfig | ActionsNode | null;
filterTestAccounts?: boolean | null;
multiple_variant_handling?: MultipleVariantHandling | null;
diff --git a/services/mcp/src/generated/experiments/api.ts b/services/mcp/src/generated/experiments/api.ts
index 2debb7f8e53b..81c4e60694bc 100644
--- a/services/mcp/src/generated/experiments/api.ts
+++ b/services/mcp/src/generated/experiments/api.ts
@@ -759,6 +759,31 @@ export const experimentsCreateBodyFeatureFlagOneFiltersOneMultivariateOneVariant
export const experimentsCreateBodyFeatureFlagOneFiltersOneMultivariateOneVariantsItemRolloutPercentageMax = 100
export const experimentsCreateBodyArchivedDefault = false
+export const experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOneOperatorDefault = `exact`
+export const experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOneTypeDefault = `event`
+export const experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemTwoTypeDefault = `person`
+export const experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemThreeTypeDefault = `person_metadata`
+export const experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemFourTypeDefault = `element`
+export const experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemFiveTypeDefault = `event_metadata`
+export const experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemSixTypeDefault = `session`
+export const experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemSevenKeyDefault = `id`
+export const experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemSevenOperatorDefault = `in`
+export const experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemSevenTypeDefault = `cohort`
+export const experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemEightTypeDefault = `recording`
+export const experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemNineTypeDefault = `log_entry`
+export const experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnezeroTypeDefault = `group`
+export const experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOneoneTypeDefault = `feature`
+export const experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnetwoOperatorDefault = `flag_evaluates_to`
+export const experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnetwoTypeDefault = `flag`
+export const experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnethreeTypeDefault = `hogql`
+export const experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnefourTypeDefault = `empty`
+export const experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnefiveTypeDefault = `data_warehouse`
+export const experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnesixTypeDefault = `data_warehouse_person_property`
+export const experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnesevenTypeDefault = `error_tracking_issue`
+export const experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnenineTypeDefault = `metric_attribute`
+export const experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemTwooneTypeDefault = `revenue_analytics`
+export const experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemTwotwoTypeDefault = `account_custom_property`
+export const experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemTwothreeTypeDefault = `workflow_variable`
export const experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOneOperatorDefault = `exact`
export const experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOneTypeDefault = `event`
export const experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwoTypeDefault = `person`
@@ -1080,7 +1105,7 @@ export const ExperimentsCreateBody = /* @__PURE__ */ zod
exposure_criteria: zod
.union([
zod.object({
- exposure_config: zod
+ activation_config: zod
.union([
zod.object({
event: zod
@@ -1150,12 +1175,12 @@ export const ExperimentsCreateBody = /* @__PURE__ */ zod
zod.null(),
])
.default(
- experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOneOperatorDefault
+ experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOneOperatorDefault
),
type: zod
.literal('event')
.default(
- experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOneTypeDefault
+ experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOneTypeDefault
)
.describe('Event properties'),
value: zod
@@ -1216,7 +1241,7 @@ export const ExperimentsCreateBody = /* @__PURE__ */ zod
type: zod
.literal('person')
.default(
- experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwoTypeDefault
+ experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemTwoTypeDefault
)
.describe('Person properties'),
value: zod
@@ -1277,7 +1302,7 @@ export const ExperimentsCreateBody = /* @__PURE__ */ zod
type: zod
.literal('person_metadata')
.default(
- experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemThreeTypeDefault
+ experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemThreeTypeDefault
)
.describe(
'Top-level columns on the persons table (e.g. created_at), not properties JSON'
@@ -1340,7 +1365,7 @@ export const ExperimentsCreateBody = /* @__PURE__ */ zod
type: zod
.literal('element')
.default(
- experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemFourTypeDefault
+ experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemFourTypeDefault
),
value: zod
.union([
@@ -1400,7 +1425,7 @@ export const ExperimentsCreateBody = /* @__PURE__ */ zod
type: zod
.literal('event_metadata')
.default(
- experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemFiveTypeDefault
+ experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemFiveTypeDefault
),
value: zod
.union([
@@ -1460,7 +1485,7 @@ export const ExperimentsCreateBody = /* @__PURE__ */ zod
type: zod
.literal('session')
.default(
- experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemSixTypeDefault
+ experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemSixTypeDefault
),
value: zod
.union([
@@ -1479,7 +1504,7 @@ export const ExperimentsCreateBody = /* @__PURE__ */ zod
key: zod
.literal('id')
.default(
- experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemSevenKeyDefault
+ experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemSevenKeyDefault
),
label: zod.union([zod.string(), zod.null()]).optional(),
operator: zod
@@ -1527,12 +1552,12 @@ export const ExperimentsCreateBody = /* @__PURE__ */ zod
zod.null(),
])
.default(
- experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemSevenOperatorDefault
+ experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemSevenOperatorDefault
),
type: zod
.literal('cohort')
.default(
- experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemSevenTypeDefault
+ experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemSevenTypeDefault
),
value: zod.number(),
}),
@@ -1585,7 +1610,7 @@ export const ExperimentsCreateBody = /* @__PURE__ */ zod
type: zod
.literal('recording')
.default(
- experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemEightTypeDefault
+ experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemEightTypeDefault
),
value: zod
.union([
@@ -1645,7 +1670,7 @@ export const ExperimentsCreateBody = /* @__PURE__ */ zod
type: zod
.literal('log_entry')
.default(
- experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemNineTypeDefault
+ experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemNineTypeDefault
),
value: zod
.union([
@@ -1709,7 +1734,7 @@ export const ExperimentsCreateBody = /* @__PURE__ */ zod
type: zod
.literal('group')
.default(
- experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnezeroTypeDefault
+ experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnezeroTypeDefault
),
value: zod
.union([
@@ -1769,7 +1794,7 @@ export const ExperimentsCreateBody = /* @__PURE__ */ zod
type: zod
.literal('feature')
.default(
- experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOneoneTypeDefault
+ experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOneoneTypeDefault
)
.describe('Event property with \"$feature\/\" prepended'),
value: zod
@@ -1790,7 +1815,7 @@ export const ExperimentsCreateBody = /* @__PURE__ */ zod
operator: zod
.literal('flag_evaluates_to')
.default(
- experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnetwoOperatorDefault
+ experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnetwoOperatorDefault
)
.describe(
'Only flag_evaluates_to operator is allowed for flag dependencies'
@@ -1798,7 +1823,7 @@ export const ExperimentsCreateBody = /* @__PURE__ */ zod
type: zod
.literal('flag')
.default(
- experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnetwoTypeDefault
+ experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnetwoTypeDefault
)
.describe('Feature flag dependency'),
value: zod
@@ -1811,7 +1836,7 @@ export const ExperimentsCreateBody = /* @__PURE__ */ zod
type: zod
.literal('hogql')
.default(
- experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnethreeTypeDefault
+ experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnethreeTypeDefault
),
value: zod
.union([
@@ -1829,7 +1854,7 @@ export const ExperimentsCreateBody = /* @__PURE__ */ zod
type: zod
.literal('empty')
.default(
- experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnefourTypeDefault
+ experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnefourTypeDefault
),
}),
zod.object({
@@ -1878,7 +1903,7 @@ export const ExperimentsCreateBody = /* @__PURE__ */ zod
type: zod
.literal('data_warehouse')
.default(
- experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnefiveTypeDefault
+ experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnefiveTypeDefault
),
value: zod
.union([
@@ -1938,7 +1963,7 @@ export const ExperimentsCreateBody = /* @__PURE__ */ zod
type: zod
.literal('data_warehouse_person_property')
.default(
- experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnesixTypeDefault
+ experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnesixTypeDefault
),
value: zod
.union([
@@ -1998,7 +2023,7 @@ export const ExperimentsCreateBody = /* @__PURE__ */ zod
type: zod
.literal('error_tracking_issue')
.default(
- experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnesevenTypeDefault
+ experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnesevenTypeDefault
),
value: zod
.union([
@@ -2114,7 +2139,7 @@ export const ExperimentsCreateBody = /* @__PURE__ */ zod
type: zod
.literal('metric_attribute')
.default(
- experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnenineTypeDefault
+ experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnenineTypeDefault
),
value: zod
.union([
@@ -2230,7 +2255,7 @@ export const ExperimentsCreateBody = /* @__PURE__ */ zod
type: zod
.literal('revenue_analytics')
.default(
- experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwooneTypeDefault
+ experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemTwooneTypeDefault
),
value: zod
.union([
@@ -2290,7 +2315,7 @@ export const ExperimentsCreateBody = /* @__PURE__ */ zod
type: zod
.literal('account_custom_property')
.default(
- experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwotwoTypeDefault
+ experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemTwotwoTypeDefault
)
.describe(
'Customer analytics account custom property — the key is the property definition id'
@@ -2353,7 +2378,7 @@ export const ExperimentsCreateBody = /* @__PURE__ */ zod
type: zod
.literal('workflow_variable')
.default(
- experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwothreeTypeDefault
+ experimentsCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemTwothreeTypeDefault
),
value: zod
.union([
@@ -2375,3840 +2400,2762 @@ export const ExperimentsCreateBody = /* @__PURE__ */ zod
}),
zod.null(),
])
- .optional(),
- filterTestAccounts: zod.union([zod.boolean(), zod.null()]).optional(),
- multiple_variant_handling: zod
- .union([zod.enum(['exclude', 'first_seen']), zod.null()])
.optional()
.describe(
- "How to handle entities exposed to multiple variants. 'exclude' (default) drops them from the analysis; 'first_seen' assigns them to the variant from their earliest exposure."
+ "Additional event (or action) an entity must emit at\/after their first default exposure event before they count as exposed; exposure time becomes this event's timestamp. Only valid with the default exposure event, not a custom `exposure_config`."
),
- }),
- zod.null(),
- ])
- .optional()
- .describe('Exposure configuration including filter test accounts and custom exposure events.'),
- metrics: zod
- .union([
- zod
- .array(
- zod.object({
- completion_event: zod
- .union([
- zod.object({
- event: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
- id: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe('Action ID. Required for ActionsNode.'),
- kind: zod.enum(['EventsNode', 'ActionsNode']),
- math: zod
- .union([
- zod.enum([
- 'total',
- 'sum',
- 'unique_session',
+ exposure_config: zod
+ .union([
+ zod.object({
+ event: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "Custom exposure event name. Required when kind is 'ExperimentEventExposureConfig'."
+ ),
+ id: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe("Action ID. Required when kind is 'ActionsNode'."),
+ kind: zod
+ .union([zod.enum(['ExperimentEventExposureConfig', 'ActionsNode']), zod.null()])
+ .optional()
+ .describe(
+ "Defaults to 'ExperimentEventExposureConfig' when omitted. Pass 'ActionsNode' for an action-based exposure."
+ ),
+ properties: zod
+ .array(
+ zod.union([
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod
+ .union([
+ zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ zod.null(),
+ ])
+ .default(
+ experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOneOperatorDefault
+ ),
+ type: zod
+ .literal('event')
+ .default(
+ experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOneTypeDefault
+ )
+ .describe('Event properties'),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
'min',
'max',
- 'avg',
- 'dau',
- 'unique_group',
- 'hogql',
- ]),
- zod.null(),
- ])
- .optional()
- .describe(
- "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
- ),
- math_group_type_index: zod
- .union([
- zod.union([
- zod.literal(0),
- zod.literal(1),
- zod.literal(2),
- zod.literal(3),
- zod.literal(4),
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
]),
- zod.null(),
- ])
- .optional()
- .describe(
- "Group type index to aggregate over. Required when math is 'unique_group'."
- ),
- math_hogql: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
- ),
- math_property: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
- ),
- properties: zod
- .union([
- zod.array(
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod
- .union([
- zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
- 'min',
- 'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
- ]),
- zod.null(),
- ])
- .default(
- experimentsCreateBodyMetricsOneItemCompletionEventOnePropertiesOneItemOperatorDefault
- ),
- type: zod
- .literal('event')
- .default(
- experimentsCreateBodyMetricsOneItemCompletionEventOnePropertiesOneItemTypeDefault
- )
- .describe('Event properties'),
- value: zod
- .union([
- zod.array(
- zod.union([
- zod.string(),
- zod.number(),
- zod.boolean(),
- ])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- })
- ),
- zod.null(),
- ])
- .optional()
- .describe('Event property filters to narrow which events are counted.'),
- }),
- zod.null(),
- ])
- .optional()
- .describe('For retention metrics: completion event.'),
- conversion_window: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe('Conversion window duration.'),
- denominator: zod
- .union([
- zod.object({
- event: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
- id: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe('Action ID. Required for ActionsNode.'),
- kind: zod.enum(['EventsNode', 'ActionsNode']),
- math: zod
- .union([
- zod.enum([
- 'total',
- 'sum',
- 'unique_session',
+ type: zod
+ .literal('person')
+ .default(
+ experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwoTypeDefault
+ )
+ .describe('Person properties'),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
'min',
'max',
- 'avg',
- 'dau',
- 'unique_group',
- 'hogql',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
]),
- zod.null(),
- ])
- .optional()
- .describe(
- "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
- ),
- math_group_type_index: zod
- .union([
- zod.union([
- zod.literal(0),
- zod.literal(1),
- zod.literal(2),
- zod.literal(3),
- zod.literal(4),
+ type: zod
+ .literal('person_metadata')
+ .default(
+ experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemThreeTypeDefault
+ )
+ .describe(
+ 'Top-level columns on the persons table (e.g. created_at), not properties JSON'
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.enum(['tag_name', 'text', 'href', 'selector']),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
]),
- zod.null(),
- ])
- .optional()
- .describe(
- "Group type index to aggregate over. Required when math is 'unique_group'."
- ),
- math_hogql: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
- ),
- math_property: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
- ),
- properties: zod
- .union([
- zod.array(
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod
- .union([
- zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
- 'min',
- 'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
- ]),
- zod.null(),
- ])
- .default(
- experimentsCreateBodyMetricsOneItemDenominatorOnePropertiesOneItemOperatorDefault
- ),
- type: zod
- .literal('event')
- .default(
- experimentsCreateBodyMetricsOneItemDenominatorOnePropertiesOneItemTypeDefault
- )
- .describe('Event properties'),
- value: zod
- .union([
- zod.array(
- zod.union([
- zod.string(),
- zod.number(),
- zod.boolean(),
- ])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- })
- ),
- zod.null(),
- ])
- .optional()
- .describe('Event property filters to narrow which events are counted.'),
- }),
- zod.null(),
- ])
- .optional()
- .describe('For ratio metrics: denominator source.'),
- denominator_outlier_handling: zod
- .union([
- zod.object({
- ignore_zeros: zod.union([zod.boolean(), zod.null()]).optional(),
- lower_bound_percentile: zod
- .union([
- zod
- .number()
- .min(
- experimentsCreateBodyMetricsOneItemDenominatorOutlierHandlingOneLowerBoundPercentileOneMin
- )
- .max(
- experimentsCreateBodyMetricsOneItemDenominatorOutlierHandlingOneLowerBoundPercentileOneMax
- ),
- zod.null(),
- ])
- .optional()
- .describe(
- 'Winsorization lower percentile bound, as a fraction in [0, 1] (e.g. 0.01 for the 1st percentile).'
- ),
- upper_bound_percentile: zod
- .union([
- zod
- .number()
- .min(
- experimentsCreateBodyMetricsOneItemDenominatorOutlierHandlingOneUpperBoundPercentileOneMin
- )
- .max(
- experimentsCreateBodyMetricsOneItemDenominatorOutlierHandlingOneUpperBoundPercentileOneMax
+ type: zod
+ .literal('element')
+ .default(
+ experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemFourTypeDefault
),
- zod.null(),
- ])
- .optional()
- .describe(
- 'Winsorization upper percentile bound, as a fraction in [0, 1] (e.g. 0.99 for the 99th percentile).'
- ),
- }),
- zod.null(),
- ])
- .optional()
- .describe(
- 'For ratio metrics: winsorization applied to the denominator aggregate. Leave unset for a binomial-style denominator, which is never clamped.'
- ),
- goal: zod
- .union([zod.enum(['increase', 'decrease']), zod.null()])
- .optional()
- .describe('Whether higher or lower values indicate success.'),
- ignore_zeros: zod
- .union([zod.boolean(), zod.null()])
- .optional()
- .describe(
- 'For mean metrics: exclude zero values when computing the winsorization percentile thresholds.'
- ),
- kind: zod
- .literal('ExperimentMetric')
- .default(experimentsCreateBodyMetricsOneItemKindDefault),
- lower_bound_percentile: zod
- .union([
- zod
- .number()
- .min(experimentsCreateBodyMetricsOneItemLowerBoundPercentileOneMin)
- .max(experimentsCreateBodyMetricsOneItemLowerBoundPercentileOneMax),
- zod.null(),
- ])
- .optional()
- .describe(
- 'For mean metrics: winsorization lower percentile bound, as a fraction in [0, 1] (e.g. 0.01 for the 1st percentile). Per-user values below this percentile are clamped to it before aggregation.'
- ),
- metric_type: zod.enum(['funnel', 'mean', 'ratio', 'retention']),
- name: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe('Human-readable metric name.'),
- numerator: zod
- .union([
- zod.object({
- event: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
- id: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe('Action ID. Required for ActionsNode.'),
- kind: zod.enum(['EventsNode', 'ActionsNode']),
- math: zod
- .union([
- zod.enum([
- 'total',
- 'sum',
- 'unique_session',
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
'min',
'max',
- 'avg',
- 'dau',
- 'unique_group',
- 'hogql',
- ]),
- zod.null(),
- ])
- .optional()
- .describe(
- "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
- ),
- math_group_type_index: zod
- .union([
- zod.union([
- zod.literal(0),
- zod.literal(1),
- zod.literal(2),
- zod.literal(3),
- zod.literal(4),
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
]),
- zod.null(),
- ])
- .optional()
- .describe(
- "Group type index to aggregate over. Required when math is 'unique_group'."
- ),
- math_hogql: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
- ),
- math_property: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
- ),
- properties: zod
- .union([
- zod.array(
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod
- .union([
- zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
- 'min',
- 'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
- ]),
- zod.null(),
- ])
- .default(
- experimentsCreateBodyMetricsOneItemNumeratorOnePropertiesOneItemOperatorDefault
- ),
- type: zod
- .literal('event')
- .default(
- experimentsCreateBodyMetricsOneItemNumeratorOnePropertiesOneItemTypeDefault
- )
- .describe('Event properties'),
- value: zod
- .union([
- zod.array(
- zod.union([
- zod.string(),
- zod.number(),
- zod.boolean(),
- ])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- })
- ),
- zod.null(),
- ])
- .optional()
- .describe('Event property filters to narrow which events are counted.'),
- }),
- zod.null(),
- ])
- .optional()
- .describe('For ratio metrics: numerator source.'),
- numerator_outlier_handling: zod
- .union([
- zod.object({
- ignore_zeros: zod.union([zod.boolean(), zod.null()]).optional(),
- lower_bound_percentile: zod
- .union([
- zod
- .number()
- .min(
- experimentsCreateBodyMetricsOneItemNumeratorOutlierHandlingOneLowerBoundPercentileOneMin
- )
- .max(
- experimentsCreateBodyMetricsOneItemNumeratorOutlierHandlingOneLowerBoundPercentileOneMax
+ type: zod
+ .literal('event_metadata')
+ .default(
+ experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemFiveTypeDefault
),
- zod.null(),
- ])
- .optional()
- .describe(
- 'Winsorization lower percentile bound, as a fraction in [0, 1] (e.g. 0.01 for the 1st percentile).'
- ),
- upper_bound_percentile: zod
- .union([
- zod
- .number()
- .min(
- experimentsCreateBodyMetricsOneItemNumeratorOutlierHandlingOneUpperBoundPercentileOneMin
- )
- .max(
- experimentsCreateBodyMetricsOneItemNumeratorOutlierHandlingOneUpperBoundPercentileOneMax
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('session')
+ .default(
+ experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemSixTypeDefault
),
- zod.null(),
- ])
- .optional()
- .describe(
- 'Winsorization upper percentile bound, as a fraction in [0, 1] (e.g. 0.99 for the 99th percentile).'
- ),
- }),
- zod.null(),
- ])
- .optional()
- .describe(
- 'For ratio metrics: winsorization applied to the numerator aggregate, independently of the denominator and each with its own percentile thresholds.'
- ),
- retention_window_end: zod.union([zod.number(), zod.null()]).optional(),
- retention_window_start: zod.union([zod.number(), zod.null()]).optional(),
- retention_window_unit: zod
- .union([zod.enum(['second', 'minute', 'hour', 'day', 'week', 'month']), zod.null()])
- .optional(),
- series: zod
- .union([
- zod.array(
- zod.object({
- event: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
- id: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe('Action ID. Required for ActionsNode.'),
- kind: zod.enum(['EventsNode', 'ActionsNode']),
- math: zod
- .union([
- zod.enum([
- 'total',
- 'sum',
- 'unique_session',
- 'min',
- 'max',
- 'avg',
- 'dau',
- 'unique_group',
- 'hogql',
- ]),
- zod.null(),
- ])
- .optional()
- .describe(
- "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
- ),
- math_group_type_index: zod
- .union([
- zod.union([
- zod.literal(0),
- zod.literal(1),
- zod.literal(2),
- zod.literal(3),
- zod.literal(4),
- ]),
- zod.null(),
- ])
- .optional()
- .describe(
- "Group type index to aggregate over. Required when math is 'unique_group'."
- ),
- math_hogql: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
- ),
- math_property: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
- ),
- properties: zod
- .union([
- zod.array(
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod
- .union([
- zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
- 'min',
- 'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
- ]),
- zod.null(),
- ])
- .default(
- experimentsCreateBodyMetricsOneItemSeriesOneItemPropertiesOneItemOperatorDefault
- ),
- type: zod
- .literal('event')
- .default(
- experimentsCreateBodyMetricsOneItemSeriesOneItemPropertiesOneItemTypeDefault
- )
- .describe('Event properties'),
- value: zod
- .union([
- zod.array(
- zod.union([
- zod.string(),
- zod.number(),
- zod.boolean(),
- ])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- })
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ cohort_name: zod.union([zod.string(), zod.null()]).optional(),
+ key: zod
+ .literal('id')
+ .default(
+ experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemSevenKeyDefault
),
- zod.null(),
- ])
- .optional()
- .describe('Event property filters to narrow which events are counted.'),
- })
- ),
- zod.null(),
- ])
- .optional()
- .describe('For funnel metrics: array of EventsNode\/ActionsNode steps.'),
- source: zod
- .union([
- zod.object({
- event: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
- id: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe('Action ID. Required for ActionsNode.'),
- kind: zod.enum(['EventsNode', 'ActionsNode']),
- math: zod
- .union([
- zod.enum([
- 'total',
- 'sum',
- 'unique_session',
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod
+ .union([
+ zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ zod.null(),
+ ])
+ .default(
+ experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemSevenOperatorDefault
+ ),
+ type: zod
+ .literal('cohort')
+ .default(
+ experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemSevenTypeDefault
+ ),
+ value: zod.number(),
+ }),
+ zod.object({
+ key: zod.union([
+ zod.enum(['duration', 'active_seconds', 'inactive_seconds']),
+ zod.string(),
+ ]),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
'min',
'max',
- 'avg',
- 'dau',
- 'unique_group',
- 'hogql',
- ]),
- zod.null(),
- ])
- .optional()
- .describe(
- "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
- ),
- math_group_type_index: zod
- .union([
- zod.union([
- zod.literal(0),
- zod.literal(1),
- zod.literal(2),
- zod.literal(3),
- zod.literal(4),
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
]),
- zod.null(),
- ])
- .optional()
- .describe(
- "Group type index to aggregate over. Required when math is 'unique_group'."
- ),
- math_hogql: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
- ),
- math_property: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
- ),
- properties: zod
- .union([
- zod.array(
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod
- .union([
- zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
- 'min',
- 'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
- ]),
- zod.null(),
- ])
- .default(
- experimentsCreateBodyMetricsOneItemSourceOnePropertiesOneItemOperatorDefault
- ),
- type: zod
- .literal('event')
- .default(
- experimentsCreateBodyMetricsOneItemSourceOnePropertiesOneItemTypeDefault
- )
- .describe('Event properties'),
- value: zod
- .union([
- zod.array(
- zod.union([
- zod.string(),
- zod.number(),
- zod.boolean(),
- ])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- })
- ),
- zod.null(),
- ])
- .optional()
- .describe('Event property filters to narrow which events are counted.'),
- }),
- zod.null(),
- ])
- .optional()
- .describe('For mean metrics: event source.'),
- start_event: zod
- .union([
- zod.object({
- event: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
- id: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe('Action ID. Required for ActionsNode.'),
- kind: zod.enum(['EventsNode', 'ActionsNode']),
- math: zod
- .union([
- zod.enum([
- 'total',
- 'sum',
- 'unique_session',
+ type: zod
+ .literal('recording')
+ .default(
+ experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemEightTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
'min',
'max',
- 'avg',
- 'dau',
- 'unique_group',
- 'hogql',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
]),
- zod.null(),
- ])
- .optional()
- .describe(
- "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
- ),
- math_group_type_index: zod
- .union([
- zod.union([
- zod.literal(0),
- zod.literal(1),
- zod.literal(2),
- zod.literal(3),
- zod.literal(4),
+ type: zod
+ .literal('log_entry')
+ .default(
+ experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemNineTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ group_key_names: zod
+ .union([zod.record(zod.string(), zod.string()), zod.null()])
+ .optional(),
+ group_type_index: zod.union([zod.number(), zod.null()]).optional(),
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
]),
- zod.null(),
- ])
- .optional()
- .describe(
- "Group type index to aggregate over. Required when math is 'unique_group'."
- ),
- math_hogql: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
- ),
- math_property: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
- ),
- properties: zod
- .union([
- zod.array(
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod
- .union([
- zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
- 'min',
- 'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
- ]),
- zod.null(),
- ])
- .default(
- experimentsCreateBodyMetricsOneItemStartEventOnePropertiesOneItemOperatorDefault
- ),
- type: zod
- .literal('event')
- .default(
- experimentsCreateBodyMetricsOneItemStartEventOnePropertiesOneItemTypeDefault
- )
- .describe('Event properties'),
- value: zod
- .union([
- zod.array(
- zod.union([
- zod.string(),
- zod.number(),
- zod.boolean(),
- ])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- })
- ),
- zod.null(),
- ])
- .optional()
- .describe('Event property filters to narrow which events are counted.'),
- }),
- zod.null(),
- ])
- .optional()
- .describe('For retention metrics: start event.'),
- start_handling: zod.union([zod.enum(['first_seen', 'last_seen']), zod.null()]).optional(),
- threshold: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe(
- 'For mean metrics: when set, reports the percentage of users whose per-user summed\/counted value reaches or exceeds this threshold. Only meaningful for sum\/count math types.'
- ),
- upper_bound_percentile: zod
- .union([
- zod
- .number()
- .min(experimentsCreateBodyMetricsOneItemUpperBoundPercentileOneMin)
- .max(experimentsCreateBodyMetricsOneItemUpperBoundPercentileOneMax),
- zod.null(),
- ])
- .optional()
- .describe(
- 'For mean metrics: winsorization upper percentile bound, as a fraction in [0, 1] (e.g. 0.99 for the 99th percentile). Per-user values above this percentile are clamped to it before aggregation.'
- ),
- uuid: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe('Unique identifier. Auto-generated if omitted.'),
- })
- )
- .describe('List wrapper for OpenAPI schema generation — the field stores an array of metrics.'),
- zod.null(),
- ])
- .optional()
- .describe(
- "Primary experiment metrics. Each metric must have kind='ExperimentMetric' and a metric_type: 'mean' (set source to an EventsNode with an event name), 'funnel' (set series to an array of EventsNode steps), 'ratio' (set numerator and denominator EventsNode entries), or 'retention' (set start_event and completion_event). Use the read-data-schema tool with query kind 'events' to find available events in the project."
- ),
- metrics_secondary: zod
- .union([
- zod
- .array(
- zod.object({
- completion_event: zod
- .union([
- zod.object({
- event: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
- id: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe('Action ID. Required for ActionsNode.'),
- kind: zod.enum(['EventsNode', 'ActionsNode']),
- math: zod
- .union([
- zod.enum([
- 'total',
- 'sum',
- 'unique_session',
+ type: zod
+ .literal('group')
+ .default(
+ experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnezeroTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
'min',
'max',
- 'avg',
- 'dau',
- 'unique_group',
- 'hogql',
- ]),
- zod.null(),
- ])
- .optional()
- .describe(
- "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
- ),
- math_group_type_index: zod
- .union([
- zod.union([
- zod.literal(0),
- zod.literal(1),
- zod.literal(2),
- zod.literal(3),
- zod.literal(4),
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
]),
- zod.null(),
- ])
- .optional()
- .describe(
- "Group type index to aggregate over. Required when math is 'unique_group'."
- ),
- math_hogql: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
- ),
- math_property: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
- ),
- properties: zod
- .union([
- zod.array(
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod
- .union([
- zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
- 'min',
- 'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
- ]),
- zod.null(),
- ])
- .default(
- experimentsCreateBodyMetricsSecondaryOneItemCompletionEventOnePropertiesOneItemOperatorDefault
- ),
- type: zod
- .literal('event')
- .default(
- experimentsCreateBodyMetricsSecondaryOneItemCompletionEventOnePropertiesOneItemTypeDefault
- )
- .describe('Event properties'),
- value: zod
- .union([
- zod.array(
- zod.union([
- zod.string(),
- zod.number(),
- zod.boolean(),
- ])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- })
- ),
- zod.null(),
- ])
- .optional()
- .describe('Event property filters to narrow which events are counted.'),
- }),
- zod.null(),
- ])
- .optional()
- .describe('For retention metrics: completion event.'),
- conversion_window: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe('Conversion window duration.'),
- denominator: zod
- .union([
- zod.object({
- event: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
- id: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe('Action ID. Required for ActionsNode.'),
- kind: zod.enum(['EventsNode', 'ActionsNode']),
- math: zod
- .union([
- zod.enum([
- 'total',
- 'sum',
- 'unique_session',
- 'min',
- 'max',
- 'avg',
- 'dau',
- 'unique_group',
- 'hogql',
- ]),
- zod.null(),
- ])
- .optional()
- .describe(
- "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
- ),
- math_group_type_index: zod
- .union([
- zod.union([
- zod.literal(0),
- zod.literal(1),
- zod.literal(2),
- zod.literal(3),
- zod.literal(4),
- ]),
- zod.null(),
- ])
- .optional()
- .describe(
- "Group type index to aggregate over. Required when math is 'unique_group'."
- ),
- math_hogql: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
- ),
- math_property: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
- ),
- properties: zod
- .union([
- zod.array(
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod
- .union([
- zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
- 'min',
- 'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
- ]),
- zod.null(),
- ])
- .default(
- experimentsCreateBodyMetricsSecondaryOneItemDenominatorOnePropertiesOneItemOperatorDefault
- ),
- type: zod
- .literal('event')
- .default(
- experimentsCreateBodyMetricsSecondaryOneItemDenominatorOnePropertiesOneItemTypeDefault
- )
- .describe('Event properties'),
- value: zod
- .union([
- zod.array(
- zod.union([
- zod.string(),
- zod.number(),
- zod.boolean(),
- ])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- })
- ),
- zod.null(),
- ])
- .optional()
- .describe('Event property filters to narrow which events are counted.'),
- }),
- zod.null(),
- ])
- .optional()
- .describe('For ratio metrics: denominator source.'),
- denominator_outlier_handling: zod
- .union([
- zod.object({
- ignore_zeros: zod.union([zod.boolean(), zod.null()]).optional(),
- lower_bound_percentile: zod
- .union([
- zod
- .number()
- .min(
- experimentsCreateBodyMetricsSecondaryOneItemDenominatorOutlierHandlingOneLowerBoundPercentileOneMin
+ type: zod
+ .literal('feature')
+ .default(
+ experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOneoneTypeDefault
)
- .max(
- experimentsCreateBodyMetricsSecondaryOneItemDenominatorOutlierHandlingOneLowerBoundPercentileOneMax
- ),
- zod.null(),
- ])
- .optional()
- .describe(
- 'Winsorization lower percentile bound, as a fraction in [0, 1] (e.g. 0.01 for the 1st percentile).'
- ),
- upper_bound_percentile: zod
- .union([
- zod
- .number()
- .min(
- experimentsCreateBodyMetricsSecondaryOneItemDenominatorOutlierHandlingOneUpperBoundPercentileOneMin
+ .describe('Event property with \"$feature\/\" prepended'),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string().describe('The key should be the flag ID'),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod
+ .literal('flag_evaluates_to')
+ .default(
+ experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnetwoOperatorDefault
)
- .max(
- experimentsCreateBodyMetricsSecondaryOneItemDenominatorOutlierHandlingOneUpperBoundPercentileOneMax
+ .describe(
+ 'Only flag_evaluates_to operator is allowed for flag dependencies'
),
- zod.null(),
- ])
- .optional()
- .describe(
- 'Winsorization upper percentile bound, as a fraction in [0, 1] (e.g. 0.99 for the 99th percentile).'
- ),
- }),
- zod.null(),
- ])
- .optional()
- .describe(
- 'For ratio metrics: winsorization applied to the denominator aggregate. Leave unset for a binomial-style denominator, which is never clamped.'
- ),
- goal: zod
- .union([zod.enum(['increase', 'decrease']), zod.null()])
- .optional()
- .describe('Whether higher or lower values indicate success.'),
- ignore_zeros: zod
- .union([zod.boolean(), zod.null()])
- .optional()
- .describe(
- 'For mean metrics: exclude zero values when computing the winsorization percentile thresholds.'
- ),
- kind: zod
- .literal('ExperimentMetric')
- .default(experimentsCreateBodyMetricsSecondaryOneItemKindDefault),
- lower_bound_percentile: zod
- .union([
- zod
- .number()
- .min(experimentsCreateBodyMetricsSecondaryOneItemLowerBoundPercentileOneMin)
- .max(experimentsCreateBodyMetricsSecondaryOneItemLowerBoundPercentileOneMax),
- zod.null(),
- ])
- .optional()
- .describe(
- 'For mean metrics: winsorization lower percentile bound, as a fraction in [0, 1] (e.g. 0.01 for the 1st percentile). Per-user values below this percentile are clamped to it before aggregation.'
- ),
- metric_type: zod.enum(['funnel', 'mean', 'ratio', 'retention']),
- name: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe('Human-readable metric name.'),
- numerator: zod
- .union([
- zod.object({
- event: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
- id: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe('Action ID. Required for ActionsNode.'),
- kind: zod.enum(['EventsNode', 'ActionsNode']),
- math: zod
- .union([
- zod.enum([
- 'total',
- 'sum',
- 'unique_session',
+ type: zod
+ .literal('flag')
+ .default(
+ experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnetwoTypeDefault
+ )
+ .describe('Feature flag dependency'),
+ value: zod
+ .union([zod.boolean(), zod.string()])
+ .describe('The value can be true, false, or a variant name'),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ type: zod
+ .literal('hogql')
+ .default(
+ experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnethreeTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ type: zod
+ .literal('empty')
+ .default(
+ experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnefourTypeDefault
+ ),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
'min',
'max',
- 'avg',
- 'dau',
- 'unique_group',
- 'hogql',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
]),
- zod.null(),
- ])
- .optional()
- .describe(
- "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
- ),
- math_group_type_index: zod
- .union([
- zod.union([
- zod.literal(0),
- zod.literal(1),
- zod.literal(2),
- zod.literal(3),
- zod.literal(4),
+ type: zod
+ .literal('data_warehouse')
+ .default(
+ experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnefiveTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
]),
- zod.null(),
- ])
- .optional()
- .describe(
- "Group type index to aggregate over. Required when math is 'unique_group'."
- ),
- math_hogql: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
- ),
- math_property: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
- ),
- properties: zod
- .union([
- zod.array(
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod
- .union([
- zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
- 'min',
- 'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
- ]),
- zod.null(),
- ])
- .default(
- experimentsCreateBodyMetricsSecondaryOneItemNumeratorOnePropertiesOneItemOperatorDefault
- ),
- type: zod
- .literal('event')
- .default(
- experimentsCreateBodyMetricsSecondaryOneItemNumeratorOnePropertiesOneItemTypeDefault
- )
- .describe('Event properties'),
- value: zod
- .union([
- zod.array(
- zod.union([
- zod.string(),
- zod.number(),
- zod.boolean(),
- ])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- })
- ),
- zod.null(),
- ])
- .optional()
- .describe('Event property filters to narrow which events are counted.'),
- }),
- zod.null(),
- ])
- .optional()
- .describe('For ratio metrics: numerator source.'),
- numerator_outlier_handling: zod
- .union([
- zod.object({
- ignore_zeros: zod.union([zod.boolean(), zod.null()]).optional(),
- lower_bound_percentile: zod
- .union([
- zod
- .number()
- .min(
- experimentsCreateBodyMetricsSecondaryOneItemNumeratorOutlierHandlingOneLowerBoundPercentileOneMin
- )
- .max(
- experimentsCreateBodyMetricsSecondaryOneItemNumeratorOutlierHandlingOneLowerBoundPercentileOneMax
+ type: zod
+ .literal('data_warehouse_person_property')
+ .default(
+ experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnesixTypeDefault
),
- zod.null(),
- ])
- .optional()
- .describe(
- 'Winsorization lower percentile bound, as a fraction in [0, 1] (e.g. 0.01 for the 1st percentile).'
- ),
- upper_bound_percentile: zod
- .union([
- zod
- .number()
- .min(
- experimentsCreateBodyMetricsSecondaryOneItemNumeratorOutlierHandlingOneUpperBoundPercentileOneMin
- )
- .max(
- experimentsCreateBodyMetricsSecondaryOneItemNumeratorOutlierHandlingOneUpperBoundPercentileOneMax
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('error_tracking_issue')
+ .default(
+ experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnesevenTypeDefault
),
- zod.null(),
- ])
- .optional()
- .describe(
- 'Winsorization upper percentile bound, as a fraction in [0, 1] (e.g. 0.99 for the 99th percentile).'
- ),
- }),
- zod.null(),
- ])
- .optional()
- .describe(
- 'For ratio metrics: winsorization applied to the numerator aggregate, independently of the denominator and each with its own percentile thresholds.'
- ),
- retention_window_end: zod.union([zod.number(), zod.null()]).optional(),
- retention_window_start: zod.union([zod.number(), zod.null()]).optional(),
- retention_window_unit: zod
- .union([zod.enum(['second', 'minute', 'hour', 'day', 'week', 'month']), zod.null()])
- .optional(),
- series: zod
- .union([
- zod.array(
- zod.object({
- event: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
- id: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe('Action ID. Required for ActionsNode.'),
- kind: zod.enum(['EventsNode', 'ActionsNode']),
- math: zod
- .union([
- zod.enum([
- 'total',
- 'sum',
- 'unique_session',
- 'min',
- 'max',
- 'avg',
- 'dau',
- 'unique_group',
- 'hogql',
- ]),
- zod.null(),
- ])
- .optional()
- .describe(
- "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
- ),
- math_group_type_index: zod
- .union([
- zod.union([
- zod.literal(0),
- zod.literal(1),
- zod.literal(2),
- zod.literal(3),
- zod.literal(4),
- ]),
- zod.null(),
- ])
- .optional()
- .describe(
- "Group type index to aggregate over. Required when math is 'unique_group'."
- ),
- math_hogql: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
- ),
- math_property: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
- ),
- properties: zod
- .union([
- zod.array(
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod
- .union([
- zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
- 'min',
- 'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
- ]),
- zod.null(),
- ])
- .default(
- experimentsCreateBodyMetricsSecondaryOneItemSeriesOneItemPropertiesOneItemOperatorDefault
- ),
- type: zod
- .literal('event')
- .default(
- experimentsCreateBodyMetricsSecondaryOneItemSeriesOneItemPropertiesOneItemTypeDefault
- )
- .describe('Event properties'),
- value: zod
- .union([
- zod.array(
- zod.union([
- zod.string(),
- zod.number(),
- zod.boolean(),
- ])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- })
- ),
- zod.null(),
- ])
- .optional()
- .describe('Event property filters to narrow which events are counted.'),
- })
- ),
- zod.null(),
- ])
- .optional()
- .describe('For funnel metrics: array of EventsNode\/ActionsNode steps.'),
- source: zod
- .union([
- zod.object({
- event: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
- id: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe('Action ID. Required for ActionsNode.'),
- kind: zod.enum(['EventsNode', 'ActionsNode']),
- math: zod
- .union([
- zod.enum([
- 'total',
- 'sum',
- 'unique_session',
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
'min',
'max',
- 'avg',
- 'dau',
- 'unique_group',
- 'hogql',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
]),
- zod.null(),
- ])
- .optional()
- .describe(
- "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
- ),
- math_group_type_index: zod
- .union([
- zod.union([
- zod.literal(0),
- zod.literal(1),
- zod.literal(2),
- zod.literal(3),
- zod.literal(4),
+ type: zod.enum(['log', 'log_attribute', 'log_resource_attribute']),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
]),
- zod.null(),
- ])
- .optional()
- .describe(
- "Group type index to aggregate over. Required when math is 'unique_group'."
- ),
- math_hogql: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
- ),
- math_property: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
- ),
- properties: zod
- .union([
- zod.array(
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod
- .union([
- zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
- 'min',
- 'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
- ]),
- zod.null(),
- ])
- .default(
- experimentsCreateBodyMetricsSecondaryOneItemSourceOnePropertiesOneItemOperatorDefault
- ),
- type: zod
- .literal('event')
- .default(
- experimentsCreateBodyMetricsSecondaryOneItemSourceOnePropertiesOneItemTypeDefault
- )
- .describe('Event properties'),
- value: zod
- .union([
- zod.array(
- zod.union([
- zod.string(),
- zod.number(),
- zod.boolean(),
- ])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- })
- ),
- zod.null(),
- ])
- .optional()
- .describe('Event property filters to narrow which events are counted.'),
- }),
- zod.null(),
- ])
- .optional()
- .describe('For mean metrics: event source.'),
- start_event: zod
- .union([
- zod.object({
- event: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
- id: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe('Action ID. Required for ActionsNode.'),
- kind: zod.enum(['EventsNode', 'ActionsNode']),
- math: zod
- .union([
- zod.enum([
- 'total',
- 'sum',
- 'unique_session',
+ type: zod
+ .literal('metric_attribute')
+ .default(
+ experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnenineTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
'min',
'max',
- 'avg',
- 'dau',
- 'unique_group',
- 'hogql',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
]),
- zod.null(),
- ])
- .optional()
- .describe(
- "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
- ),
- math_group_type_index: zod
- .union([
- zod.union([
- zod.literal(0),
- zod.literal(1),
- zod.literal(2),
- zod.literal(3),
- zod.literal(4),
+ type: zod.enum(['span', 'span_attribute', 'span_resource_attribute']),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
]),
- zod.null(),
- ])
- .optional()
- .describe(
- "Group type index to aggregate over. Required when math is 'unique_group'."
- ),
- math_hogql: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
- ),
- math_property: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
- ),
- properties: zod
- .union([
- zod.array(
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod
- .union([
- zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
- 'min',
- 'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
- ]),
- zod.null(),
- ])
- .default(
- experimentsCreateBodyMetricsSecondaryOneItemStartEventOnePropertiesOneItemOperatorDefault
- ),
- type: zod
- .literal('event')
- .default(
- experimentsCreateBodyMetricsSecondaryOneItemStartEventOnePropertiesOneItemTypeDefault
- )
- .describe('Event properties'),
- value: zod
- .union([
- zod.array(
- zod.union([
- zod.string(),
- zod.number(),
- zod.boolean(),
- ])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- })
- ),
- zod.null(),
- ])
- .optional()
- .describe('Event property filters to narrow which events are counted.'),
- }),
- zod.null(),
- ])
- .optional()
- .describe('For retention metrics: start event.'),
- start_handling: zod.union([zod.enum(['first_seen', 'last_seen']), zod.null()]).optional(),
- threshold: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe(
- 'For mean metrics: when set, reports the percentage of users whose per-user summed\/counted value reaches or exceeds this threshold. Only meaningful for sum\/count math types.'
- ),
- upper_bound_percentile: zod
- .union([
- zod
- .number()
- .min(experimentsCreateBodyMetricsSecondaryOneItemUpperBoundPercentileOneMin)
- .max(experimentsCreateBodyMetricsSecondaryOneItemUpperBoundPercentileOneMax),
- zod.null(),
- ])
- .optional()
- .describe(
- 'For mean metrics: winsorization upper percentile bound, as a fraction in [0, 1] (e.g. 0.99 for the 99th percentile). Per-user values above this percentile are clamped to it before aggregation.'
- ),
- uuid: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe('Unique identifier. Auto-generated if omitted.'),
- })
- )
- .describe('List wrapper for OpenAPI schema generation — the field stores an array of metrics.'),
+ type: zod
+ .literal('revenue_analytics')
+ .default(
+ experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwooneTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('account_custom_property')
+ .default(
+ experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwotwoTypeDefault
+ )
+ .describe(
+ 'Customer analytics account custom property — the key is the property definition id'
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('workflow_variable')
+ .default(
+ experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwothreeTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ ])
+ )
+ .describe(
+ 'Property filters (event, person, and other supported types). Pass an empty array if no filters needed.'
+ ),
+ }),
+ zod.null(),
+ ])
+ .optional(),
+ filterTestAccounts: zod.union([zod.boolean(), zod.null()]).optional(),
+ multiple_variant_handling: zod
+ .union([zod.enum(['exclude', 'first_seen']), zod.null()])
+ .optional()
+ .describe(
+ "How to handle entities exposed to multiple variants. 'exclude' (default) drops them from the analysis; 'first_seen' assigns them to the variant from their earliest exposure."
+ ),
+ }),
zod.null(),
])
.optional()
- .describe('Secondary metrics for additional measurements. Same format as primary metrics.'),
- stats_config: zod.unknown().optional(),
- scheduling_config: zod.unknown().optional(),
- allow_unknown_events: zod
- .boolean()
- .default(experimentsCreateBodyAllowUnknownEventsDefault)
- .describe(
- "Suppresses the validation that rejects metrics referencing events not yet ingested by this project. REQUIRES explicit user confirmation before being set to true — never flip this silently to retry a failed call. The default validation catches typo'd event names and missing instrumentation. Set this to true only when the user has confirmed the event is intentional (e.g. they are about to instrument it)."
- ),
- _create_in_folder: zod.string().optional(),
- conclusion: zod
+ .describe('Exposure configuration including filter test accounts and custom exposure events.'),
+ metrics: zod
.union([
zod
- .enum(['won', 'lost', 'inconclusive', 'stopped_early', 'invalid'])
- .describe(
- '\* `won` - won\n\* `lost` - lost\n\* `inconclusive` - inconclusive\n\* `stopped_early` - stopped_early\n\* `invalid` - invalid'
- ),
- zod.null(),
- ])
- .optional()
- .describe(
- 'Experiment conclusion: won, lost, inconclusive, stopped_early, or invalid.\n\n\* `won` - won\n\* `lost` - lost\n\* `inconclusive` - inconclusive\n\* `stopped_early` - stopped_early\n\* `invalid` - invalid'
- ),
- conclusion_comment: zod
- .string()
- .max(experimentsCreateBodyConclusionCommentMax)
- .nullish()
- .describe('Comment about the experiment conclusion.'),
- repository: zod
- .string()
- .max(experimentsCreateBodyRepositoryMax)
- .nullish()
- .describe(
- "GitHub repository holding this experiment's feature-flag code, in `organization\/repository` format. Used as the target of the flag-cleanup pull request opened via open_cleanup_pr on end\/ship_variant. When not set, cleanup targets the team's only connected repository and is skipped if the team has several."
- ),
- primary_metrics_ordered_uuids: zod.unknown().optional(),
- secondary_metrics_ordered_uuids: zod.unknown().optional(),
- only_count_matured_users: zod.boolean().optional(),
- update_feature_flag_params: zod
- .boolean()
- .default(experimentsCreateBodyUpdateFeatureFlagParamsDefault)
- .describe(
- 'When true, sync the flag config sent in this request (via the `feature_flag` object) to the linked feature flag. Draft experiments always sync regardless. On a running experiment, `feature_flag` config without this flag is rejected.'
- ),
- version: zod
- .number()
- .nullish()
- .describe(
- "Optimistic-concurrency token. Reads return the experiment's current version, bumped on every update. Send the version you last read with an update to detect concurrent edits: a stale update merges concurrent changes where safe — metric collections per metric uuid, other fields per field — using the base values sent in `original_experiment`, and fails with HTTP 409 only when the same metric or field changed on both sides (or no base value was sent for a changed field). Omit to skip the check."
- ),
- original_experiment: zod
- .record(zod.string(), zod.unknown())
- .nullish()
- .describe(
- 'The experiment state as the client last read it, used together with `version` to resolve concurrent edits: metric collections merge per metric uuid, and any other field the update carries merges per field against its base value here (only a same-field double edit fails). Relevant keys are metrics, metrics_secondary, saved_metrics_ids, plus the last-read values of whichever scalar fields the update writes; unknown keys are ignored. Changed fields without a base value — and, without this object, any version mismatch — fail with HTTP 409.'
- ),
- })
- .describe('Experiment write payload. Identical to Experiment, plus the writable `feature_flag` config input.')
-
-/**
- * Retrieve a single experiment by ID, including its current status, metrics, feature flag, and results metadata.
- */
-export const ExperimentsRetrieveParams = /* @__PURE__ */ zod.object({
- id: zod.number().describe('A unique integer value identifying this experiment.'),
- project_id: zod
- .string()
- .describe(
- "Project ID of the project you're trying to access. To find the ID of the project, make a call to \/api\/projects\/."
- ),
-})
-
-/**
- * Update an experiment. Use this to modify experiment properties such as name, description, metrics, variants, and configuration. Metrics can be added, changed and removed at any time. Feature-flag config (variants, rollout, payloads) is sent via the feature_flag object.
- */
-export const ExperimentsPartialUpdateParams = /* @__PURE__ */ zod.object({
- id: zod.number().describe('A unique integer value identifying this experiment.'),
- project_id: zod
- .string()
- .describe(
- "Project ID of the project you're trying to access. To find the ID of the project, make a call to \/api\/projects\/."
- ),
-})
-
-export const experimentsPartialUpdateBodyNameMax = 400
-
-export const experimentsPartialUpdateBodyDescriptionMax = 3000
-
-export const experimentsPartialUpdateBodyFeatureFlagOneFiltersOneGroupsItemRolloutPercentageMin = 0
-export const experimentsPartialUpdateBodyFeatureFlagOneFiltersOneGroupsItemRolloutPercentageMax = 100
-
-export const experimentsPartialUpdateBodyFeatureFlagOneFiltersOneGroupsItemPropertiesMax = 0
-
-export const experimentsPartialUpdateBodyFeatureFlagOneFiltersOneMultivariateOneVariantsItemRolloutPercentageMin = 0
-export const experimentsPartialUpdateBodyFeatureFlagOneFiltersOneMultivariateOneVariantsItemRolloutPercentageMax = 100
-
-export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOneOperatorDefault = `exact`
-export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOneTypeDefault = `event`
-export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwoTypeDefault = `person`
-export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemThreeTypeDefault = `person_metadata`
-export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemFourTypeDefault = `element`
-export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemFiveTypeDefault = `event_metadata`
-export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemSixTypeDefault = `session`
-export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemSevenKeyDefault = `id`
-export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemSevenOperatorDefault = `in`
-export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemSevenTypeDefault = `cohort`
-export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemEightTypeDefault = `recording`
-export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemNineTypeDefault = `log_entry`
-export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnezeroTypeDefault = `group`
-export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOneoneTypeDefault = `feature`
-export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnetwoOperatorDefault = `flag_evaluates_to`
-export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnetwoTypeDefault = `flag`
-export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnethreeTypeDefault = `hogql`
-export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnefourTypeDefault = `empty`
-export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnefiveTypeDefault = `data_warehouse`
-export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnesixTypeDefault = `data_warehouse_person_property`
-export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnesevenTypeDefault = `error_tracking_issue`
-export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnenineTypeDefault = `metric_attribute`
-export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwooneTypeDefault = `revenue_analytics`
-export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwotwoTypeDefault = `account_custom_property`
-export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwothreeTypeDefault = `workflow_variable`
-export const experimentsPartialUpdateBodyMetricsOneItemCompletionEventOnePropertiesOneItemOperatorDefault = `exact`
-export const experimentsPartialUpdateBodyMetricsOneItemCompletionEventOnePropertiesOneItemTypeDefault = `event`
-export const experimentsPartialUpdateBodyMetricsOneItemDenominatorOnePropertiesOneItemOperatorDefault = `exact`
-export const experimentsPartialUpdateBodyMetricsOneItemDenominatorOnePropertiesOneItemTypeDefault = `event`
-export const experimentsPartialUpdateBodyMetricsOneItemDenominatorOutlierHandlingOneLowerBoundPercentileOneMin = 0
-export const experimentsPartialUpdateBodyMetricsOneItemDenominatorOutlierHandlingOneLowerBoundPercentileOneMax = 1
-
-export const experimentsPartialUpdateBodyMetricsOneItemDenominatorOutlierHandlingOneUpperBoundPercentileOneMin = 0
-export const experimentsPartialUpdateBodyMetricsOneItemDenominatorOutlierHandlingOneUpperBoundPercentileOneMax = 1
-
-export const experimentsPartialUpdateBodyMetricsOneItemKindDefault = `ExperimentMetric`
-export const experimentsPartialUpdateBodyMetricsOneItemLowerBoundPercentileOneMin = 0
-export const experimentsPartialUpdateBodyMetricsOneItemLowerBoundPercentileOneMax = 1
-
-export const experimentsPartialUpdateBodyMetricsOneItemNumeratorOnePropertiesOneItemOperatorDefault = `exact`
-export const experimentsPartialUpdateBodyMetricsOneItemNumeratorOnePropertiesOneItemTypeDefault = `event`
-export const experimentsPartialUpdateBodyMetricsOneItemNumeratorOutlierHandlingOneLowerBoundPercentileOneMin = 0
-export const experimentsPartialUpdateBodyMetricsOneItemNumeratorOutlierHandlingOneLowerBoundPercentileOneMax = 1
-
-export const experimentsPartialUpdateBodyMetricsOneItemNumeratorOutlierHandlingOneUpperBoundPercentileOneMin = 0
-export const experimentsPartialUpdateBodyMetricsOneItemNumeratorOutlierHandlingOneUpperBoundPercentileOneMax = 1
-
-export const experimentsPartialUpdateBodyMetricsOneItemSeriesOneItemPropertiesOneItemOperatorDefault = `exact`
-export const experimentsPartialUpdateBodyMetricsOneItemSeriesOneItemPropertiesOneItemTypeDefault = `event`
-export const experimentsPartialUpdateBodyMetricsOneItemSourceOnePropertiesOneItemOperatorDefault = `exact`
-export const experimentsPartialUpdateBodyMetricsOneItemSourceOnePropertiesOneItemTypeDefault = `event`
-export const experimentsPartialUpdateBodyMetricsOneItemStartEventOnePropertiesOneItemOperatorDefault = `exact`
-export const experimentsPartialUpdateBodyMetricsOneItemStartEventOnePropertiesOneItemTypeDefault = `event`
-export const experimentsPartialUpdateBodyMetricsOneItemUpperBoundPercentileOneMin = 0
-export const experimentsPartialUpdateBodyMetricsOneItemUpperBoundPercentileOneMax = 1
-
-export const experimentsPartialUpdateBodyMetricsSecondaryOneItemCompletionEventOnePropertiesOneItemOperatorDefault = `exact`
-export const experimentsPartialUpdateBodyMetricsSecondaryOneItemCompletionEventOnePropertiesOneItemTypeDefault = `event`
-export const experimentsPartialUpdateBodyMetricsSecondaryOneItemDenominatorOnePropertiesOneItemOperatorDefault = `exact`
-export const experimentsPartialUpdateBodyMetricsSecondaryOneItemDenominatorOnePropertiesOneItemTypeDefault = `event`
-export const experimentsPartialUpdateBodyMetricsSecondaryOneItemDenominatorOutlierHandlingOneLowerBoundPercentileOneMin = 0
-export const experimentsPartialUpdateBodyMetricsSecondaryOneItemDenominatorOutlierHandlingOneLowerBoundPercentileOneMax = 1
-
-export const experimentsPartialUpdateBodyMetricsSecondaryOneItemDenominatorOutlierHandlingOneUpperBoundPercentileOneMin = 0
-export const experimentsPartialUpdateBodyMetricsSecondaryOneItemDenominatorOutlierHandlingOneUpperBoundPercentileOneMax = 1
-
-export const experimentsPartialUpdateBodyMetricsSecondaryOneItemKindDefault = `ExperimentMetric`
-export const experimentsPartialUpdateBodyMetricsSecondaryOneItemLowerBoundPercentileOneMin = 0
-export const experimentsPartialUpdateBodyMetricsSecondaryOneItemLowerBoundPercentileOneMax = 1
-
-export const experimentsPartialUpdateBodyMetricsSecondaryOneItemNumeratorOnePropertiesOneItemOperatorDefault = `exact`
-export const experimentsPartialUpdateBodyMetricsSecondaryOneItemNumeratorOnePropertiesOneItemTypeDefault = `event`
-export const experimentsPartialUpdateBodyMetricsSecondaryOneItemNumeratorOutlierHandlingOneLowerBoundPercentileOneMin = 0
-export const experimentsPartialUpdateBodyMetricsSecondaryOneItemNumeratorOutlierHandlingOneLowerBoundPercentileOneMax = 1
-
-export const experimentsPartialUpdateBodyMetricsSecondaryOneItemNumeratorOutlierHandlingOneUpperBoundPercentileOneMin = 0
-export const experimentsPartialUpdateBodyMetricsSecondaryOneItemNumeratorOutlierHandlingOneUpperBoundPercentileOneMax = 1
-
-export const experimentsPartialUpdateBodyMetricsSecondaryOneItemSeriesOneItemPropertiesOneItemOperatorDefault = `exact`
-export const experimentsPartialUpdateBodyMetricsSecondaryOneItemSeriesOneItemPropertiesOneItemTypeDefault = `event`
-export const experimentsPartialUpdateBodyMetricsSecondaryOneItemSourceOnePropertiesOneItemOperatorDefault = `exact`
-export const experimentsPartialUpdateBodyMetricsSecondaryOneItemSourceOnePropertiesOneItemTypeDefault = `event`
-export const experimentsPartialUpdateBodyMetricsSecondaryOneItemStartEventOnePropertiesOneItemOperatorDefault = `exact`
-export const experimentsPartialUpdateBodyMetricsSecondaryOneItemStartEventOnePropertiesOneItemTypeDefault = `event`
-export const experimentsPartialUpdateBodyMetricsSecondaryOneItemUpperBoundPercentileOneMin = 0
-export const experimentsPartialUpdateBodyMetricsSecondaryOneItemUpperBoundPercentileOneMax = 1
-
-export const experimentsPartialUpdateBodyConclusionCommentMax = 4000
-
-export const experimentsPartialUpdateBodyRepositoryMax = 255
-
-export const ExperimentsPartialUpdateBody = /* @__PURE__ */ zod
- .object({
- name: zod.string().max(experimentsPartialUpdateBodyNameMax).optional().describe('Name of the experiment.'),
- description: zod
- .string()
- .max(experimentsPartialUpdateBodyDescriptionMax)
- .nullish()
- .describe('Description of the experiment hypothesis and expected outcomes.'),
- start_date: zod.iso.datetime({ offset: true }).nullish(),
- end_date: zod.iso.datetime({ offset: true }).nullish(),
- feature_flag_key: zod
- .string()
- .optional()
- .describe(
- "Unique key for the experiment's feature flag. Letters, numbers, hyphens, and underscores only. Search existing flags with the feature-flag-get-all tool first — reuse an existing flag when possible."
- ),
- feature_flag: zod
- .object({
- filters: zod
- .object({
- groups: zod
- .array(
- zod
- .object({
- rollout_percentage: zod
- .number()
- .min(
- experimentsPartialUpdateBodyFeatureFlagOneFiltersOneGroupsItemRolloutPercentageMin
- )
- .max(
- experimentsPartialUpdateBodyFeatureFlagOneFiltersOneGroupsItemRolloutPercentageMax
- )
- .nullish()
- .describe('Percentage of users who enter the experiment (0-100).'),
- properties: zod
- .array(zod.unknown())
- .max(
- experimentsPartialUpdateBodyFeatureFlagOneFiltersOneGroupsItemPropertiesMax
- )
+ .array(
+ zod.object({
+ completion_event: zod
+ .union([
+ zod.object({
+ event: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
+ id: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe('Action ID. Required for ActionsNode.'),
+ kind: zod.enum(['EventsNode', 'ActionsNode']),
+ math: zod
+ .union([
+ zod.enum([
+ 'total',
+ 'sum',
+ 'unique_session',
+ 'min',
+ 'max',
+ 'avg',
+ 'dau',
+ 'unique_group',
+ 'hogql',
+ ]),
+ zod.null(),
+ ])
.optional()
.describe(
- 'Must be empty or omitted: release-condition properties are not supported via the experiment input. Edit the feature flag directly for targeting.'
+ "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
),
- })
- .describe(
- 'A single release-condition group carrying only the overall rollout percentage, the one\ngroups entry the experiment input applies.'
- )
- )
- .optional()
- .describe(
- 'Overall rollout as a single group: [{\"properties\": [], \"rollout_percentage\": N}].'
- ),
- multivariate: zod
- .union([
- zod
- .object({
- variants: zod
- .array(
- zod
- .object({
- key: zod
- .string()
- .describe(
- "Unique variant key. The baseline defaults to the variant keyed 'control' when present, else the first variant."
- ),
- name: zod
- .string()
- .optional()
- .describe('Human-readable variant name.'),
- rollout_percentage: zod
- .number()
- .min(
- experimentsPartialUpdateBodyFeatureFlagOneFiltersOneMultivariateOneVariantsItemRolloutPercentageMin
- )
- .max(
- experimentsPartialUpdateBodyFeatureFlagOneFiltersOneMultivariateOneVariantsItemRolloutPercentageMax
- )
- .describe(
- 'Variant rollout percentage (0-100). Across variants these must sum to 100.'
+ math_group_type_index: zod
+ .union([
+ zod.union([
+ zod.literal(0),
+ zod.literal(1),
+ zod.literal(2),
+ zod.literal(3),
+ zod.literal(4),
+ ]),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "Group type index to aggregate over. Required when math is 'unique_group'."
+ ),
+ math_hogql: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
+ ),
+ math_property: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
+ ),
+ properties: zod
+ .union([
+ zod.array(
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod
+ .union([
+ zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ zod.null(),
+ ])
+ .default(
+ experimentsCreateBodyMetricsOneItemCompletionEventOnePropertiesOneItemOperatorDefault
),
+ type: zod
+ .literal('event')
+ .default(
+ experimentsCreateBodyMetricsOneItemCompletionEventOnePropertiesOneItemTypeDefault
+ )
+ .describe('Event properties'),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ ])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
})
- .describe(
- 'A single multivariate variant. Extra per-variant keys are dropped.'
- )
- )
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe('Event property filters to narrow which events are counted.'),
+ }),
+ zod.null(),
+ ])
+ .optional()
+ .describe('For retention metrics: completion event.'),
+ conversion_window: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe('Conversion window duration.'),
+ denominator: zod
+ .union([
+ zod.object({
+ event: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
+ id: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe('Action ID. Required for ActionsNode.'),
+ kind: zod.enum(['EventsNode', 'ActionsNode']),
+ math: zod
+ .union([
+ zod.enum([
+ 'total',
+ 'sum',
+ 'unique_session',
+ 'min',
+ 'max',
+ 'avg',
+ 'dau',
+ 'unique_group',
+ 'hogql',
+ ]),
+ zod.null(),
+ ])
+ .optional()
.describe(
- "Variant definitions (2 to 20). The baseline defaults to the variant keyed 'control' when present, else the first variant."
+ "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
),
- })
- .describe("Multivariate config for the experiment's feature flag."),
- zod.null(),
- ])
- .optional()
- .describe('Multivariate variant configuration.'),
- aggregation_group_type_index: zod
- .number()
- .nullish()
- .describe('Group type index for group-based feature flags.'),
- payloads: zod
- .record(zod.string(), zod.string())
- .optional()
- .describe('Optional payload values keyed by variant key.'),
- })
- .describe(
- "Feature-flag filters accepted by the experiment endpoints: the flag's own filters shape,\nminus the keys experiments don't apply."
- )
- .optional()
- .describe(
- "Flag config to apply: `multivariate.variants` (2 to 20 variants; the baseline defaults to the variant keyed 'control' when present, else the first variant), `groups` (a single group with `rollout_percentage` only; release conditions are not supported here, edit the feature flag directly), `aggregation_group_type_index`, and `payloads` (JSON-encoded strings keyed by variant key). On update, config this object omits is preserved from the linked flag's current state."
- ),
- ensure_experience_continuity: zod
- .boolean()
- .nullish()
- .describe('Whether the flag persists variant assignment across authentication steps.'),
- })
- .describe(
- "Flag config for experiment create\/update, sent through the linked feature flag's own shape.\n\nValidated both as the OpenAPI request field (via ``ExperimentWriteSerializer``) and at runtime\n(``ExperimentSerializer._normalize_feature_flag_input`` runs it against the raw feature_flag\nobject). Echoed read-only flag objects (carrying a non-null id) are handled upstream and never\nreach this validation."
- )
- .optional()
- .describe(
- "Feature-flag config for the experiment, in the flag's own filters shape. The linked flag is the source of truth for variants, rollout, aggregation, payloads, and experience continuity: send config here instead of the deprecated `parameters` keys. On a running experiment, also send `update_feature_flag_params=true`. Cannot be combined with the key of a pre-existing feature flag on create (the experiment links to it as-is)."
- ),
- holdout_id: zod.number().nullish().describe('ID of a holdout group to exclude from the experiment.'),
- parameters: zod
- .union([
- zod.object({
- minimum_detectable_effect: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe(
- 'Minimum detectable effect as a percentage. Lower values need more users but catch smaller changes. Suggest 20–30% for most experiments.'
- ),
- variant_notes: zod
- .union([zod.record(zod.string(), zod.string()), zod.null()])
- .optional()
- .describe(
- 'Free-text notes per variant, keyed by variant key. Use to document what each variant does or its reroute URL.'
- ),
- }),
- zod.null(),
- ])
- .optional()
- .describe(
- "Experiment parameters JSON. Supported keys include `custom_exposure_filter` and `variant_notes` (free-text notes per variant, keyed by variant key). Flag config (variants, rollout, aggregation, payloads, experience continuity) belongs on the `feature_flag` object; send it there. For backward compatibility, config still sent through these deprecated keys is copied onto the linked flag rather than rejected, and reads project the flag's current config back into this field. Excluded variants live on the top-level `excluded_variants` field, not here."
- ),
- running_time_calculation: zod
- .union([
- zod.object({
- exposure_estimate_config: zod
- .union([
- zod.object({
- conversionRateInputType: zod
- .enum(['manual', 'automatic'])
- .describe(
- "'manual' when the baseline value and exposure rate were entered by hand, 'automatic' when derived from live experiment data."
- ),
- manualBaselineValue: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe(
- 'Manually entered baseline metric value (a conversion percentage for funnel metrics). Only used in manual mode.'
- ),
- manualExposureRate: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe(
- 'Manually entered estimate of users exposed to the experiment per day. Only used in manual mode.'
- ),
- manualMetricType: zod
- .union([zod.enum(['funnel', 'mean_count', 'mean_sum_or_avg']), zod.null()])
- .optional()
- .describe(
- 'Metric type the manual baseline value refers to. Only used in manual mode.'
- ),
- }),
- zod.null(),
- ])
- .optional()
- .describe(
- 'How the exposure estimate is configured: manual user-entered values or automatic from live experiment data.'
- ),
- minimum_detectable_effect: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe(
- 'Minimum detectable effect as a percentage. Lower values need more users but catch smaller changes.'
- ),
- recommended_running_time: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe('Estimated number of days needed to reach the recommended sample size.'),
- recommended_sample_size: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe('Recommended number of exposed users needed for statistical significance.'),
- }),
- zod.null(),
- ])
- .optional()
- .describe(
- 'Running-time calculator state: `minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, and `exposure_estimate_config`. Canonical home for these keys, which historically lived in `parameters`.'
- ),
- excluded_variants: zod
- .array(zod.string())
- .nullish()
- .describe(
- 'Variant keys to exclude from metric result calculations. Excluded variants are still served to users but omitted from statistical analysis. The baseline variant and holdout pseudo-variants cannot be excluded. Canonical home for what historically lived in `parameters.excluded_variants`.'
- ),
- secondary_metrics: zod.unknown().optional(),
- saved_metrics_ids: zod
- .array(zod.unknown())
- .nullish()
- .describe(
- "IDs of shared saved metrics to attach to this experiment. Each item has 'id' (saved metric ID) and 'metadata' with 'type' (primary or secondary)."
- ),
- filters: zod.unknown().optional(),
- archived: zod.boolean().optional().describe('Whether the experiment is archived.'),
- deleted: zod.boolean().nullish(),
- type: zod
- .union([zod.enum(['web', 'product']).describe('\* `web` - web\n\* `product` - product'), zod.null()])
- .optional()
- .describe(
- 'Experiment type: web for frontend UI changes, product for backend\/API changes.\n\n\* `web` - web\n\* `product` - product'
- ),
- exposure_criteria: zod
- .union([
- zod.object({
- exposure_config: zod
- .union([
- zod.object({
- event: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "Custom exposure event name. Required when kind is 'ExperimentEventExposureConfig'."
- ),
- id: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe("Action ID. Required when kind is 'ActionsNode'."),
- kind: zod
- .union([zod.enum(['ExperimentEventExposureConfig', 'ActionsNode']), zod.null()])
- .optional()
- .describe(
- "Defaults to 'ExperimentEventExposureConfig' when omitted. Pass 'ActionsNode' for an action-based exposure."
- ),
- properties: zod
- .array(
- zod.union([
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod
- .union([
- zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
- 'min',
- 'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
- ]),
- zod.null(),
- ])
- .default(
- experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOneOperatorDefault
+ math_group_type_index: zod
+ .union([
+ zod.union([
+ zod.literal(0),
+ zod.literal(1),
+ zod.literal(2),
+ zod.literal(3),
+ zod.literal(4),
+ ]),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "Group type index to aggregate over. Required when math is 'unique_group'."
+ ),
+ math_hogql: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
+ ),
+ math_property: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
+ ),
+ properties: zod
+ .union([
+ zod.array(
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod
+ .union([
+ zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ zod.null(),
+ ])
+ .default(
+ experimentsCreateBodyMetricsOneItemDenominatorOnePropertiesOneItemOperatorDefault
+ ),
+ type: zod
+ .literal('event')
+ .default(
+ experimentsCreateBodyMetricsOneItemDenominatorOnePropertiesOneItemTypeDefault
+ )
+ .describe('Event properties'),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ ])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ })
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe('Event property filters to narrow which events are counted.'),
+ }),
+ zod.null(),
+ ])
+ .optional()
+ .describe('For ratio metrics: denominator source.'),
+ denominator_outlier_handling: zod
+ .union([
+ zod.object({
+ ignore_zeros: zod.union([zod.boolean(), zod.null()]).optional(),
+ lower_bound_percentile: zod
+ .union([
+ zod
+ .number()
+ .min(
+ experimentsCreateBodyMetricsOneItemDenominatorOutlierHandlingOneLowerBoundPercentileOneMin
+ )
+ .max(
+ experimentsCreateBodyMetricsOneItemDenominatorOutlierHandlingOneLowerBoundPercentileOneMax
),
- type: zod
- .literal('event')
- .default(
- experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOneTypeDefault
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ 'Winsorization lower percentile bound, as a fraction in [0, 1] (e.g. 0.01 for the 1st percentile).'
+ ),
+ upper_bound_percentile: zod
+ .union([
+ zod
+ .number()
+ .min(
+ experimentsCreateBodyMetricsOneItemDenominatorOutlierHandlingOneUpperBoundPercentileOneMin
)
- .describe('Event properties'),
- value: zod
- .union([
- zod.array(
- zod.union([zod.string(), zod.number(), zod.boolean()])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- }),
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
- 'min',
- 'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
- ]),
- type: zod
- .literal('person')
- .default(
- experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwoTypeDefault
- )
- .describe('Person properties'),
- value: zod
- .union([
- zod.array(
- zod.union([zod.string(), zod.number(), zod.boolean()])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- }),
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
- 'min',
- 'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
- ]),
- type: zod
- .literal('person_metadata')
- .default(
- experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemThreeTypeDefault
- )
- .describe(
- 'Top-level columns on the persons table (e.g. created_at), not properties JSON'
+ .max(
+ experimentsCreateBodyMetricsOneItemDenominatorOutlierHandlingOneUpperBoundPercentileOneMax
),
- value: zod
- .union([
- zod.array(
- zod.union([zod.string(), zod.number(), zod.boolean()])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- }),
- zod.object({
- key: zod.enum(['tag_name', 'text', 'href', 'selector']),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ 'Winsorization upper percentile bound, as a fraction in [0, 1] (e.g. 0.99 for the 99th percentile).'
+ ),
+ }),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ 'For ratio metrics: winsorization applied to the denominator aggregate. Leave unset for a binomial-style denominator, which is never clamped.'
+ ),
+ goal: zod
+ .union([zod.enum(['increase', 'decrease']), zod.null()])
+ .optional()
+ .describe('Whether higher or lower values indicate success.'),
+ ignore_zeros: zod
+ .union([zod.boolean(), zod.null()])
+ .optional()
+ .describe(
+ 'For mean metrics: exclude zero values when computing the winsorization percentile thresholds.'
+ ),
+ kind: zod
+ .literal('ExperimentMetric')
+ .default(experimentsCreateBodyMetricsOneItemKindDefault),
+ lower_bound_percentile: zod
+ .union([
+ zod
+ .number()
+ .min(experimentsCreateBodyMetricsOneItemLowerBoundPercentileOneMin)
+ .max(experimentsCreateBodyMetricsOneItemLowerBoundPercentileOneMax),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ 'For mean metrics: winsorization lower percentile bound, as a fraction in [0, 1] (e.g. 0.01 for the 1st percentile). Per-user values below this percentile are clamped to it before aggregation.'
+ ),
+ metric_type: zod.enum(['funnel', 'mean', 'ratio', 'retention']),
+ name: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe('Human-readable metric name.'),
+ numerator: zod
+ .union([
+ zod.object({
+ event: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
+ id: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe('Action ID. Required for ActionsNode.'),
+ kind: zod.enum(['EventsNode', 'ActionsNode']),
+ math: zod
+ .union([
+ zod.enum([
+ 'total',
+ 'sum',
+ 'unique_session',
'min',
'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
+ 'avg',
+ 'dau',
+ 'unique_group',
+ 'hogql',
]),
- type: zod
- .literal('element')
- .default(
- experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemFourTypeDefault
- ),
- value: zod
- .union([
- zod.array(
- zod.union([zod.string(), zod.number(), zod.boolean()])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- }),
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
- 'min',
- 'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
+ ),
+ math_group_type_index: zod
+ .union([
+ zod.union([
+ zod.literal(0),
+ zod.literal(1),
+ zod.literal(2),
+ zod.literal(3),
+ zod.literal(4),
]),
- type: zod
- .literal('event_metadata')
- .default(
- experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemFiveTypeDefault
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "Group type index to aggregate over. Required when math is 'unique_group'."
+ ),
+ math_hogql: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
+ ),
+ math_property: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
+ ),
+ properties: zod
+ .union([
+ zod.array(
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod
+ .union([
+ zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ zod.null(),
+ ])
+ .default(
+ experimentsCreateBodyMetricsOneItemNumeratorOnePropertiesOneItemOperatorDefault
+ ),
+ type: zod
+ .literal('event')
+ .default(
+ experimentsCreateBodyMetricsOneItemNumeratorOnePropertiesOneItemTypeDefault
+ )
+ .describe('Event properties'),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ ])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ })
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe('Event property filters to narrow which events are counted.'),
+ }),
+ zod.null(),
+ ])
+ .optional()
+ .describe('For ratio metrics: numerator source.'),
+ numerator_outlier_handling: zod
+ .union([
+ zod.object({
+ ignore_zeros: zod.union([zod.boolean(), zod.null()]).optional(),
+ lower_bound_percentile: zod
+ .union([
+ zod
+ .number()
+ .min(
+ experimentsCreateBodyMetricsOneItemNumeratorOutlierHandlingOneLowerBoundPercentileOneMin
+ )
+ .max(
+ experimentsCreateBodyMetricsOneItemNumeratorOutlierHandlingOneLowerBoundPercentileOneMax
),
- value: zod
- .union([
- zod.array(
- zod.union([zod.string(), zod.number(), zod.boolean()])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- }),
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
- 'min',
- 'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
- ]),
- type: zod
- .literal('session')
- .default(
- experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemSixTypeDefault
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ 'Winsorization lower percentile bound, as a fraction in [0, 1] (e.g. 0.01 for the 1st percentile).'
+ ),
+ upper_bound_percentile: zod
+ .union([
+ zod
+ .number()
+ .min(
+ experimentsCreateBodyMetricsOneItemNumeratorOutlierHandlingOneUpperBoundPercentileOneMin
+ )
+ .max(
+ experimentsCreateBodyMetricsOneItemNumeratorOutlierHandlingOneUpperBoundPercentileOneMax
),
- value: zod
- .union([
- zod.array(
- zod.union([zod.string(), zod.number(), zod.boolean()])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- }),
- zod.object({
- cohort_name: zod.union([zod.string(), zod.null()]).optional(),
- key: zod
- .literal('id')
- .default(
- experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemSevenKeyDefault
- ),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod
- .union([
- zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
- 'min',
- 'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
- ]),
- zod.null(),
- ])
- .default(
- experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemSevenOperatorDefault
- ),
- type: zod
- .literal('cohort')
- .default(
- experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemSevenTypeDefault
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ 'Winsorization upper percentile bound, as a fraction in [0, 1] (e.g. 0.99 for the 99th percentile).'
+ ),
+ }),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ 'For ratio metrics: winsorization applied to the numerator aggregate, independently of the denominator and each with its own percentile thresholds.'
+ ),
+ retention_window_end: zod.union([zod.number(), zod.null()]).optional(),
+ retention_window_start: zod.union([zod.number(), zod.null()]).optional(),
+ retention_window_unit: zod
+ .union([zod.enum(['second', 'minute', 'hour', 'day', 'week', 'month']), zod.null()])
+ .optional(),
+ series: zod
+ .union([
+ zod.array(
+ zod.object({
+ event: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
+ id: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe('Action ID. Required for ActionsNode.'),
+ kind: zod.enum(['EventsNode', 'ActionsNode']),
+ math: zod
+ .union([
+ zod.enum([
+ 'total',
+ 'sum',
+ 'unique_session',
+ 'min',
+ 'max',
+ 'avg',
+ 'dau',
+ 'unique_group',
+ 'hogql',
+ ]),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
+ ),
+ math_group_type_index: zod
+ .union([
+ zod.union([
+ zod.literal(0),
+ zod.literal(1),
+ zod.literal(2),
+ zod.literal(3),
+ zod.literal(4),
+ ]),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "Group type index to aggregate over. Required when math is 'unique_group'."
+ ),
+ math_hogql: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
+ ),
+ math_property: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
+ ),
+ properties: zod
+ .union([
+ zod.array(
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod
+ .union([
+ zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ zod.null(),
+ ])
+ .default(
+ experimentsCreateBodyMetricsOneItemSeriesOneItemPropertiesOneItemOperatorDefault
+ ),
+ type: zod
+ .literal('event')
+ .default(
+ experimentsCreateBodyMetricsOneItemSeriesOneItemPropertiesOneItemTypeDefault
+ )
+ .describe('Event properties'),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ ])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ })
),
- value: zod.number(),
- }),
- zod.object({
- key: zod.union([
- zod.enum(['duration', 'active_seconds', 'inactive_seconds']),
- zod.string(),
+ zod.null(),
+ ])
+ .optional()
+ .describe('Event property filters to narrow which events are counted.'),
+ })
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe('For funnel metrics: array of EventsNode\/ActionsNode steps.'),
+ source: zod
+ .union([
+ zod.object({
+ event: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
+ id: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe('Action ID. Required for ActionsNode.'),
+ kind: zod.enum(['EventsNode', 'ActionsNode']),
+ math: zod
+ .union([
+ zod.enum([
+ 'total',
+ 'sum',
+ 'unique_session',
+ 'min',
+ 'max',
+ 'avg',
+ 'dau',
+ 'unique_group',
+ 'hogql',
]),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
- 'min',
- 'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
+ ),
+ math_group_type_index: zod
+ .union([
+ zod.union([
+ zod.literal(0),
+ zod.literal(1),
+ zod.literal(2),
+ zod.literal(3),
+ zod.literal(4),
]),
- type: zod
- .literal('recording')
- .default(
- experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemEightTypeDefault
- ),
- value: zod
- .union([
- zod.array(
- zod.union([zod.string(), zod.number(), zod.boolean()])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- }),
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "Group type index to aggregate over. Required when math is 'unique_group'."
+ ),
+ math_hogql: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
+ ),
+ math_property: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
+ ),
+ properties: zod
+ .union([
+ zod.array(
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod
+ .union([
+ zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ zod.null(),
+ ])
+ .default(
+ experimentsCreateBodyMetricsOneItemSourceOnePropertiesOneItemOperatorDefault
+ ),
+ type: zod
+ .literal('event')
+ .default(
+ experimentsCreateBodyMetricsOneItemSourceOnePropertiesOneItemTypeDefault
+ )
+ .describe('Event properties'),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ ])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ })
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe('Event property filters to narrow which events are counted.'),
+ }),
+ zod.null(),
+ ])
+ .optional()
+ .describe('For mean metrics: event source.'),
+ start_event: zod
+ .union([
+ zod.object({
+ event: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
+ id: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe('Action ID. Required for ActionsNode.'),
+ kind: zod.enum(['EventsNode', 'ActionsNode']),
+ math: zod
+ .union([
+ zod.enum([
+ 'total',
+ 'sum',
+ 'unique_session',
'min',
'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
+ 'avg',
+ 'dau',
+ 'unique_group',
+ 'hogql',
]),
- type: zod
- .literal('log_entry')
- .default(
- experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemNineTypeDefault
- ),
- value: zod
- .union([
- zod.array(
- zod.union([zod.string(), zod.number(), zod.boolean()])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- }),
- zod.object({
- group_key_names: zod
- .union([zod.record(zod.string(), zod.string()), zod.null()])
- .optional(),
- group_type_index: zod.union([zod.number(), zod.null()]).optional(),
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
- 'min',
- 'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
+ ),
+ math_group_type_index: zod
+ .union([
+ zod.union([
+ zod.literal(0),
+ zod.literal(1),
+ zod.literal(2),
+ zod.literal(3),
+ zod.literal(4),
]),
- type: zod
- .literal('group')
- .default(
- experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnezeroTypeDefault
- ),
- value: zod
- .union([
- zod.array(
- zod.union([zod.string(), zod.number(), zod.boolean()])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- }),
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "Group type index to aggregate over. Required when math is 'unique_group'."
+ ),
+ math_hogql: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
+ ),
+ math_property: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
+ ),
+ properties: zod
+ .union([
+ zod.array(
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod
+ .union([
+ zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ zod.null(),
+ ])
+ .default(
+ experimentsCreateBodyMetricsOneItemStartEventOnePropertiesOneItemOperatorDefault
+ ),
+ type: zod
+ .literal('event')
+ .default(
+ experimentsCreateBodyMetricsOneItemStartEventOnePropertiesOneItemTypeDefault
+ )
+ .describe('Event properties'),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ ])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ })
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe('Event property filters to narrow which events are counted.'),
+ }),
+ zod.null(),
+ ])
+ .optional()
+ .describe('For retention metrics: start event.'),
+ start_handling: zod.union([zod.enum(['first_seen', 'last_seen']), zod.null()]).optional(),
+ threshold: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe(
+ 'For mean metrics: when set, reports the percentage of users whose per-user summed\/counted value reaches or exceeds this threshold. Only meaningful for sum\/count math types.'
+ ),
+ upper_bound_percentile: zod
+ .union([
+ zod
+ .number()
+ .min(experimentsCreateBodyMetricsOneItemUpperBoundPercentileOneMin)
+ .max(experimentsCreateBodyMetricsOneItemUpperBoundPercentileOneMax),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ 'For mean metrics: winsorization upper percentile bound, as a fraction in [0, 1] (e.g. 0.99 for the 99th percentile). Per-user values above this percentile are clamped to it before aggregation.'
+ ),
+ uuid: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe('Unique identifier. Auto-generated if omitted.'),
+ })
+ )
+ .describe('List wrapper for OpenAPI schema generation — the field stores an array of metrics.'),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "Primary experiment metrics. Each metric must have kind='ExperimentMetric' and a metric_type: 'mean' (set source to an EventsNode with an event name), 'funnel' (set series to an array of EventsNode steps), 'ratio' (set numerator and denominator EventsNode entries), or 'retention' (set start_event and completion_event). Use the read-data-schema tool with query kind 'events' to find available events in the project."
+ ),
+ metrics_secondary: zod
+ .union([
+ zod
+ .array(
+ zod.object({
+ completion_event: zod
+ .union([
+ zod.object({
+ event: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
+ id: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe('Action ID. Required for ActionsNode.'),
+ kind: zod.enum(['EventsNode', 'ActionsNode']),
+ math: zod
+ .union([
+ zod.enum([
+ 'total',
+ 'sum',
+ 'unique_session',
'min',
'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
+ 'avg',
+ 'dau',
+ 'unique_group',
+ 'hogql',
]),
- type: zod
- .literal('feature')
- .default(
- experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOneoneTypeDefault
- )
- .describe('Event property with \"$feature\/\" prepended'),
- value: zod
- .union([
- zod.array(
- zod.union([zod.string(), zod.number(), zod.boolean()])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- }),
- zod.object({
- key: zod.string().describe('The key should be the flag ID'),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod
- .literal('flag_evaluates_to')
- .default(
- experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnetwoOperatorDefault
- )
- .describe(
- 'Only flag_evaluates_to operator is allowed for flag dependencies'
- ),
- type: zod
- .literal('flag')
- .default(
- experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnetwoTypeDefault
- )
- .describe('Feature flag dependency'),
- value: zod
- .union([zod.boolean(), zod.string()])
- .describe('The value can be true, false, or a variant name'),
- }),
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- type: zod
- .literal('hogql')
- .default(
- experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnethreeTypeDefault
- ),
- value: zod
- .union([
- zod.array(
- zod.union([zod.string(), zod.number(), zod.boolean()])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- }),
- zod.object({
- type: zod
- .literal('empty')
- .default(
- experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnefourTypeDefault
- ),
- }),
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
+ ),
+ math_group_type_index: zod
+ .union([
+ zod.union([
+ zod.literal(0),
+ zod.literal(1),
+ zod.literal(2),
+ zod.literal(3),
+ zod.literal(4),
+ ]),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "Group type index to aggregate over. Required when math is 'unique_group'."
+ ),
+ math_hogql: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
+ ),
+ math_property: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
+ ),
+ properties: zod
+ .union([
+ zod.array(
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod
+ .union([
+ zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ zod.null(),
+ ])
+ .default(
+ experimentsCreateBodyMetricsSecondaryOneItemCompletionEventOnePropertiesOneItemOperatorDefault
+ ),
+ type: zod
+ .literal('event')
+ .default(
+ experimentsCreateBodyMetricsSecondaryOneItemCompletionEventOnePropertiesOneItemTypeDefault
+ )
+ .describe('Event properties'),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ ])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ })
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe('Event property filters to narrow which events are counted.'),
+ }),
+ zod.null(),
+ ])
+ .optional()
+ .describe('For retention metrics: completion event.'),
+ conversion_window: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe('Conversion window duration.'),
+ denominator: zod
+ .union([
+ zod.object({
+ event: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
+ id: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe('Action ID. Required for ActionsNode.'),
+ kind: zod.enum(['EventsNode', 'ActionsNode']),
+ math: zod
+ .union([
+ zod.enum([
+ 'total',
+ 'sum',
+ 'unique_session',
'min',
'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
+ 'avg',
+ 'dau',
+ 'unique_group',
+ 'hogql',
]),
- type: zod
- .literal('data_warehouse')
- .default(
- experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnefiveTypeDefault
- ),
- value: zod
- .union([
- zod.array(
- zod.union([zod.string(), zod.number(), zod.boolean()])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- }),
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
- 'min',
- 'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
+ ),
+ math_group_type_index: zod
+ .union([
+ zod.union([
+ zod.literal(0),
+ zod.literal(1),
+ zod.literal(2),
+ zod.literal(3),
+ zod.literal(4),
]),
- type: zod
- .literal('data_warehouse_person_property')
- .default(
- experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnesixTypeDefault
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "Group type index to aggregate over. Required when math is 'unique_group'."
+ ),
+ math_hogql: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
+ ),
+ math_property: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
+ ),
+ properties: zod
+ .union([
+ zod.array(
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod
+ .union([
+ zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ zod.null(),
+ ])
+ .default(
+ experimentsCreateBodyMetricsSecondaryOneItemDenominatorOnePropertiesOneItemOperatorDefault
+ ),
+ type: zod
+ .literal('event')
+ .default(
+ experimentsCreateBodyMetricsSecondaryOneItemDenominatorOnePropertiesOneItemTypeDefault
+ )
+ .describe('Event properties'),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ ])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ })
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe('Event property filters to narrow which events are counted.'),
+ }),
+ zod.null(),
+ ])
+ .optional()
+ .describe('For ratio metrics: denominator source.'),
+ denominator_outlier_handling: zod
+ .union([
+ zod.object({
+ ignore_zeros: zod.union([zod.boolean(), zod.null()]).optional(),
+ lower_bound_percentile: zod
+ .union([
+ zod
+ .number()
+ .min(
+ experimentsCreateBodyMetricsSecondaryOneItemDenominatorOutlierHandlingOneLowerBoundPercentileOneMin
+ )
+ .max(
+ experimentsCreateBodyMetricsSecondaryOneItemDenominatorOutlierHandlingOneLowerBoundPercentileOneMax
),
- value: zod
- .union([
- zod.array(
- zod.union([zod.string(), zod.number(), zod.boolean()])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- }),
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
- 'min',
- 'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
- ]),
- type: zod
- .literal('error_tracking_issue')
- .default(
- experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnesevenTypeDefault
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ 'Winsorization lower percentile bound, as a fraction in [0, 1] (e.g. 0.01 for the 1st percentile).'
+ ),
+ upper_bound_percentile: zod
+ .union([
+ zod
+ .number()
+ .min(
+ experimentsCreateBodyMetricsSecondaryOneItemDenominatorOutlierHandlingOneUpperBoundPercentileOneMin
+ )
+ .max(
+ experimentsCreateBodyMetricsSecondaryOneItemDenominatorOutlierHandlingOneUpperBoundPercentileOneMax
),
- value: zod
- .union([
- zod.array(
- zod.union([zod.string(), zod.number(), zod.boolean()])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- }),
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ 'Winsorization upper percentile bound, as a fraction in [0, 1] (e.g. 0.99 for the 99th percentile).'
+ ),
+ }),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ 'For ratio metrics: winsorization applied to the denominator aggregate. Leave unset for a binomial-style denominator, which is never clamped.'
+ ),
+ goal: zod
+ .union([zod.enum(['increase', 'decrease']), zod.null()])
+ .optional()
+ .describe('Whether higher or lower values indicate success.'),
+ ignore_zeros: zod
+ .union([zod.boolean(), zod.null()])
+ .optional()
+ .describe(
+ 'For mean metrics: exclude zero values when computing the winsorization percentile thresholds.'
+ ),
+ kind: zod
+ .literal('ExperimentMetric')
+ .default(experimentsCreateBodyMetricsSecondaryOneItemKindDefault),
+ lower_bound_percentile: zod
+ .union([
+ zod
+ .number()
+ .min(experimentsCreateBodyMetricsSecondaryOneItemLowerBoundPercentileOneMin)
+ .max(experimentsCreateBodyMetricsSecondaryOneItemLowerBoundPercentileOneMax),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ 'For mean metrics: winsorization lower percentile bound, as a fraction in [0, 1] (e.g. 0.01 for the 1st percentile). Per-user values below this percentile are clamped to it before aggregation.'
+ ),
+ metric_type: zod.enum(['funnel', 'mean', 'ratio', 'retention']),
+ name: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe('Human-readable metric name.'),
+ numerator: zod
+ .union([
+ zod.object({
+ event: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
+ id: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe('Action ID. Required for ActionsNode.'),
+ kind: zod.enum(['EventsNode', 'ActionsNode']),
+ math: zod
+ .union([
+ zod.enum([
+ 'total',
+ 'sum',
+ 'unique_session',
'min',
'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
+ 'avg',
+ 'dau',
+ 'unique_group',
+ 'hogql',
]),
- type: zod.enum(['log', 'log_attribute', 'log_resource_attribute']),
- value: zod
- .union([
- zod.array(
- zod.union([zod.string(), zod.number(), zod.boolean()])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- }),
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
- 'min',
- 'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
+ ),
+ math_group_type_index: zod
+ .union([
+ zod.union([
+ zod.literal(0),
+ zod.literal(1),
+ zod.literal(2),
+ zod.literal(3),
+ zod.literal(4),
]),
- type: zod
- .literal('metric_attribute')
- .default(
- experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnenineTypeDefault
- ),
- value: zod
- .union([
- zod.array(
- zod.union([zod.string(), zod.number(), zod.boolean()])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- }),
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
- 'min',
- 'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
- ]),
- type: zod.enum(['span', 'span_attribute', 'span_resource_attribute']),
- value: zod
- .union([
- zod.array(
- zod.union([zod.string(), zod.number(), zod.boolean()])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- }),
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
- 'min',
- 'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
- ]),
- type: zod
- .literal('revenue_analytics')
- .default(
- experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwooneTypeDefault
- ),
- value: zod
- .union([
- zod.array(
- zod.union([zod.string(), zod.number(), zod.boolean()])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- }),
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
- 'min',
- 'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
- ]),
- type: zod
- .literal('account_custom_property')
- .default(
- experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwotwoTypeDefault
- )
- .describe(
- 'Customer analytics account custom property — the key is the property definition id'
- ),
- value: zod
- .union([
- zod.array(
- zod.union([zod.string(), zod.number(), zod.boolean()])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- }),
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
- 'min',
- 'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
- ]),
- type: zod
- .literal('workflow_variable')
- .default(
- experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwothreeTypeDefault
- ),
- value: zod
- .union([
- zod.array(
- zod.union([zod.string(), zod.number(), zod.boolean()])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- }),
- ])
- )
- .describe(
- 'Property filters (event, person, and other supported types). Pass an empty array if no filters needed.'
- ),
- }),
- zod.null(),
- ])
- .optional(),
- filterTestAccounts: zod.union([zod.boolean(), zod.null()]).optional(),
- multiple_variant_handling: zod
- .union([zod.enum(['exclude', 'first_seen']), zod.null()])
- .optional()
- .describe(
- "How to handle entities exposed to multiple variants. 'exclude' (default) drops them from the analysis; 'first_seen' assigns them to the variant from their earliest exposure."
- ),
- }),
- zod.null(),
- ])
- .optional()
- .describe('Exposure configuration including filter test accounts and custom exposure events.'),
- metrics: zod
- .union([
- zod
- .array(
- zod.object({
- completion_event: zod
- .union([
- zod.object({
- event: zod
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "Group type index to aggregate over. Required when math is 'unique_group'."
+ ),
+ math_hogql: zod
.union([zod.string(), zod.null()])
.optional()
- .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
- id: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe('Action ID. Required for ActionsNode.'),
- kind: zod.enum(['EventsNode', 'ActionsNode']),
- math: zod
- .union([
- zod.enum([
- 'total',
- 'sum',
- 'unique_session',
- 'min',
- 'max',
- 'avg',
- 'dau',
- 'unique_group',
- 'hogql',
- ]),
- zod.null(),
- ])
- .optional()
- .describe(
- "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
- ),
- math_group_type_index: zod
- .union([
- zod.union([
- zod.literal(0),
- zod.literal(1),
- zod.literal(2),
- zod.literal(3),
- zod.literal(4),
- ]),
- zod.null(),
- ])
- .optional()
- .describe(
- "Group type index to aggregate over. Required when math is 'unique_group'."
- ),
- math_hogql: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
- ),
- math_property: zod
- .union([zod.string(), zod.null()])
+ .describe(
+ "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
+ ),
+ math_property: zod
+ .union([zod.string(), zod.null()])
.optional()
.describe(
"Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
@@ -6264,12 +5211,12 @@ export const ExperimentsPartialUpdateBody = /* @__PURE__ */ zod
zod.null(),
])
.default(
- experimentsPartialUpdateBodyMetricsOneItemCompletionEventOnePropertiesOneItemOperatorDefault
+ experimentsCreateBodyMetricsSecondaryOneItemNumeratorOnePropertiesOneItemOperatorDefault
),
type: zod
.literal('event')
.default(
- experimentsPartialUpdateBodyMetricsOneItemCompletionEventOnePropertiesOneItemTypeDefault
+ experimentsCreateBodyMetricsSecondaryOneItemNumeratorOnePropertiesOneItemTypeDefault
)
.describe('Event properties'),
value: zod
@@ -6297,12 +5244,201 @@ export const ExperimentsPartialUpdateBody = /* @__PURE__ */ zod
zod.null(),
])
.optional()
- .describe('For retention metrics: completion event.'),
- conversion_window: zod
- .union([zod.number(), zod.null()])
+ .describe('For ratio metrics: numerator source.'),
+ numerator_outlier_handling: zod
+ .union([
+ zod.object({
+ ignore_zeros: zod.union([zod.boolean(), zod.null()]).optional(),
+ lower_bound_percentile: zod
+ .union([
+ zod
+ .number()
+ .min(
+ experimentsCreateBodyMetricsSecondaryOneItemNumeratorOutlierHandlingOneLowerBoundPercentileOneMin
+ )
+ .max(
+ experimentsCreateBodyMetricsSecondaryOneItemNumeratorOutlierHandlingOneLowerBoundPercentileOneMax
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ 'Winsorization lower percentile bound, as a fraction in [0, 1] (e.g. 0.01 for the 1st percentile).'
+ ),
+ upper_bound_percentile: zod
+ .union([
+ zod
+ .number()
+ .min(
+ experimentsCreateBodyMetricsSecondaryOneItemNumeratorOutlierHandlingOneUpperBoundPercentileOneMin
+ )
+ .max(
+ experimentsCreateBodyMetricsSecondaryOneItemNumeratorOutlierHandlingOneUpperBoundPercentileOneMax
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ 'Winsorization upper percentile bound, as a fraction in [0, 1] (e.g. 0.99 for the 99th percentile).'
+ ),
+ }),
+ zod.null(),
+ ])
.optional()
- .describe('Conversion window duration.'),
- denominator: zod
+ .describe(
+ 'For ratio metrics: winsorization applied to the numerator aggregate, independently of the denominator and each with its own percentile thresholds.'
+ ),
+ retention_window_end: zod.union([zod.number(), zod.null()]).optional(),
+ retention_window_start: zod.union([zod.number(), zod.null()]).optional(),
+ retention_window_unit: zod
+ .union([zod.enum(['second', 'minute', 'hour', 'day', 'week', 'month']), zod.null()])
+ .optional(),
+ series: zod
+ .union([
+ zod.array(
+ zod.object({
+ event: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
+ id: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe('Action ID. Required for ActionsNode.'),
+ kind: zod.enum(['EventsNode', 'ActionsNode']),
+ math: zod
+ .union([
+ zod.enum([
+ 'total',
+ 'sum',
+ 'unique_session',
+ 'min',
+ 'max',
+ 'avg',
+ 'dau',
+ 'unique_group',
+ 'hogql',
+ ]),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
+ ),
+ math_group_type_index: zod
+ .union([
+ zod.union([
+ zod.literal(0),
+ zod.literal(1),
+ zod.literal(2),
+ zod.literal(3),
+ zod.literal(4),
+ ]),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "Group type index to aggregate over. Required when math is 'unique_group'."
+ ),
+ math_hogql: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
+ ),
+ math_property: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
+ ),
+ properties: zod
+ .union([
+ zod.array(
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod
+ .union([
+ zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ zod.null(),
+ ])
+ .default(
+ experimentsCreateBodyMetricsSecondaryOneItemSeriesOneItemPropertiesOneItemOperatorDefault
+ ),
+ type: zod
+ .literal('event')
+ .default(
+ experimentsCreateBodyMetricsSecondaryOneItemSeriesOneItemPropertiesOneItemTypeDefault
+ )
+ .describe('Event properties'),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ ])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ })
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe('Event property filters to narrow which events are counted.'),
+ })
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe('For funnel metrics: array of EventsNode\/ActionsNode steps.'),
+ source: zod
.union([
zod.object({
event: zod
@@ -6411,12 +5547,12 @@ export const ExperimentsPartialUpdateBody = /* @__PURE__ */ zod
zod.null(),
])
.default(
- experimentsPartialUpdateBodyMetricsOneItemDenominatorOnePropertiesOneItemOperatorDefault
+ experimentsCreateBodyMetricsSecondaryOneItemSourceOnePropertiesOneItemOperatorDefault
),
type: zod
.literal('event')
.default(
- experimentsPartialUpdateBodyMetricsOneItemDenominatorOnePropertiesOneItemTypeDefault
+ experimentsCreateBodyMetricsSecondaryOneItemSourceOnePropertiesOneItemTypeDefault
)
.describe('Event properties'),
value: zod
@@ -6444,81 +5580,8 @@ export const ExperimentsPartialUpdateBody = /* @__PURE__ */ zod
zod.null(),
])
.optional()
- .describe('For ratio metrics: denominator source.'),
- denominator_outlier_handling: zod
- .union([
- zod.object({
- ignore_zeros: zod.union([zod.boolean(), zod.null()]).optional(),
- lower_bound_percentile: zod
- .union([
- zod
- .number()
- .min(
- experimentsPartialUpdateBodyMetricsOneItemDenominatorOutlierHandlingOneLowerBoundPercentileOneMin
- )
- .max(
- experimentsPartialUpdateBodyMetricsOneItemDenominatorOutlierHandlingOneLowerBoundPercentileOneMax
- ),
- zod.null(),
- ])
- .optional()
- .describe(
- 'Winsorization lower percentile bound, as a fraction in [0, 1] (e.g. 0.01 for the 1st percentile).'
- ),
- upper_bound_percentile: zod
- .union([
- zod
- .number()
- .min(
- experimentsPartialUpdateBodyMetricsOneItemDenominatorOutlierHandlingOneUpperBoundPercentileOneMin
- )
- .max(
- experimentsPartialUpdateBodyMetricsOneItemDenominatorOutlierHandlingOneUpperBoundPercentileOneMax
- ),
- zod.null(),
- ])
- .optional()
- .describe(
- 'Winsorization upper percentile bound, as a fraction in [0, 1] (e.g. 0.99 for the 99th percentile).'
- ),
- }),
- zod.null(),
- ])
- .optional()
- .describe(
- 'For ratio metrics: winsorization applied to the denominator aggregate. Leave unset for a binomial-style denominator, which is never clamped.'
- ),
- goal: zod
- .union([zod.enum(['increase', 'decrease']), zod.null()])
- .optional()
- .describe('Whether higher or lower values indicate success.'),
- ignore_zeros: zod
- .union([zod.boolean(), zod.null()])
- .optional()
- .describe(
- 'For mean metrics: exclude zero values when computing the winsorization percentile thresholds.'
- ),
- kind: zod
- .literal('ExperimentMetric')
- .default(experimentsPartialUpdateBodyMetricsOneItemKindDefault),
- lower_bound_percentile: zod
- .union([
- zod
- .number()
- .min(experimentsPartialUpdateBodyMetricsOneItemLowerBoundPercentileOneMin)
- .max(experimentsPartialUpdateBodyMetricsOneItemLowerBoundPercentileOneMax),
- zod.null(),
- ])
- .optional()
- .describe(
- 'For mean metrics: winsorization lower percentile bound, as a fraction in [0, 1] (e.g. 0.01 for the 1st percentile). Per-user values below this percentile are clamped to it before aggregation.'
- ),
- metric_type: zod.enum(['funnel', 'mean', 'ratio', 'retention']),
- name: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe('Human-readable metric name.'),
- numerator: zod
+ .describe('For mean metrics: event source.'),
+ start_event: zod
.union([
zod.object({
event: zod
@@ -6627,12 +5690,12 @@ export const ExperimentsPartialUpdateBody = /* @__PURE__ */ zod
zod.null(),
])
.default(
- experimentsPartialUpdateBodyMetricsOneItemNumeratorOnePropertiesOneItemOperatorDefault
+ experimentsCreateBodyMetricsSecondaryOneItemStartEventOnePropertiesOneItemOperatorDefault
),
type: zod
.literal('event')
.default(
- experimentsPartialUpdateBodyMetricsOneItemNumeratorOnePropertiesOneItemTypeDefault
+ experimentsCreateBodyMetricsSecondaryOneItemStartEventOnePropertiesOneItemTypeDefault
)
.describe('Event properties'),
value: zod
@@ -6660,507 +5723,28 @@ export const ExperimentsPartialUpdateBody = /* @__PURE__ */ zod
zod.null(),
])
.optional()
- .describe('For ratio metrics: numerator source.'),
- numerator_outlier_handling: zod
+ .describe('For retention metrics: start event.'),
+ start_handling: zod.union([zod.enum(['first_seen', 'last_seen']), zod.null()]).optional(),
+ threshold: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe(
+ 'For mean metrics: when set, reports the percentage of users whose per-user summed\/counted value reaches or exceeds this threshold. Only meaningful for sum\/count math types.'
+ ),
+ upper_bound_percentile: zod
.union([
- zod.object({
- ignore_zeros: zod.union([zod.boolean(), zod.null()]).optional(),
- lower_bound_percentile: zod
- .union([
- zod
- .number()
- .min(
- experimentsPartialUpdateBodyMetricsOneItemNumeratorOutlierHandlingOneLowerBoundPercentileOneMin
- )
- .max(
- experimentsPartialUpdateBodyMetricsOneItemNumeratorOutlierHandlingOneLowerBoundPercentileOneMax
- ),
- zod.null(),
- ])
- .optional()
- .describe(
- 'Winsorization lower percentile bound, as a fraction in [0, 1] (e.g. 0.01 for the 1st percentile).'
- ),
- upper_bound_percentile: zod
- .union([
- zod
- .number()
- .min(
- experimentsPartialUpdateBodyMetricsOneItemNumeratorOutlierHandlingOneUpperBoundPercentileOneMin
- )
- .max(
- experimentsPartialUpdateBodyMetricsOneItemNumeratorOutlierHandlingOneUpperBoundPercentileOneMax
- ),
- zod.null(),
- ])
- .optional()
- .describe(
- 'Winsorization upper percentile bound, as a fraction in [0, 1] (e.g. 0.99 for the 99th percentile).'
- ),
- }),
+ zod
+ .number()
+ .min(experimentsCreateBodyMetricsSecondaryOneItemUpperBoundPercentileOneMin)
+ .max(experimentsCreateBodyMetricsSecondaryOneItemUpperBoundPercentileOneMax),
zod.null(),
])
.optional()
.describe(
- 'For ratio metrics: winsorization applied to the numerator aggregate, independently of the denominator and each with its own percentile thresholds.'
+ 'For mean metrics: winsorization upper percentile bound, as a fraction in [0, 1] (e.g. 0.99 for the 99th percentile). Per-user values above this percentile are clamped to it before aggregation.'
),
- retention_window_end: zod.union([zod.number(), zod.null()]).optional(),
- retention_window_start: zod.union([zod.number(), zod.null()]).optional(),
- retention_window_unit: zod
- .union([zod.enum(['second', 'minute', 'hour', 'day', 'week', 'month']), zod.null()])
- .optional(),
- series: zod
- .union([
- zod.array(
- zod.object({
- event: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
- id: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe('Action ID. Required for ActionsNode.'),
- kind: zod.enum(['EventsNode', 'ActionsNode']),
- math: zod
- .union([
- zod.enum([
- 'total',
- 'sum',
- 'unique_session',
- 'min',
- 'max',
- 'avg',
- 'dau',
- 'unique_group',
- 'hogql',
- ]),
- zod.null(),
- ])
- .optional()
- .describe(
- "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
- ),
- math_group_type_index: zod
- .union([
- zod.union([
- zod.literal(0),
- zod.literal(1),
- zod.literal(2),
- zod.literal(3),
- zod.literal(4),
- ]),
- zod.null(),
- ])
- .optional()
- .describe(
- "Group type index to aggregate over. Required when math is 'unique_group'."
- ),
- math_hogql: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
- ),
- math_property: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
- ),
- properties: zod
- .union([
- zod.array(
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod
- .union([
- zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
- 'min',
- 'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
- ]),
- zod.null(),
- ])
- .default(
- experimentsPartialUpdateBodyMetricsOneItemSeriesOneItemPropertiesOneItemOperatorDefault
- ),
- type: zod
- .literal('event')
- .default(
- experimentsPartialUpdateBodyMetricsOneItemSeriesOneItemPropertiesOneItemTypeDefault
- )
- .describe('Event properties'),
- value: zod
- .union([
- zod.array(
- zod.union([
- zod.string(),
- zod.number(),
- zod.boolean(),
- ])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- })
- ),
- zod.null(),
- ])
- .optional()
- .describe('Event property filters to narrow which events are counted.'),
- })
- ),
- zod.null(),
- ])
- .optional()
- .describe('For funnel metrics: array of EventsNode\/ActionsNode steps.'),
- source: zod
- .union([
- zod.object({
- event: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
- id: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe('Action ID. Required for ActionsNode.'),
- kind: zod.enum(['EventsNode', 'ActionsNode']),
- math: zod
- .union([
- zod.enum([
- 'total',
- 'sum',
- 'unique_session',
- 'min',
- 'max',
- 'avg',
- 'dau',
- 'unique_group',
- 'hogql',
- ]),
- zod.null(),
- ])
- .optional()
- .describe(
- "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
- ),
- math_group_type_index: zod
- .union([
- zod.union([
- zod.literal(0),
- zod.literal(1),
- zod.literal(2),
- zod.literal(3),
- zod.literal(4),
- ]),
- zod.null(),
- ])
- .optional()
- .describe(
- "Group type index to aggregate over. Required when math is 'unique_group'."
- ),
- math_hogql: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
- ),
- math_property: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
- ),
- properties: zod
- .union([
- zod.array(
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod
- .union([
- zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
- 'min',
- 'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
- ]),
- zod.null(),
- ])
- .default(
- experimentsPartialUpdateBodyMetricsOneItemSourceOnePropertiesOneItemOperatorDefault
- ),
- type: zod
- .literal('event')
- .default(
- experimentsPartialUpdateBodyMetricsOneItemSourceOnePropertiesOneItemTypeDefault
- )
- .describe('Event properties'),
- value: zod
- .union([
- zod.array(
- zod.union([
- zod.string(),
- zod.number(),
- zod.boolean(),
- ])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- })
- ),
- zod.null(),
- ])
- .optional()
- .describe('Event property filters to narrow which events are counted.'),
- }),
- zod.null(),
- ])
- .optional()
- .describe('For mean metrics: event source.'),
- start_event: zod
- .union([
- zod.object({
- event: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
- id: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe('Action ID. Required for ActionsNode.'),
- kind: zod.enum(['EventsNode', 'ActionsNode']),
- math: zod
- .union([
- zod.enum([
- 'total',
- 'sum',
- 'unique_session',
- 'min',
- 'max',
- 'avg',
- 'dau',
- 'unique_group',
- 'hogql',
- ]),
- zod.null(),
- ])
- .optional()
- .describe(
- "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
- ),
- math_group_type_index: zod
- .union([
- zod.union([
- zod.literal(0),
- zod.literal(1),
- zod.literal(2),
- zod.literal(3),
- zod.literal(4),
- ]),
- zod.null(),
- ])
- .optional()
- .describe(
- "Group type index to aggregate over. Required when math is 'unique_group'."
- ),
- math_hogql: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
- ),
- math_property: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
- ),
- properties: zod
- .union([
- zod.array(
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod
- .union([
- zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
- 'min',
- 'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
- ]),
- zod.null(),
- ])
- .default(
- experimentsPartialUpdateBodyMetricsOneItemStartEventOnePropertiesOneItemOperatorDefault
- ),
- type: zod
- .literal('event')
- .default(
- experimentsPartialUpdateBodyMetricsOneItemStartEventOnePropertiesOneItemTypeDefault
- )
- .describe('Event properties'),
- value: zod
- .union([
- zod.array(
- zod.union([
- zod.string(),
- zod.number(),
- zod.boolean(),
- ])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- })
- ),
- zod.null(),
- ])
- .optional()
- .describe('Event property filters to narrow which events are counted.'),
- }),
- zod.null(),
- ])
- .optional()
- .describe('For retention metrics: start event.'),
- start_handling: zod.union([zod.enum(['first_seen', 'last_seen']), zod.null()]).optional(),
- threshold: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe(
- 'For mean metrics: when set, reports the percentage of users whose per-user summed\/counted value reaches or exceeds this threshold. Only meaningful for sum\/count math types.'
- ),
- upper_bound_percentile: zod
- .union([
- zod
- .number()
- .min(experimentsPartialUpdateBodyMetricsOneItemUpperBoundPercentileOneMin)
- .max(experimentsPartialUpdateBodyMetricsOneItemUpperBoundPercentileOneMax),
- zod.null(),
- ])
- .optional()
- .describe(
- 'For mean metrics: winsorization upper percentile bound, as a fraction in [0, 1] (e.g. 0.99 for the 99th percentile). Per-user values above this percentile are clamped to it before aggregation.'
- ),
- uuid: zod
- .union([zod.string(), zod.null()])
+ uuid: zod
+ .union([zod.string(), zod.null()])
.optional()
.describe('Unique identifier. Auto-generated if omitted.'),
})
@@ -7169,454 +5753,4518 @@ export const ExperimentsPartialUpdateBody = /* @__PURE__ */ zod
zod.null(),
])
.optional()
+ .describe('Secondary metrics for additional measurements. Same format as primary metrics.'),
+ stats_config: zod.unknown().optional(),
+ scheduling_config: zod.unknown().optional(),
+ allow_unknown_events: zod
+ .boolean()
+ .default(experimentsCreateBodyAllowUnknownEventsDefault)
.describe(
- "Primary experiment metrics. Each metric must have kind='ExperimentMetric' and a metric_type: 'mean' (set source to an EventsNode with an event name), 'funnel' (set series to an array of EventsNode steps), 'ratio' (set numerator and denominator EventsNode entries), or 'retention' (set start_event and completion_event). Use the read-data-schema tool with query kind 'events' to find available events in the project."
+ "Suppresses the validation that rejects metrics referencing events not yet ingested by this project. REQUIRES explicit user confirmation before being set to true — never flip this silently to retry a failed call. The default validation catches typo'd event names and missing instrumentation. Set this to true only when the user has confirmed the event is intentional (e.g. they are about to instrument it)."
),
- metrics_secondary: zod
+ _create_in_folder: zod.string().optional(),
+ conclusion: zod
.union([
zod
- .array(
- zod.object({
- completion_event: zod
- .union([
- zod.object({
- event: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
- id: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe('Action ID. Required for ActionsNode.'),
- kind: zod.enum(['EventsNode', 'ActionsNode']),
- math: zod
- .union([
- zod.enum([
- 'total',
- 'sum',
- 'unique_session',
- 'min',
- 'max',
- 'avg',
- 'dau',
- 'unique_group',
- 'hogql',
- ]),
- zod.null(),
- ])
- .optional()
- .describe(
- "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
- ),
- math_group_type_index: zod
- .union([
- zod.union([
- zod.literal(0),
- zod.literal(1),
- zod.literal(2),
- zod.literal(3),
- zod.literal(4),
- ]),
- zod.null(),
- ])
- .optional()
- .describe(
- "Group type index to aggregate over. Required when math is 'unique_group'."
- ),
- math_hogql: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
- ),
- math_property: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
- ),
- properties: zod
- .union([
- zod.array(
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod
- .union([
- zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
- 'min',
- 'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
- ]),
- zod.null(),
- ])
- .default(
- experimentsPartialUpdateBodyMetricsSecondaryOneItemCompletionEventOnePropertiesOneItemOperatorDefault
- ),
- type: zod
- .literal('event')
- .default(
- experimentsPartialUpdateBodyMetricsSecondaryOneItemCompletionEventOnePropertiesOneItemTypeDefault
- )
- .describe('Event properties'),
- value: zod
- .union([
- zod.array(
- zod.union([
- zod.string(),
- zod.number(),
- zod.boolean(),
- ])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
- })
- ),
- zod.null(),
- ])
- .optional()
- .describe('Event property filters to narrow which events are counted.'),
- }),
- zod.null(),
- ])
- .optional()
- .describe('For retention metrics: completion event.'),
- conversion_window: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe('Conversion window duration.'),
- denominator: zod
- .union([
- zod.object({
- event: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
- id: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe('Action ID. Required for ActionsNode.'),
- kind: zod.enum(['EventsNode', 'ActionsNode']),
- math: zod
- .union([
- zod.enum([
- 'total',
- 'sum',
- 'unique_session',
- 'min',
- 'max',
- 'avg',
- 'dau',
- 'unique_group',
- 'hogql',
- ]),
- zod.null(),
- ])
- .optional()
- .describe(
- "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
- ),
- math_group_type_index: zod
- .union([
- zod.union([
- zod.literal(0),
- zod.literal(1),
- zod.literal(2),
- zod.literal(3),
- zod.literal(4),
- ]),
- zod.null(),
- ])
- .optional()
- .describe(
- "Group type index to aggregate over. Required when math is 'unique_group'."
- ),
- math_hogql: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
- ),
- math_property: zod
- .union([zod.string(), zod.null()])
+ .enum(['won', 'lost', 'inconclusive', 'stopped_early', 'invalid'])
+ .describe(
+ '\* `won` - won\n\* `lost` - lost\n\* `inconclusive` - inconclusive\n\* `stopped_early` - stopped_early\n\* `invalid` - invalid'
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ 'Experiment conclusion: won, lost, inconclusive, stopped_early, or invalid.\n\n\* `won` - won\n\* `lost` - lost\n\* `inconclusive` - inconclusive\n\* `stopped_early` - stopped_early\n\* `invalid` - invalid'
+ ),
+ conclusion_comment: zod
+ .string()
+ .max(experimentsCreateBodyConclusionCommentMax)
+ .nullish()
+ .describe('Comment about the experiment conclusion.'),
+ repository: zod
+ .string()
+ .max(experimentsCreateBodyRepositoryMax)
+ .nullish()
+ .describe(
+ "GitHub repository holding this experiment's feature-flag code, in `organization\/repository` format. Used as the target of the flag-cleanup pull request opened via open_cleanup_pr on end\/ship_variant. When not set, cleanup targets the team's only connected repository and is skipped if the team has several."
+ ),
+ primary_metrics_ordered_uuids: zod.unknown().optional(),
+ secondary_metrics_ordered_uuids: zod.unknown().optional(),
+ only_count_matured_users: zod.boolean().optional(),
+ update_feature_flag_params: zod
+ .boolean()
+ .default(experimentsCreateBodyUpdateFeatureFlagParamsDefault)
+ .describe(
+ 'When true, sync the flag config sent in this request (via the `feature_flag` object) to the linked feature flag. Draft experiments always sync regardless. On a running experiment, `feature_flag` config without this flag is rejected.'
+ ),
+ version: zod
+ .number()
+ .nullish()
+ .describe(
+ "Optimistic-concurrency token. Reads return the experiment's current version, bumped on every update. Send the version you last read with an update to detect concurrent edits: a stale update merges concurrent changes where safe — metric collections per metric uuid, other fields per field — using the base values sent in `original_experiment`, and fails with HTTP 409 only when the same metric or field changed on both sides (or no base value was sent for a changed field). Omit to skip the check."
+ ),
+ original_experiment: zod
+ .record(zod.string(), zod.unknown())
+ .nullish()
+ .describe(
+ 'The experiment state as the client last read it, used together with `version` to resolve concurrent edits: metric collections merge per metric uuid, and any other field the update carries merges per field against its base value here (only a same-field double edit fails). Relevant keys are metrics, metrics_secondary, saved_metrics_ids, plus the last-read values of whichever scalar fields the update writes; unknown keys are ignored. Changed fields without a base value — and, without this object, any version mismatch — fail with HTTP 409.'
+ ),
+ })
+ .describe('Experiment write payload. Identical to Experiment, plus the writable `feature_flag` config input.')
+
+/**
+ * Retrieve a single experiment by ID, including its current status, metrics, feature flag, and results metadata.
+ */
+export const ExperimentsRetrieveParams = /* @__PURE__ */ zod.object({
+ id: zod.number().describe('A unique integer value identifying this experiment.'),
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to \/api\/projects\/."
+ ),
+})
+
+/**
+ * Update an experiment. Use this to modify experiment properties such as name, description, metrics, variants, and configuration. Metrics can be added, changed and removed at any time. Feature-flag config (variants, rollout, payloads) is sent via the feature_flag object.
+ */
+export const ExperimentsPartialUpdateParams = /* @__PURE__ */ zod.object({
+ id: zod.number().describe('A unique integer value identifying this experiment.'),
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to \/api\/projects\/."
+ ),
+})
+
+export const experimentsPartialUpdateBodyNameMax = 400
+
+export const experimentsPartialUpdateBodyDescriptionMax = 3000
+
+export const experimentsPartialUpdateBodyFeatureFlagOneFiltersOneGroupsItemRolloutPercentageMin = 0
+export const experimentsPartialUpdateBodyFeatureFlagOneFiltersOneGroupsItemRolloutPercentageMax = 100
+
+export const experimentsPartialUpdateBodyFeatureFlagOneFiltersOneGroupsItemPropertiesMax = 0
+
+export const experimentsPartialUpdateBodyFeatureFlagOneFiltersOneMultivariateOneVariantsItemRolloutPercentageMin = 0
+export const experimentsPartialUpdateBodyFeatureFlagOneFiltersOneMultivariateOneVariantsItemRolloutPercentageMax = 100
+
+export const experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOneOperatorDefault = `exact`
+export const experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOneTypeDefault = `event`
+export const experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemTwoTypeDefault = `person`
+export const experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemThreeTypeDefault = `person_metadata`
+export const experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemFourTypeDefault = `element`
+export const experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemFiveTypeDefault = `event_metadata`
+export const experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemSixTypeDefault = `session`
+export const experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemSevenKeyDefault = `id`
+export const experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemSevenOperatorDefault = `in`
+export const experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemSevenTypeDefault = `cohort`
+export const experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemEightTypeDefault = `recording`
+export const experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemNineTypeDefault = `log_entry`
+export const experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnezeroTypeDefault = `group`
+export const experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOneoneTypeDefault = `feature`
+export const experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnetwoOperatorDefault = `flag_evaluates_to`
+export const experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnetwoTypeDefault = `flag`
+export const experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnethreeTypeDefault = `hogql`
+export const experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnefourTypeDefault = `empty`
+export const experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnefiveTypeDefault = `data_warehouse`
+export const experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnesixTypeDefault = `data_warehouse_person_property`
+export const experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnesevenTypeDefault = `error_tracking_issue`
+export const experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnenineTypeDefault = `metric_attribute`
+export const experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemTwooneTypeDefault = `revenue_analytics`
+export const experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemTwotwoTypeDefault = `account_custom_property`
+export const experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemTwothreeTypeDefault = `workflow_variable`
+export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOneOperatorDefault = `exact`
+export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOneTypeDefault = `event`
+export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwoTypeDefault = `person`
+export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemThreeTypeDefault = `person_metadata`
+export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemFourTypeDefault = `element`
+export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemFiveTypeDefault = `event_metadata`
+export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemSixTypeDefault = `session`
+export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemSevenKeyDefault = `id`
+export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemSevenOperatorDefault = `in`
+export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemSevenTypeDefault = `cohort`
+export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemEightTypeDefault = `recording`
+export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemNineTypeDefault = `log_entry`
+export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnezeroTypeDefault = `group`
+export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOneoneTypeDefault = `feature`
+export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnetwoOperatorDefault = `flag_evaluates_to`
+export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnetwoTypeDefault = `flag`
+export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnethreeTypeDefault = `hogql`
+export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnefourTypeDefault = `empty`
+export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnefiveTypeDefault = `data_warehouse`
+export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnesixTypeDefault = `data_warehouse_person_property`
+export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnesevenTypeDefault = `error_tracking_issue`
+export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnenineTypeDefault = `metric_attribute`
+export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwooneTypeDefault = `revenue_analytics`
+export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwotwoTypeDefault = `account_custom_property`
+export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwothreeTypeDefault = `workflow_variable`
+export const experimentsPartialUpdateBodyMetricsOneItemCompletionEventOnePropertiesOneItemOperatorDefault = `exact`
+export const experimentsPartialUpdateBodyMetricsOneItemCompletionEventOnePropertiesOneItemTypeDefault = `event`
+export const experimentsPartialUpdateBodyMetricsOneItemDenominatorOnePropertiesOneItemOperatorDefault = `exact`
+export const experimentsPartialUpdateBodyMetricsOneItemDenominatorOnePropertiesOneItemTypeDefault = `event`
+export const experimentsPartialUpdateBodyMetricsOneItemDenominatorOutlierHandlingOneLowerBoundPercentileOneMin = 0
+export const experimentsPartialUpdateBodyMetricsOneItemDenominatorOutlierHandlingOneLowerBoundPercentileOneMax = 1
+
+export const experimentsPartialUpdateBodyMetricsOneItemDenominatorOutlierHandlingOneUpperBoundPercentileOneMin = 0
+export const experimentsPartialUpdateBodyMetricsOneItemDenominatorOutlierHandlingOneUpperBoundPercentileOneMax = 1
+
+export const experimentsPartialUpdateBodyMetricsOneItemKindDefault = `ExperimentMetric`
+export const experimentsPartialUpdateBodyMetricsOneItemLowerBoundPercentileOneMin = 0
+export const experimentsPartialUpdateBodyMetricsOneItemLowerBoundPercentileOneMax = 1
+
+export const experimentsPartialUpdateBodyMetricsOneItemNumeratorOnePropertiesOneItemOperatorDefault = `exact`
+export const experimentsPartialUpdateBodyMetricsOneItemNumeratorOnePropertiesOneItemTypeDefault = `event`
+export const experimentsPartialUpdateBodyMetricsOneItemNumeratorOutlierHandlingOneLowerBoundPercentileOneMin = 0
+export const experimentsPartialUpdateBodyMetricsOneItemNumeratorOutlierHandlingOneLowerBoundPercentileOneMax = 1
+
+export const experimentsPartialUpdateBodyMetricsOneItemNumeratorOutlierHandlingOneUpperBoundPercentileOneMin = 0
+export const experimentsPartialUpdateBodyMetricsOneItemNumeratorOutlierHandlingOneUpperBoundPercentileOneMax = 1
+
+export const experimentsPartialUpdateBodyMetricsOneItemSeriesOneItemPropertiesOneItemOperatorDefault = `exact`
+export const experimentsPartialUpdateBodyMetricsOneItemSeriesOneItemPropertiesOneItemTypeDefault = `event`
+export const experimentsPartialUpdateBodyMetricsOneItemSourceOnePropertiesOneItemOperatorDefault = `exact`
+export const experimentsPartialUpdateBodyMetricsOneItemSourceOnePropertiesOneItemTypeDefault = `event`
+export const experimentsPartialUpdateBodyMetricsOneItemStartEventOnePropertiesOneItemOperatorDefault = `exact`
+export const experimentsPartialUpdateBodyMetricsOneItemStartEventOnePropertiesOneItemTypeDefault = `event`
+export const experimentsPartialUpdateBodyMetricsOneItemUpperBoundPercentileOneMin = 0
+export const experimentsPartialUpdateBodyMetricsOneItemUpperBoundPercentileOneMax = 1
+
+export const experimentsPartialUpdateBodyMetricsSecondaryOneItemCompletionEventOnePropertiesOneItemOperatorDefault = `exact`
+export const experimentsPartialUpdateBodyMetricsSecondaryOneItemCompletionEventOnePropertiesOneItemTypeDefault = `event`
+export const experimentsPartialUpdateBodyMetricsSecondaryOneItemDenominatorOnePropertiesOneItemOperatorDefault = `exact`
+export const experimentsPartialUpdateBodyMetricsSecondaryOneItemDenominatorOnePropertiesOneItemTypeDefault = `event`
+export const experimentsPartialUpdateBodyMetricsSecondaryOneItemDenominatorOutlierHandlingOneLowerBoundPercentileOneMin = 0
+export const experimentsPartialUpdateBodyMetricsSecondaryOneItemDenominatorOutlierHandlingOneLowerBoundPercentileOneMax = 1
+
+export const experimentsPartialUpdateBodyMetricsSecondaryOneItemDenominatorOutlierHandlingOneUpperBoundPercentileOneMin = 0
+export const experimentsPartialUpdateBodyMetricsSecondaryOneItemDenominatorOutlierHandlingOneUpperBoundPercentileOneMax = 1
+
+export const experimentsPartialUpdateBodyMetricsSecondaryOneItemKindDefault = `ExperimentMetric`
+export const experimentsPartialUpdateBodyMetricsSecondaryOneItemLowerBoundPercentileOneMin = 0
+export const experimentsPartialUpdateBodyMetricsSecondaryOneItemLowerBoundPercentileOneMax = 1
+
+export const experimentsPartialUpdateBodyMetricsSecondaryOneItemNumeratorOnePropertiesOneItemOperatorDefault = `exact`
+export const experimentsPartialUpdateBodyMetricsSecondaryOneItemNumeratorOnePropertiesOneItemTypeDefault = `event`
+export const experimentsPartialUpdateBodyMetricsSecondaryOneItemNumeratorOutlierHandlingOneLowerBoundPercentileOneMin = 0
+export const experimentsPartialUpdateBodyMetricsSecondaryOneItemNumeratorOutlierHandlingOneLowerBoundPercentileOneMax = 1
+
+export const experimentsPartialUpdateBodyMetricsSecondaryOneItemNumeratorOutlierHandlingOneUpperBoundPercentileOneMin = 0
+export const experimentsPartialUpdateBodyMetricsSecondaryOneItemNumeratorOutlierHandlingOneUpperBoundPercentileOneMax = 1
+
+export const experimentsPartialUpdateBodyMetricsSecondaryOneItemSeriesOneItemPropertiesOneItemOperatorDefault = `exact`
+export const experimentsPartialUpdateBodyMetricsSecondaryOneItemSeriesOneItemPropertiesOneItemTypeDefault = `event`
+export const experimentsPartialUpdateBodyMetricsSecondaryOneItemSourceOnePropertiesOneItemOperatorDefault = `exact`
+export const experimentsPartialUpdateBodyMetricsSecondaryOneItemSourceOnePropertiesOneItemTypeDefault = `event`
+export const experimentsPartialUpdateBodyMetricsSecondaryOneItemStartEventOnePropertiesOneItemOperatorDefault = `exact`
+export const experimentsPartialUpdateBodyMetricsSecondaryOneItemStartEventOnePropertiesOneItemTypeDefault = `event`
+export const experimentsPartialUpdateBodyMetricsSecondaryOneItemUpperBoundPercentileOneMin = 0
+export const experimentsPartialUpdateBodyMetricsSecondaryOneItemUpperBoundPercentileOneMax = 1
+
+export const experimentsPartialUpdateBodyConclusionCommentMax = 4000
+
+export const experimentsPartialUpdateBodyRepositoryMax = 255
+
+export const ExperimentsPartialUpdateBody = /* @__PURE__ */ zod
+ .object({
+ name: zod.string().max(experimentsPartialUpdateBodyNameMax).optional().describe('Name of the experiment.'),
+ description: zod
+ .string()
+ .max(experimentsPartialUpdateBodyDescriptionMax)
+ .nullish()
+ .describe('Description of the experiment hypothesis and expected outcomes.'),
+ start_date: zod.iso.datetime({ offset: true }).nullish(),
+ end_date: zod.iso.datetime({ offset: true }).nullish(),
+ feature_flag_key: zod
+ .string()
+ .optional()
+ .describe(
+ "Unique key for the experiment's feature flag. Letters, numbers, hyphens, and underscores only. Search existing flags with the feature-flag-get-all tool first — reuse an existing flag when possible."
+ ),
+ feature_flag: zod
+ .object({
+ filters: zod
+ .object({
+ groups: zod
+ .array(
+ zod
+ .object({
+ rollout_percentage: zod
+ .number()
+ .min(
+ experimentsPartialUpdateBodyFeatureFlagOneFiltersOneGroupsItemRolloutPercentageMin
+ )
+ .max(
+ experimentsPartialUpdateBodyFeatureFlagOneFiltersOneGroupsItemRolloutPercentageMax
+ )
+ .nullish()
+ .describe('Percentage of users who enter the experiment (0-100).'),
+ properties: zod
+ .array(zod.unknown())
+ .max(
+ experimentsPartialUpdateBodyFeatureFlagOneFiltersOneGroupsItemPropertiesMax
+ )
.optional()
.describe(
- "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
+ 'Must be empty or omitted: release-condition properties are not supported via the experiment input. Edit the feature flag directly for targeting.'
),
- properties: zod
- .union([
- zod.array(
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod
- .union([
- zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
- 'ends_with',
- 'not_ends_with',
- 'regex',
- 'not_regex',
- 'gt',
- 'gte',
- 'lt',
- 'lte',
- 'is_set',
- 'is_not_set',
- 'is_date_exact',
- 'is_date_before',
- 'is_date_after',
- 'between',
- 'not_between',
- 'min',
- 'max',
- 'in',
- 'not_in',
- 'is_cleaned_path_exact',
- 'flag_evaluates_to',
- 'semver_eq',
- 'semver_neq',
- 'semver_gt',
- 'semver_gte',
- 'semver_lt',
- 'semver_lte',
- 'semver_tilde',
- 'semver_caret',
- 'semver_wildcard',
- 'icontains_multi',
- 'not_icontains_multi',
- ]),
- zod.null(),
- ])
- .default(
- experimentsPartialUpdateBodyMetricsSecondaryOneItemDenominatorOnePropertiesOneItemOperatorDefault
+ })
+ .describe(
+ 'A single release-condition group carrying only the overall rollout percentage, the one\ngroups entry the experiment input applies.'
+ )
+ )
+ .optional()
+ .describe(
+ 'Overall rollout as a single group: [{\"properties\": [], \"rollout_percentage\": N}].'
+ ),
+ multivariate: zod
+ .union([
+ zod
+ .object({
+ variants: zod
+ .array(
+ zod
+ .object({
+ key: zod
+ .string()
+ .describe(
+ "Unique variant key. The baseline defaults to the variant keyed 'control' when present, else the first variant."
),
- type: zod
- .literal('event')
- .default(
- experimentsPartialUpdateBodyMetricsSecondaryOneItemDenominatorOnePropertiesOneItemTypeDefault
+ name: zod
+ .string()
+ .optional()
+ .describe('Human-readable variant name.'),
+ rollout_percentage: zod
+ .number()
+ .min(
+ experimentsPartialUpdateBodyFeatureFlagOneFiltersOneMultivariateOneVariantsItemRolloutPercentageMin
)
- .describe('Event properties'),
- value: zod
- .union([
- zod.array(
- zod.union([
- zod.string(),
- zod.number(),
- zod.boolean(),
- ])
- ),
- zod.string(),
- zod.number(),
- zod.boolean(),
- zod.null(),
- ])
- .optional(),
+ .max(
+ experimentsPartialUpdateBodyFeatureFlagOneFiltersOneMultivariateOneVariantsItemRolloutPercentageMax
+ )
+ .describe(
+ 'Variant rollout percentage (0-100). Across variants these must sum to 100.'
+ ),
})
- ),
- zod.null(),
- ])
- .optional()
- .describe('Event property filters to narrow which events are counted.'),
- }),
- zod.null(),
- ])
- .optional()
- .describe('For ratio metrics: denominator source.'),
- denominator_outlier_handling: zod
- .union([
- zod.object({
- ignore_zeros: zod.union([zod.boolean(), zod.null()]).optional(),
- lower_bound_percentile: zod
- .union([
- zod
- .number()
- .min(
- experimentsPartialUpdateBodyMetricsSecondaryOneItemDenominatorOutlierHandlingOneLowerBoundPercentileOneMin
- )
- .max(
- experimentsPartialUpdateBodyMetricsSecondaryOneItemDenominatorOutlierHandlingOneLowerBoundPercentileOneMax
- ),
- zod.null(),
- ])
- .optional()
- .describe(
- 'Winsorization lower percentile bound, as a fraction in [0, 1] (e.g. 0.01 for the 1st percentile).'
- ),
- upper_bound_percentile: zod
- .union([
- zod
- .number()
- .min(
- experimentsPartialUpdateBodyMetricsSecondaryOneItemDenominatorOutlierHandlingOneUpperBoundPercentileOneMin
+ .describe(
+ 'A single multivariate variant. Extra per-variant keys are dropped.'
)
- .max(
- experimentsPartialUpdateBodyMetricsSecondaryOneItemDenominatorOutlierHandlingOneUpperBoundPercentileOneMax
- ),
- zod.null(),
- ])
- .optional()
- .describe(
- 'Winsorization upper percentile bound, as a fraction in [0, 1] (e.g. 0.99 for the 99th percentile).'
- ),
- }),
- zod.null(),
- ])
- .optional()
- .describe(
- 'For ratio metrics: winsorization applied to the denominator aggregate. Leave unset for a binomial-style denominator, which is never clamped.'
- ),
- goal: zod
- .union([zod.enum(['increase', 'decrease']), zod.null()])
- .optional()
- .describe('Whether higher or lower values indicate success.'),
- ignore_zeros: zod
- .union([zod.boolean(), zod.null()])
- .optional()
- .describe(
- 'For mean metrics: exclude zero values when computing the winsorization percentile thresholds.'
- ),
- kind: zod
- .literal('ExperimentMetric')
- .default(experimentsPartialUpdateBodyMetricsSecondaryOneItemKindDefault),
- lower_bound_percentile: zod
- .union([
- zod
- .number()
- .min(
- experimentsPartialUpdateBodyMetricsSecondaryOneItemLowerBoundPercentileOneMin
- )
- .max(
- experimentsPartialUpdateBodyMetricsSecondaryOneItemLowerBoundPercentileOneMax
- ),
- zod.null(),
- ])
- .optional()
- .describe(
- 'For mean metrics: winsorization lower percentile bound, as a fraction in [0, 1] (e.g. 0.01 for the 1st percentile). Per-user values below this percentile are clamped to it before aggregation.'
- ),
- metric_type: zod.enum(['funnel', 'mean', 'ratio', 'retention']),
- name: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe('Human-readable metric name.'),
- numerator: zod
- .union([
- zod.object({
- event: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
- id: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe('Action ID. Required for ActionsNode.'),
- kind: zod.enum(['EventsNode', 'ActionsNode']),
- math: zod
- .union([
- zod.enum([
- 'total',
- 'sum',
- 'unique_session',
- 'min',
- 'max',
- 'avg',
- 'dau',
- 'unique_group',
- 'hogql',
- ]),
- zod.null(),
- ])
- .optional()
- .describe(
- "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
- ),
- math_group_type_index: zod
- .union([
- zod.union([
- zod.literal(0),
- zod.literal(1),
- zod.literal(2),
- zod.literal(3),
- zod.literal(4),
- ]),
- zod.null(),
- ])
- .optional()
- .describe(
- "Group type index to aggregate over. Required when math is 'unique_group'."
- ),
- math_hogql: zod
- .union([zod.string(), zod.null()])
- .optional()
- .describe(
- "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
- ),
- math_property: zod
- .union([zod.string(), zod.null()])
- .optional()
+ )
.describe(
- "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
+ "Variant definitions (2 to 20). The baseline defaults to the variant keyed 'control' when present, else the first variant."
),
- properties: zod
- .union([
- zod.array(
- zod.object({
- key: zod.string(),
- label: zod.union([zod.string(), zod.null()]).optional(),
- operator: zod
- .union([
- zod.enum([
- 'exact',
- 'is_not',
- 'icontains',
- 'not_icontains',
- 'starts_with',
- 'not_starts_with',
+ })
+ .describe("Multivariate config for the experiment's feature flag."),
+ zod.null(),
+ ])
+ .optional()
+ .describe('Multivariate variant configuration.'),
+ aggregation_group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index for group-based feature flags.'),
+ payloads: zod
+ .record(zod.string(), zod.string())
+ .optional()
+ .describe('Optional payload values keyed by variant key.'),
+ })
+ .describe(
+ "Feature-flag filters accepted by the experiment endpoints: the flag's own filters shape,\nminus the keys experiments don't apply."
+ )
+ .optional()
+ .describe(
+ "Flag config to apply: `multivariate.variants` (2 to 20 variants; the baseline defaults to the variant keyed 'control' when present, else the first variant), `groups` (a single group with `rollout_percentage` only; release conditions are not supported here, edit the feature flag directly), `aggregation_group_type_index`, and `payloads` (JSON-encoded strings keyed by variant key). On update, config this object omits is preserved from the linked flag's current state."
+ ),
+ ensure_experience_continuity: zod
+ .boolean()
+ .nullish()
+ .describe('Whether the flag persists variant assignment across authentication steps.'),
+ })
+ .describe(
+ "Flag config for experiment create\/update, sent through the linked feature flag's own shape.\n\nValidated both as the OpenAPI request field (via ``ExperimentWriteSerializer``) and at runtime\n(``ExperimentSerializer._normalize_feature_flag_input`` runs it against the raw feature_flag\nobject). Echoed read-only flag objects (carrying a non-null id) are handled upstream and never\nreach this validation."
+ )
+ .optional()
+ .describe(
+ "Feature-flag config for the experiment, in the flag's own filters shape. The linked flag is the source of truth for variants, rollout, aggregation, payloads, and experience continuity: send config here instead of the deprecated `parameters` keys. On a running experiment, also send `update_feature_flag_params=true`. Cannot be combined with the key of a pre-existing feature flag on create (the experiment links to it as-is)."
+ ),
+ holdout_id: zod.number().nullish().describe('ID of a holdout group to exclude from the experiment.'),
+ parameters: zod
+ .union([
+ zod.object({
+ minimum_detectable_effect: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe(
+ 'Minimum detectable effect as a percentage. Lower values need more users but catch smaller changes. Suggest 20–30% for most experiments.'
+ ),
+ variant_notes: zod
+ .union([zod.record(zod.string(), zod.string()), zod.null()])
+ .optional()
+ .describe(
+ 'Free-text notes per variant, keyed by variant key. Use to document what each variant does or its reroute URL.'
+ ),
+ }),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "Experiment parameters JSON. Supported keys include `custom_exposure_filter` and `variant_notes` (free-text notes per variant, keyed by variant key). Flag config (variants, rollout, aggregation, payloads, experience continuity) belongs on the `feature_flag` object; send it there. For backward compatibility, config still sent through these deprecated keys is copied onto the linked flag rather than rejected, and reads project the flag's current config back into this field. Excluded variants live on the top-level `excluded_variants` field, not here."
+ ),
+ running_time_calculation: zod
+ .union([
+ zod.object({
+ exposure_estimate_config: zod
+ .union([
+ zod.object({
+ conversionRateInputType: zod
+ .enum(['manual', 'automatic'])
+ .describe(
+ "'manual' when the baseline value and exposure rate were entered by hand, 'automatic' when derived from live experiment data."
+ ),
+ manualBaselineValue: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe(
+ 'Manually entered baseline metric value (a conversion percentage for funnel metrics). Only used in manual mode.'
+ ),
+ manualExposureRate: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe(
+ 'Manually entered estimate of users exposed to the experiment per day. Only used in manual mode.'
+ ),
+ manualMetricType: zod
+ .union([zod.enum(['funnel', 'mean_count', 'mean_sum_or_avg']), zod.null()])
+ .optional()
+ .describe(
+ 'Metric type the manual baseline value refers to. Only used in manual mode.'
+ ),
+ }),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ 'How the exposure estimate is configured: manual user-entered values or automatic from live experiment data.'
+ ),
+ minimum_detectable_effect: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe(
+ 'Minimum detectable effect as a percentage. Lower values need more users but catch smaller changes.'
+ ),
+ recommended_running_time: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe('Estimated number of days needed to reach the recommended sample size.'),
+ recommended_sample_size: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe('Recommended number of exposed users needed for statistical significance.'),
+ }),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ 'Running-time calculator state: `minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, and `exposure_estimate_config`. Canonical home for these keys, which historically lived in `parameters`.'
+ ),
+ excluded_variants: zod
+ .array(zod.string())
+ .nullish()
+ .describe(
+ 'Variant keys to exclude from metric result calculations. Excluded variants are still served to users but omitted from statistical analysis. The baseline variant and holdout pseudo-variants cannot be excluded. Canonical home for what historically lived in `parameters.excluded_variants`.'
+ ),
+ secondary_metrics: zod.unknown().optional(),
+ saved_metrics_ids: zod
+ .array(zod.unknown())
+ .nullish()
+ .describe(
+ "IDs of shared saved metrics to attach to this experiment. Each item has 'id' (saved metric ID) and 'metadata' with 'type' (primary or secondary)."
+ ),
+ filters: zod.unknown().optional(),
+ archived: zod.boolean().optional().describe('Whether the experiment is archived.'),
+ deleted: zod.boolean().nullish(),
+ type: zod
+ .union([zod.enum(['web', 'product']).describe('\* `web` - web\n\* `product` - product'), zod.null()])
+ .optional()
+ .describe(
+ 'Experiment type: web for frontend UI changes, product for backend\/API changes.\n\n\* `web` - web\n\* `product` - product'
+ ),
+ exposure_criteria: zod
+ .union([
+ zod.object({
+ activation_config: zod
+ .union([
+ zod.object({
+ event: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "Custom exposure event name. Required when kind is 'ExperimentEventExposureConfig'."
+ ),
+ id: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe("Action ID. Required when kind is 'ActionsNode'."),
+ kind: zod
+ .union([zod.enum(['ExperimentEventExposureConfig', 'ActionsNode']), zod.null()])
+ .optional()
+ .describe(
+ "Defaults to 'ExperimentEventExposureConfig' when omitted. Pass 'ActionsNode' for an action-based exposure."
+ ),
+ properties: zod
+ .array(
+ zod.union([
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod
+ .union([
+ zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ zod.null(),
+ ])
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOneOperatorDefault
+ ),
+ type: zod
+ .literal('event')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOneTypeDefault
+ )
+ .describe('Event properties'),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('person')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemTwoTypeDefault
+ )
+ .describe('Person properties'),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('person_metadata')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemThreeTypeDefault
+ )
+ .describe(
+ 'Top-level columns on the persons table (e.g. created_at), not properties JSON'
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.enum(['tag_name', 'text', 'href', 'selector']),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('element')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemFourTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('event_metadata')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemFiveTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('session')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemSixTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ cohort_name: zod.union([zod.string(), zod.null()]).optional(),
+ key: zod
+ .literal('id')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemSevenKeyDefault
+ ),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod
+ .union([
+ zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ zod.null(),
+ ])
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemSevenOperatorDefault
+ ),
+ type: zod
+ .literal('cohort')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemSevenTypeDefault
+ ),
+ value: zod.number(),
+ }),
+ zod.object({
+ key: zod.union([
+ zod.enum(['duration', 'active_seconds', 'inactive_seconds']),
+ zod.string(),
+ ]),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('recording')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemEightTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('log_entry')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemNineTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ group_key_names: zod
+ .union([zod.record(zod.string(), zod.string()), zod.null()])
+ .optional(),
+ group_type_index: zod.union([zod.number(), zod.null()]).optional(),
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('group')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnezeroTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('feature')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOneoneTypeDefault
+ )
+ .describe('Event property with \"$feature\/\" prepended'),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string().describe('The key should be the flag ID'),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod
+ .literal('flag_evaluates_to')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnetwoOperatorDefault
+ )
+ .describe(
+ 'Only flag_evaluates_to operator is allowed for flag dependencies'
+ ),
+ type: zod
+ .literal('flag')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnetwoTypeDefault
+ )
+ .describe('Feature flag dependency'),
+ value: zod
+ .union([zod.boolean(), zod.string()])
+ .describe('The value can be true, false, or a variant name'),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ type: zod
+ .literal('hogql')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnethreeTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ type: zod
+ .literal('empty')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnefourTypeDefault
+ ),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('data_warehouse')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnefiveTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('data_warehouse_person_property')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnesixTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('error_tracking_issue')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnesevenTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod.enum(['log', 'log_attribute', 'log_resource_attribute']),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('metric_attribute')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnenineTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod.enum(['span', 'span_attribute', 'span_resource_attribute']),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('revenue_analytics')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemTwooneTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('account_custom_property')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemTwotwoTypeDefault
+ )
+ .describe(
+ 'Customer analytics account custom property — the key is the property definition id'
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('workflow_variable')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneActivationConfigOnePropertiesItemTwothreeTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ ])
+ )
+ .describe(
+ 'Property filters (event, person, and other supported types). Pass an empty array if no filters needed.'
+ ),
+ }),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "Additional event (or action) an entity must emit at\/after their first default exposure event before they count as exposed; exposure time becomes this event's timestamp. Only valid with the default exposure event, not a custom `exposure_config`."
+ ),
+ exposure_config: zod
+ .union([
+ zod.object({
+ event: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "Custom exposure event name. Required when kind is 'ExperimentEventExposureConfig'."
+ ),
+ id: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe("Action ID. Required when kind is 'ActionsNode'."),
+ kind: zod
+ .union([zod.enum(['ExperimentEventExposureConfig', 'ActionsNode']), zod.null()])
+ .optional()
+ .describe(
+ "Defaults to 'ExperimentEventExposureConfig' when omitted. Pass 'ActionsNode' for an action-based exposure."
+ ),
+ properties: zod
+ .array(
+ zod.union([
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod
+ .union([
+ zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ zod.null(),
+ ])
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOneOperatorDefault
+ ),
+ type: zod
+ .literal('event')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOneTypeDefault
+ )
+ .describe('Event properties'),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('person')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwoTypeDefault
+ )
+ .describe('Person properties'),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('person_metadata')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemThreeTypeDefault
+ )
+ .describe(
+ 'Top-level columns on the persons table (e.g. created_at), not properties JSON'
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.enum(['tag_name', 'text', 'href', 'selector']),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('element')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemFourTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('event_metadata')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemFiveTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('session')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemSixTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ cohort_name: zod.union([zod.string(), zod.null()]).optional(),
+ key: zod
+ .literal('id')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemSevenKeyDefault
+ ),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod
+ .union([
+ zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ zod.null(),
+ ])
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemSevenOperatorDefault
+ ),
+ type: zod
+ .literal('cohort')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemSevenTypeDefault
+ ),
+ value: zod.number(),
+ }),
+ zod.object({
+ key: zod.union([
+ zod.enum(['duration', 'active_seconds', 'inactive_seconds']),
+ zod.string(),
+ ]),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('recording')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemEightTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('log_entry')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemNineTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ group_key_names: zod
+ .union([zod.record(zod.string(), zod.string()), zod.null()])
+ .optional(),
+ group_type_index: zod.union([zod.number(), zod.null()]).optional(),
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('group')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnezeroTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('feature')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOneoneTypeDefault
+ )
+ .describe('Event property with \"$feature\/\" prepended'),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string().describe('The key should be the flag ID'),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod
+ .literal('flag_evaluates_to')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnetwoOperatorDefault
+ )
+ .describe(
+ 'Only flag_evaluates_to operator is allowed for flag dependencies'
+ ),
+ type: zod
+ .literal('flag')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnetwoTypeDefault
+ )
+ .describe('Feature flag dependency'),
+ value: zod
+ .union([zod.boolean(), zod.string()])
+ .describe('The value can be true, false, or a variant name'),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ type: zod
+ .literal('hogql')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnethreeTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ type: zod
+ .literal('empty')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnefourTypeDefault
+ ),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('data_warehouse')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnefiveTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('data_warehouse_person_property')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnesixTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('error_tracking_issue')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnesevenTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod.enum(['log', 'log_attribute', 'log_resource_attribute']),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('metric_attribute')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOnenineTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod.enum(['span', 'span_attribute', 'span_resource_attribute']),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('revenue_analytics')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwooneTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('account_custom_property')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwotwoTypeDefault
+ )
+ .describe(
+ 'Customer analytics account custom property — the key is the property definition id'
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('workflow_variable')
+ .default(
+ experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwothreeTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ ])
+ )
+ .describe(
+ 'Property filters (event, person, and other supported types). Pass an empty array if no filters needed.'
+ ),
+ }),
+ zod.null(),
+ ])
+ .optional(),
+ filterTestAccounts: zod.union([zod.boolean(), zod.null()]).optional(),
+ multiple_variant_handling: zod
+ .union([zod.enum(['exclude', 'first_seen']), zod.null()])
+ .optional()
+ .describe(
+ "How to handle entities exposed to multiple variants. 'exclude' (default) drops them from the analysis; 'first_seen' assigns them to the variant from their earliest exposure."
+ ),
+ }),
+ zod.null(),
+ ])
+ .optional()
+ .describe('Exposure configuration including filter test accounts and custom exposure events.'),
+ metrics: zod
+ .union([
+ zod
+ .array(
+ zod.object({
+ completion_event: zod
+ .union([
+ zod.object({
+ event: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
+ id: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe('Action ID. Required for ActionsNode.'),
+ kind: zod.enum(['EventsNode', 'ActionsNode']),
+ math: zod
+ .union([
+ zod.enum([
+ 'total',
+ 'sum',
+ 'unique_session',
+ 'min',
+ 'max',
+ 'avg',
+ 'dau',
+ 'unique_group',
+ 'hogql',
+ ]),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
+ ),
+ math_group_type_index: zod
+ .union([
+ zod.union([
+ zod.literal(0),
+ zod.literal(1),
+ zod.literal(2),
+ zod.literal(3),
+ zod.literal(4),
+ ]),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "Group type index to aggregate over. Required when math is 'unique_group'."
+ ),
+ math_hogql: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
+ ),
+ math_property: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
+ ),
+ properties: zod
+ .union([
+ zod.array(
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod
+ .union([
+ zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ zod.null(),
+ ])
+ .default(
+ experimentsPartialUpdateBodyMetricsOneItemCompletionEventOnePropertiesOneItemOperatorDefault
+ ),
+ type: zod
+ .literal('event')
+ .default(
+ experimentsPartialUpdateBodyMetricsOneItemCompletionEventOnePropertiesOneItemTypeDefault
+ )
+ .describe('Event properties'),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ ])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ })
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe('Event property filters to narrow which events are counted.'),
+ }),
+ zod.null(),
+ ])
+ .optional()
+ .describe('For retention metrics: completion event.'),
+ conversion_window: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe('Conversion window duration.'),
+ denominator: zod
+ .union([
+ zod.object({
+ event: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
+ id: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe('Action ID. Required for ActionsNode.'),
+ kind: zod.enum(['EventsNode', 'ActionsNode']),
+ math: zod
+ .union([
+ zod.enum([
+ 'total',
+ 'sum',
+ 'unique_session',
+ 'min',
+ 'max',
+ 'avg',
+ 'dau',
+ 'unique_group',
+ 'hogql',
+ ]),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
+ ),
+ math_group_type_index: zod
+ .union([
+ zod.union([
+ zod.literal(0),
+ zod.literal(1),
+ zod.literal(2),
+ zod.literal(3),
+ zod.literal(4),
+ ]),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "Group type index to aggregate over. Required when math is 'unique_group'."
+ ),
+ math_hogql: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
+ ),
+ math_property: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
+ ),
+ properties: zod
+ .union([
+ zod.array(
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod
+ .union([
+ zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ zod.null(),
+ ])
+ .default(
+ experimentsPartialUpdateBodyMetricsOneItemDenominatorOnePropertiesOneItemOperatorDefault
+ ),
+ type: zod
+ .literal('event')
+ .default(
+ experimentsPartialUpdateBodyMetricsOneItemDenominatorOnePropertiesOneItemTypeDefault
+ )
+ .describe('Event properties'),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ ])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ })
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe('Event property filters to narrow which events are counted.'),
+ }),
+ zod.null(),
+ ])
+ .optional()
+ .describe('For ratio metrics: denominator source.'),
+ denominator_outlier_handling: zod
+ .union([
+ zod.object({
+ ignore_zeros: zod.union([zod.boolean(), zod.null()]).optional(),
+ lower_bound_percentile: zod
+ .union([
+ zod
+ .number()
+ .min(
+ experimentsPartialUpdateBodyMetricsOneItemDenominatorOutlierHandlingOneLowerBoundPercentileOneMin
+ )
+ .max(
+ experimentsPartialUpdateBodyMetricsOneItemDenominatorOutlierHandlingOneLowerBoundPercentileOneMax
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ 'Winsorization lower percentile bound, as a fraction in [0, 1] (e.g. 0.01 for the 1st percentile).'
+ ),
+ upper_bound_percentile: zod
+ .union([
+ zod
+ .number()
+ .min(
+ experimentsPartialUpdateBodyMetricsOneItemDenominatorOutlierHandlingOneUpperBoundPercentileOneMin
+ )
+ .max(
+ experimentsPartialUpdateBodyMetricsOneItemDenominatorOutlierHandlingOneUpperBoundPercentileOneMax
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ 'Winsorization upper percentile bound, as a fraction in [0, 1] (e.g. 0.99 for the 99th percentile).'
+ ),
+ }),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ 'For ratio metrics: winsorization applied to the denominator aggregate. Leave unset for a binomial-style denominator, which is never clamped.'
+ ),
+ goal: zod
+ .union([zod.enum(['increase', 'decrease']), zod.null()])
+ .optional()
+ .describe('Whether higher or lower values indicate success.'),
+ ignore_zeros: zod
+ .union([zod.boolean(), zod.null()])
+ .optional()
+ .describe(
+ 'For mean metrics: exclude zero values when computing the winsorization percentile thresholds.'
+ ),
+ kind: zod
+ .literal('ExperimentMetric')
+ .default(experimentsPartialUpdateBodyMetricsOneItemKindDefault),
+ lower_bound_percentile: zod
+ .union([
+ zod
+ .number()
+ .min(experimentsPartialUpdateBodyMetricsOneItemLowerBoundPercentileOneMin)
+ .max(experimentsPartialUpdateBodyMetricsOneItemLowerBoundPercentileOneMax),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ 'For mean metrics: winsorization lower percentile bound, as a fraction in [0, 1] (e.g. 0.01 for the 1st percentile). Per-user values below this percentile are clamped to it before aggregation.'
+ ),
+ metric_type: zod.enum(['funnel', 'mean', 'ratio', 'retention']),
+ name: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe('Human-readable metric name.'),
+ numerator: zod
+ .union([
+ zod.object({
+ event: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
+ id: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe('Action ID. Required for ActionsNode.'),
+ kind: zod.enum(['EventsNode', 'ActionsNode']),
+ math: zod
+ .union([
+ zod.enum([
+ 'total',
+ 'sum',
+ 'unique_session',
+ 'min',
+ 'max',
+ 'avg',
+ 'dau',
+ 'unique_group',
+ 'hogql',
+ ]),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
+ ),
+ math_group_type_index: zod
+ .union([
+ zod.union([
+ zod.literal(0),
+ zod.literal(1),
+ zod.literal(2),
+ zod.literal(3),
+ zod.literal(4),
+ ]),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "Group type index to aggregate over. Required when math is 'unique_group'."
+ ),
+ math_hogql: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
+ ),
+ math_property: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
+ ),
+ properties: zod
+ .union([
+ zod.array(
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod
+ .union([
+ zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ zod.null(),
+ ])
+ .default(
+ experimentsPartialUpdateBodyMetricsOneItemNumeratorOnePropertiesOneItemOperatorDefault
+ ),
+ type: zod
+ .literal('event')
+ .default(
+ experimentsPartialUpdateBodyMetricsOneItemNumeratorOnePropertiesOneItemTypeDefault
+ )
+ .describe('Event properties'),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ ])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ })
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe('Event property filters to narrow which events are counted.'),
+ }),
+ zod.null(),
+ ])
+ .optional()
+ .describe('For ratio metrics: numerator source.'),
+ numerator_outlier_handling: zod
+ .union([
+ zod.object({
+ ignore_zeros: zod.union([zod.boolean(), zod.null()]).optional(),
+ lower_bound_percentile: zod
+ .union([
+ zod
+ .number()
+ .min(
+ experimentsPartialUpdateBodyMetricsOneItemNumeratorOutlierHandlingOneLowerBoundPercentileOneMin
+ )
+ .max(
+ experimentsPartialUpdateBodyMetricsOneItemNumeratorOutlierHandlingOneLowerBoundPercentileOneMax
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ 'Winsorization lower percentile bound, as a fraction in [0, 1] (e.g. 0.01 for the 1st percentile).'
+ ),
+ upper_bound_percentile: zod
+ .union([
+ zod
+ .number()
+ .min(
+ experimentsPartialUpdateBodyMetricsOneItemNumeratorOutlierHandlingOneUpperBoundPercentileOneMin
+ )
+ .max(
+ experimentsPartialUpdateBodyMetricsOneItemNumeratorOutlierHandlingOneUpperBoundPercentileOneMax
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ 'Winsorization upper percentile bound, as a fraction in [0, 1] (e.g. 0.99 for the 99th percentile).'
+ ),
+ }),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ 'For ratio metrics: winsorization applied to the numerator aggregate, independently of the denominator and each with its own percentile thresholds.'
+ ),
+ retention_window_end: zod.union([zod.number(), zod.null()]).optional(),
+ retention_window_start: zod.union([zod.number(), zod.null()]).optional(),
+ retention_window_unit: zod
+ .union([zod.enum(['second', 'minute', 'hour', 'day', 'week', 'month']), zod.null()])
+ .optional(),
+ series: zod
+ .union([
+ zod.array(
+ zod.object({
+ event: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
+ id: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe('Action ID. Required for ActionsNode.'),
+ kind: zod.enum(['EventsNode', 'ActionsNode']),
+ math: zod
+ .union([
+ zod.enum([
+ 'total',
+ 'sum',
+ 'unique_session',
+ 'min',
+ 'max',
+ 'avg',
+ 'dau',
+ 'unique_group',
+ 'hogql',
+ ]),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
+ ),
+ math_group_type_index: zod
+ .union([
+ zod.union([
+ zod.literal(0),
+ zod.literal(1),
+ zod.literal(2),
+ zod.literal(3),
+ zod.literal(4),
+ ]),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "Group type index to aggregate over. Required when math is 'unique_group'."
+ ),
+ math_hogql: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
+ ),
+ math_property: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
+ ),
+ properties: zod
+ .union([
+ zod.array(
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod
+ .union([
+ zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ zod.null(),
+ ])
+ .default(
+ experimentsPartialUpdateBodyMetricsOneItemSeriesOneItemPropertiesOneItemOperatorDefault
+ ),
+ type: zod
+ .literal('event')
+ .default(
+ experimentsPartialUpdateBodyMetricsOneItemSeriesOneItemPropertiesOneItemTypeDefault
+ )
+ .describe('Event properties'),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ ])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ })
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe('Event property filters to narrow which events are counted.'),
+ })
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe('For funnel metrics: array of EventsNode\/ActionsNode steps.'),
+ source: zod
+ .union([
+ zod.object({
+ event: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
+ id: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe('Action ID. Required for ActionsNode.'),
+ kind: zod.enum(['EventsNode', 'ActionsNode']),
+ math: zod
+ .union([
+ zod.enum([
+ 'total',
+ 'sum',
+ 'unique_session',
+ 'min',
+ 'max',
+ 'avg',
+ 'dau',
+ 'unique_group',
+ 'hogql',
+ ]),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
+ ),
+ math_group_type_index: zod
+ .union([
+ zod.union([
+ zod.literal(0),
+ zod.literal(1),
+ zod.literal(2),
+ zod.literal(3),
+ zod.literal(4),
+ ]),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "Group type index to aggregate over. Required when math is 'unique_group'."
+ ),
+ math_hogql: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
+ ),
+ math_property: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
+ ),
+ properties: zod
+ .union([
+ zod.array(
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod
+ .union([
+ zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ zod.null(),
+ ])
+ .default(
+ experimentsPartialUpdateBodyMetricsOneItemSourceOnePropertiesOneItemOperatorDefault
+ ),
+ type: zod
+ .literal('event')
+ .default(
+ experimentsPartialUpdateBodyMetricsOneItemSourceOnePropertiesOneItemTypeDefault
+ )
+ .describe('Event properties'),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ ])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ })
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe('Event property filters to narrow which events are counted.'),
+ }),
+ zod.null(),
+ ])
+ .optional()
+ .describe('For mean metrics: event source.'),
+ start_event: zod
+ .union([
+ zod.object({
+ event: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
+ id: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe('Action ID. Required for ActionsNode.'),
+ kind: zod.enum(['EventsNode', 'ActionsNode']),
+ math: zod
+ .union([
+ zod.enum([
+ 'total',
+ 'sum',
+ 'unique_session',
+ 'min',
+ 'max',
+ 'avg',
+ 'dau',
+ 'unique_group',
+ 'hogql',
+ ]),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
+ ),
+ math_group_type_index: zod
+ .union([
+ zod.union([
+ zod.literal(0),
+ zod.literal(1),
+ zod.literal(2),
+ zod.literal(3),
+ zod.literal(4),
+ ]),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "Group type index to aggregate over. Required when math is 'unique_group'."
+ ),
+ math_hogql: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
+ ),
+ math_property: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
+ ),
+ properties: zod
+ .union([
+ zod.array(
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod
+ .union([
+ zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ zod.null(),
+ ])
+ .default(
+ experimentsPartialUpdateBodyMetricsOneItemStartEventOnePropertiesOneItemOperatorDefault
+ ),
+ type: zod
+ .literal('event')
+ .default(
+ experimentsPartialUpdateBodyMetricsOneItemStartEventOnePropertiesOneItemTypeDefault
+ )
+ .describe('Event properties'),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ ])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ })
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe('Event property filters to narrow which events are counted.'),
+ }),
+ zod.null(),
+ ])
+ .optional()
+ .describe('For retention metrics: start event.'),
+ start_handling: zod.union([zod.enum(['first_seen', 'last_seen']), zod.null()]).optional(),
+ threshold: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe(
+ 'For mean metrics: when set, reports the percentage of users whose per-user summed\/counted value reaches or exceeds this threshold. Only meaningful for sum\/count math types.'
+ ),
+ upper_bound_percentile: zod
+ .union([
+ zod
+ .number()
+ .min(experimentsPartialUpdateBodyMetricsOneItemUpperBoundPercentileOneMin)
+ .max(experimentsPartialUpdateBodyMetricsOneItemUpperBoundPercentileOneMax),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ 'For mean metrics: winsorization upper percentile bound, as a fraction in [0, 1] (e.g. 0.99 for the 99th percentile). Per-user values above this percentile are clamped to it before aggregation.'
+ ),
+ uuid: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe('Unique identifier. Auto-generated if omitted.'),
+ })
+ )
+ .describe('List wrapper for OpenAPI schema generation — the field stores an array of metrics.'),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "Primary experiment metrics. Each metric must have kind='ExperimentMetric' and a metric_type: 'mean' (set source to an EventsNode with an event name), 'funnel' (set series to an array of EventsNode steps), 'ratio' (set numerator and denominator EventsNode entries), or 'retention' (set start_event and completion_event). Use the read-data-schema tool with query kind 'events' to find available events in the project."
+ ),
+ metrics_secondary: zod
+ .union([
+ zod
+ .array(
+ zod.object({
+ completion_event: zod
+ .union([
+ zod.object({
+ event: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
+ id: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe('Action ID. Required for ActionsNode.'),
+ kind: zod.enum(['EventsNode', 'ActionsNode']),
+ math: zod
+ .union([
+ zod.enum([
+ 'total',
+ 'sum',
+ 'unique_session',
+ 'min',
+ 'max',
+ 'avg',
+ 'dau',
+ 'unique_group',
+ 'hogql',
+ ]),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
+ ),
+ math_group_type_index: zod
+ .union([
+ zod.union([
+ zod.literal(0),
+ zod.literal(1),
+ zod.literal(2),
+ zod.literal(3),
+ zod.literal(4),
+ ]),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "Group type index to aggregate over. Required when math is 'unique_group'."
+ ),
+ math_hogql: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
+ ),
+ math_property: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
+ ),
+ properties: zod
+ .union([
+ zod.array(
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod
+ .union([
+ zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ zod.null(),
+ ])
+ .default(
+ experimentsPartialUpdateBodyMetricsSecondaryOneItemCompletionEventOnePropertiesOneItemOperatorDefault
+ ),
+ type: zod
+ .literal('event')
+ .default(
+ experimentsPartialUpdateBodyMetricsSecondaryOneItemCompletionEventOnePropertiesOneItemTypeDefault
+ )
+ .describe('Event properties'),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ ])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ })
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe('Event property filters to narrow which events are counted.'),
+ }),
+ zod.null(),
+ ])
+ .optional()
+ .describe('For retention metrics: completion event.'),
+ conversion_window: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe('Conversion window duration.'),
+ denominator: zod
+ .union([
+ zod.object({
+ event: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
+ id: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe('Action ID. Required for ActionsNode.'),
+ kind: zod.enum(['EventsNode', 'ActionsNode']),
+ math: zod
+ .union([
+ zod.enum([
+ 'total',
+ 'sum',
+ 'unique_session',
+ 'min',
+ 'max',
+ 'avg',
+ 'dau',
+ 'unique_group',
+ 'hogql',
+ ]),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
+ ),
+ math_group_type_index: zod
+ .union([
+ zod.union([
+ zod.literal(0),
+ zod.literal(1),
+ zod.literal(2),
+ zod.literal(3),
+ zod.literal(4),
+ ]),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "Group type index to aggregate over. Required when math is 'unique_group'."
+ ),
+ math_hogql: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
+ ),
+ math_property: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
+ ),
+ properties: zod
+ .union([
+ zod.array(
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod
+ .union([
+ zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ zod.null(),
+ ])
+ .default(
+ experimentsPartialUpdateBodyMetricsSecondaryOneItemDenominatorOnePropertiesOneItemOperatorDefault
+ ),
+ type: zod
+ .literal('event')
+ .default(
+ experimentsPartialUpdateBodyMetricsSecondaryOneItemDenominatorOnePropertiesOneItemTypeDefault
+ )
+ .describe('Event properties'),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ ])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ })
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe('Event property filters to narrow which events are counted.'),
+ }),
+ zod.null(),
+ ])
+ .optional()
+ .describe('For ratio metrics: denominator source.'),
+ denominator_outlier_handling: zod
+ .union([
+ zod.object({
+ ignore_zeros: zod.union([zod.boolean(), zod.null()]).optional(),
+ lower_bound_percentile: zod
+ .union([
+ zod
+ .number()
+ .min(
+ experimentsPartialUpdateBodyMetricsSecondaryOneItemDenominatorOutlierHandlingOneLowerBoundPercentileOneMin
+ )
+ .max(
+ experimentsPartialUpdateBodyMetricsSecondaryOneItemDenominatorOutlierHandlingOneLowerBoundPercentileOneMax
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ 'Winsorization lower percentile bound, as a fraction in [0, 1] (e.g. 0.01 for the 1st percentile).'
+ ),
+ upper_bound_percentile: zod
+ .union([
+ zod
+ .number()
+ .min(
+ experimentsPartialUpdateBodyMetricsSecondaryOneItemDenominatorOutlierHandlingOneUpperBoundPercentileOneMin
+ )
+ .max(
+ experimentsPartialUpdateBodyMetricsSecondaryOneItemDenominatorOutlierHandlingOneUpperBoundPercentileOneMax
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ 'Winsorization upper percentile bound, as a fraction in [0, 1] (e.g. 0.99 for the 99th percentile).'
+ ),
+ }),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ 'For ratio metrics: winsorization applied to the denominator aggregate. Leave unset for a binomial-style denominator, which is never clamped.'
+ ),
+ goal: zod
+ .union([zod.enum(['increase', 'decrease']), zod.null()])
+ .optional()
+ .describe('Whether higher or lower values indicate success.'),
+ ignore_zeros: zod
+ .union([zod.boolean(), zod.null()])
+ .optional()
+ .describe(
+ 'For mean metrics: exclude zero values when computing the winsorization percentile thresholds.'
+ ),
+ kind: zod
+ .literal('ExperimentMetric')
+ .default(experimentsPartialUpdateBodyMetricsSecondaryOneItemKindDefault),
+ lower_bound_percentile: zod
+ .union([
+ zod
+ .number()
+ .min(
+ experimentsPartialUpdateBodyMetricsSecondaryOneItemLowerBoundPercentileOneMin
+ )
+ .max(
+ experimentsPartialUpdateBodyMetricsSecondaryOneItemLowerBoundPercentileOneMax
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ 'For mean metrics: winsorization lower percentile bound, as a fraction in [0, 1] (e.g. 0.01 for the 1st percentile). Per-user values below this percentile are clamped to it before aggregation.'
+ ),
+ metric_type: zod.enum(['funnel', 'mean', 'ratio', 'retention']),
+ name: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe('Human-readable metric name.'),
+ numerator: zod
+ .union([
+ zod.object({
+ event: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe("Event name, e.g. '$pageview'. Required for EventsNode."),
+ id: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe('Action ID. Required for ActionsNode.'),
+ kind: zod.enum(['EventsNode', 'ActionsNode']),
+ math: zod
+ .union([
+ zod.enum([
+ 'total',
+ 'sum',
+ 'unique_session',
+ 'min',
+ 'max',
+ 'avg',
+ 'dau',
+ 'unique_group',
+ 'hogql',
+ ]),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "How to aggregate this source. Defaults to 'total' (event count). Use 'sum' together with math_property to aggregate a numeric property — e.g. a ratio numerator of revenue per order. Other options: 'avg', 'min', 'max', 'unique_session', 'dau', 'unique_group', 'hogql'."
+ ),
+ math_group_type_index: zod
+ .union([
+ zod.union([
+ zod.literal(0),
+ zod.literal(1),
+ zod.literal(2),
+ zod.literal(3),
+ zod.literal(4),
+ ]),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "Group type index to aggregate over. Required when math is 'unique_group'."
+ ),
+ math_hogql: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "HogQL aggregation expression. Required when math is 'hogql' — without it the metric silently falls back to a plain count\/sum."
+ ),
+ math_property: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "Numeric event property to aggregate when math is 'sum', 'avg', 'min', or 'max' (e.g. 'revenue')."
+ ),
+ properties: zod
+ .union([
+ zod.array(
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod
+ .union([
+ zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
'ends_with',
'not_ends_with',
'regex',
@@ -8367,6 +11015,31 @@ export const experimentsDuplicateCreateBodyNameMax = 400
export const experimentsDuplicateCreateBodyDescriptionMax = 3000
export const experimentsDuplicateCreateBodyArchivedDefault = false
+export const experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOneOperatorDefault = `exact`
+export const experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOneTypeDefault = `event`
+export const experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemTwoTypeDefault = `person`
+export const experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemThreeTypeDefault = `person_metadata`
+export const experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemFourTypeDefault = `element`
+export const experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemFiveTypeDefault = `event_metadata`
+export const experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemSixTypeDefault = `session`
+export const experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemSevenKeyDefault = `id`
+export const experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemSevenOperatorDefault = `in`
+export const experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemSevenTypeDefault = `cohort`
+export const experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemEightTypeDefault = `recording`
+export const experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemNineTypeDefault = `log_entry`
+export const experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnezeroTypeDefault = `group`
+export const experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOneoneTypeDefault = `feature`
+export const experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnetwoOperatorDefault = `flag_evaluates_to`
+export const experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnetwoTypeDefault = `flag`
+export const experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnethreeTypeDefault = `hogql`
+export const experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnefourTypeDefault = `empty`
+export const experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnefiveTypeDefault = `data_warehouse`
+export const experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnesixTypeDefault = `data_warehouse_person_property`
+export const experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnesevenTypeDefault = `error_tracking_issue`
+export const experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnenineTypeDefault = `metric_attribute`
+export const experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemTwooneTypeDefault = `revenue_analytics`
+export const experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemTwotwoTypeDefault = `account_custom_property`
+export const experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemTwothreeTypeDefault = `workflow_variable`
export const experimentsDuplicateCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOneOperatorDefault = `exact`
export const experimentsDuplicateCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemOneTypeDefault = `event`
export const experimentsDuplicateCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwoTypeDefault = `person`
@@ -8526,64 +11199,1363 @@ export const ExperimentsDuplicateCreateBody = /* @__PURE__ */ zod
.union([zod.enum(['funnel', 'mean_count', 'mean_sum_or_avg']), zod.null()])
.optional()
.describe(
- 'Metric type the manual baseline value refers to. Only used in manual mode.'
+ 'Metric type the manual baseline value refers to. Only used in manual mode.'
+ ),
+ }),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ 'How the exposure estimate is configured: manual user-entered values or automatic from live experiment data.'
+ ),
+ minimum_detectable_effect: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe(
+ 'Minimum detectable effect as a percentage. Lower values need more users but catch smaller changes.'
+ ),
+ recommended_running_time: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe('Estimated number of days needed to reach the recommended sample size.'),
+ recommended_sample_size: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe('Recommended number of exposed users needed for statistical significance.'),
+ }),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ 'Running-time calculator state: `minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, and `exposure_estimate_config`. Canonical home for these keys, which historically lived in `parameters`.'
+ ),
+ excluded_variants: zod
+ .array(zod.string())
+ .nullish()
+ .describe(
+ 'Variant keys to exclude from metric result calculations. Excluded variants are still served to users but omitted from statistical analysis. The baseline variant and holdout pseudo-variants cannot be excluded. Canonical home for what historically lived in `parameters.excluded_variants`.'
+ ),
+ secondary_metrics: zod.unknown().optional(),
+ saved_metrics_ids: zod
+ .array(zod.unknown())
+ .nullish()
+ .describe(
+ "IDs of shared saved metrics to attach to this experiment. Each item has 'id' (saved metric ID) and 'metadata' with 'type' (primary or secondary)."
+ ),
+ filters: zod.unknown().optional(),
+ archived: zod
+ .boolean()
+ .default(experimentsDuplicateCreateBodyArchivedDefault)
+ .describe('Whether the experiment is archived.'),
+ deleted: zod.boolean().nullish(),
+ type: zod
+ .union([zod.enum(['web', 'product']).describe('\* `web` - web\n\* `product` - product'), zod.null()])
+ .optional()
+ .describe(
+ 'Experiment type: web for frontend UI changes, product for backend\/API changes.\n\n\* `web` - web\n\* `product` - product'
+ ),
+ exposure_criteria: zod
+ .union([
+ zod.object({
+ activation_config: zod
+ .union([
+ zod.object({
+ event: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "Custom exposure event name. Required when kind is 'ExperimentEventExposureConfig'."
+ ),
+ id: zod
+ .union([zod.number(), zod.null()])
+ .optional()
+ .describe("Action ID. Required when kind is 'ActionsNode'."),
+ kind: zod
+ .union([zod.enum(['ExperimentEventExposureConfig', 'ActionsNode']), zod.null()])
+ .optional()
+ .describe(
+ "Defaults to 'ExperimentEventExposureConfig' when omitted. Pass 'ActionsNode' for an action-based exposure."
+ ),
+ properties: zod
+ .array(
+ zod.union([
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod
+ .union([
+ zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ zod.null(),
+ ])
+ .default(
+ experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOneOperatorDefault
+ ),
+ type: zod
+ .literal('event')
+ .default(
+ experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOneTypeDefault
+ )
+ .describe('Event properties'),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('person')
+ .default(
+ experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemTwoTypeDefault
+ )
+ .describe('Person properties'),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('person_metadata')
+ .default(
+ experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemThreeTypeDefault
+ )
+ .describe(
+ 'Top-level columns on the persons table (e.g. created_at), not properties JSON'
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.enum(['tag_name', 'text', 'href', 'selector']),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('element')
+ .default(
+ experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemFourTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('event_metadata')
+ .default(
+ experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemFiveTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('session')
+ .default(
+ experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemSixTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ cohort_name: zod.union([zod.string(), zod.null()]).optional(),
+ key: zod
+ .literal('id')
+ .default(
+ experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemSevenKeyDefault
+ ),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod
+ .union([
+ zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ zod.null(),
+ ])
+ .default(
+ experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemSevenOperatorDefault
+ ),
+ type: zod
+ .literal('cohort')
+ .default(
+ experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemSevenTypeDefault
+ ),
+ value: zod.number(),
+ }),
+ zod.object({
+ key: zod.union([
+ zod.enum(['duration', 'active_seconds', 'inactive_seconds']),
+ zod.string(),
+ ]),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('recording')
+ .default(
+ experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemEightTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('log_entry')
+ .default(
+ experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemNineTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ group_key_names: zod
+ .union([zod.record(zod.string(), zod.string()), zod.null()])
+ .optional(),
+ group_type_index: zod.union([zod.number(), zod.null()]).optional(),
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('group')
+ .default(
+ experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnezeroTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('feature')
+ .default(
+ experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOneoneTypeDefault
+ )
+ .describe('Event property with \"$feature\/\" prepended'),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string().describe('The key should be the flag ID'),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod
+ .literal('flag_evaluates_to')
+ .default(
+ experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnetwoOperatorDefault
+ )
+ .describe(
+ 'Only flag_evaluates_to operator is allowed for flag dependencies'
+ ),
+ type: zod
+ .literal('flag')
+ .default(
+ experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnetwoTypeDefault
+ )
+ .describe('Feature flag dependency'),
+ value: zod
+ .union([zod.boolean(), zod.string()])
+ .describe('The value can be true, false, or a variant name'),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ type: zod
+ .literal('hogql')
+ .default(
+ experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnethreeTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ type: zod
+ .literal('empty')
+ .default(
+ experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnefourTypeDefault
+ ),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('data_warehouse')
+ .default(
+ experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnefiveTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('data_warehouse_person_property')
+ .default(
+ experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnesixTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('error_tracking_issue')
+ .default(
+ experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnesevenTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod.enum(['log', 'log_attribute', 'log_resource_attribute']),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('metric_attribute')
+ .default(
+ experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemOnenineTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod.enum(['span', 'span_attribute', 'span_resource_attribute']),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('revenue_analytics')
+ .default(
+ experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemTwooneTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('account_custom_property')
+ .default(
+ experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemTwotwoTypeDefault
+ )
+ .describe(
+ 'Customer analytics account custom property — the key is the property definition id'
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.object({
+ key: zod.string(),
+ label: zod.union([zod.string(), zod.null()]).optional(),
+ operator: zod.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+ ]),
+ type: zod
+ .literal('workflow_variable')
+ .default(
+ experimentsDuplicateCreateBodyExposureCriteriaOneActivationConfigOnePropertiesItemTwothreeTypeDefault
+ ),
+ value: zod
+ .union([
+ zod.array(
+ zod.union([zod.string(), zod.number(), zod.boolean()])
+ ),
+ zod.string(),
+ zod.number(),
+ zod.boolean(),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ ])
+ )
+ .describe(
+ 'Property filters (event, person, and other supported types). Pass an empty array if no filters needed.'
),
}),
zod.null(),
])
.optional()
.describe(
- 'How the exposure estimate is configured: manual user-entered values or automatic from live experiment data.'
- ),
- minimum_detectable_effect: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe(
- 'Minimum detectable effect as a percentage. Lower values need more users but catch smaller changes.'
+ "Additional event (or action) an entity must emit at\/after their first default exposure event before they count as exposed; exposure time becomes this event's timestamp. Only valid with the default exposure event, not a custom `exposure_config`."
),
- recommended_running_time: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe('Estimated number of days needed to reach the recommended sample size.'),
- recommended_sample_size: zod
- .union([zod.number(), zod.null()])
- .optional()
- .describe('Recommended number of exposed users needed for statistical significance.'),
- }),
- zod.null(),
- ])
- .optional()
- .describe(
- 'Running-time calculator state: `minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, and `exposure_estimate_config`. Canonical home for these keys, which historically lived in `parameters`.'
- ),
- excluded_variants: zod
- .array(zod.string())
- .nullish()
- .describe(
- 'Variant keys to exclude from metric result calculations. Excluded variants are still served to users but omitted from statistical analysis. The baseline variant and holdout pseudo-variants cannot be excluded. Canonical home for what historically lived in `parameters.excluded_variants`.'
- ),
- secondary_metrics: zod.unknown().optional(),
- saved_metrics_ids: zod
- .array(zod.unknown())
- .nullish()
- .describe(
- "IDs of shared saved metrics to attach to this experiment. Each item has 'id' (saved metric ID) and 'metadata' with 'type' (primary or secondary)."
- ),
- filters: zod.unknown().optional(),
- archived: zod
- .boolean()
- .default(experimentsDuplicateCreateBodyArchivedDefault)
- .describe('Whether the experiment is archived.'),
- deleted: zod.boolean().nullish(),
- type: zod
- .union([zod.enum(['web', 'product']).describe('\* `web` - web\n\* `product` - product'), zod.null()])
- .optional()
- .describe(
- 'Experiment type: web for frontend UI changes, product for backend\/API changes.\n\n\* `web` - web\n\* `product` - product'
- ),
- exposure_criteria: zod
- .union([
- zod.object({
exposure_config: zod
.union([
zod.object({
diff --git a/services/mcp/src/schema/experiments.ts b/services/mcp/src/schema/experiments.ts
index 73ce9173f027..473e4af09b30 100644
--- a/services/mcp/src/schema/experiments.ts
+++ b/services/mcp/src/schema/experiments.ts
@@ -58,6 +58,9 @@ const ExperimentExposureConfigSchema = z.union([
const ExperimentExposureCriteriaSchema = z.object({
filterTestAccounts: z.boolean().optional(),
exposure_config: ExperimentExposureConfigSchema.optional(),
+ // Zod 4 z.object strips unknown keys on parse, and getExposures round-trips the stored
+ // criteria through this schema, so omitting a field here silently degrades the query.
+ activation_config: ExperimentExposureConfigSchema.optional(),
multiple_variant_handling: z.enum(['exclude', 'first_seen']).optional(),
})
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-create.json
index 8293f91deeab..89b935772271 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-create.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-create.json
@@ -22,6 +22,2200 @@
"anyOf": [
{
"properties": {
+ "activation_config": {
+ "anyOf": [
+ {
+ "properties": {
+ "event": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Custom exposure event name. Required when kind is 'ExperimentEventExposureConfig'."
+ },
+ "id": {
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Action ID. Required when kind is 'ActionsNode'."
+ },
+ "kind": {
+ "anyOf": [
+ {
+ "enum": ["ExperimentEventExposureConfig", "ActionsNode"],
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Defaults to 'ExperimentEventExposureConfig' when omitted. Pass 'ActionsNode' for an action-based exposure."
+ },
+ "properties": {
+ "description": "Property filters (event, person, and other supported types). Pass an empty array if no filters needed.",
+ "items": {
+ "anyOf": [
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "anyOf": [
+ {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": "exact"
+ },
+ "type": {
+ "const": "event",
+ "default": "event",
+ "description": "Event properties",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "person",
+ "default": "person",
+ "description": "Person properties",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "person_metadata",
+ "default": "person_metadata",
+ "description": "Top-level columns on the persons table (e.g. created_at), not properties JSON",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "enum": ["tag_name", "text", "href", "selector"],
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "element",
+ "default": "element",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "event_metadata",
+ "default": "event_metadata",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "session",
+ "default": "session",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "cohort_name": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "key": {
+ "const": "id",
+ "default": "id",
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "anyOf": [
+ {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": "in"
+ },
+ "type": {
+ "const": "cohort",
+ "default": "cohort",
+ "type": "string"
+ },
+ "value": {
+ "type": "number"
+ }
+ },
+ "required": ["value"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "anyOf": [
+ {
+ "enum": [
+ "duration",
+ "active_seconds",
+ "inactive_seconds"
+ ],
+ "type": "string"
+ },
+ {
+ "type": "string"
+ }
+ ]
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "recording",
+ "default": "recording",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "log_entry",
+ "default": "log_entry",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "group_key_names": {
+ "anyOf": [
+ {
+ "additionalProperties": {
+ "type": "string"
+ },
+ "propertyNames": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "group_type_index": {
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "group",
+ "default": "group",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "feature",
+ "default": "feature",
+ "description": "Event property with \"$feature/\" prepended",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "description": "The key should be the flag ID",
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "const": "flag_evaluates_to",
+ "default": "flag_evaluates_to",
+ "description": "Only flag_evaluates_to operator is allowed for flag dependencies",
+ "type": "string"
+ },
+ "type": {
+ "const": "flag",
+ "default": "flag",
+ "description": "Feature flag dependency",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "string"
+ }
+ ],
+ "description": "The value can be true, false, or a variant name"
+ }
+ },
+ "required": ["key", "value"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "type": {
+ "const": "hogql",
+ "default": "hogql",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "type": {
+ "const": "empty",
+ "default": "empty",
+ "type": "string"
+ }
+ },
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "data_warehouse",
+ "default": "data_warehouse",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "data_warehouse_person_property",
+ "default": "data_warehouse_person_property",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "error_tracking_issue",
+ "default": "error_tracking_issue",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "enum": [
+ "log",
+ "log_attribute",
+ "log_resource_attribute"
+ ],
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator", "type"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "metric_attribute",
+ "default": "metric_attribute",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "enum": [
+ "span",
+ "span_attribute",
+ "span_resource_attribute"
+ ],
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator", "type"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "revenue_analytics",
+ "default": "revenue_analytics",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "account_custom_property",
+ "default": "account_custom_property",
+ "description": "Customer analytics account custom property — the key is the property definition id",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "workflow_variable",
+ "default": "workflow_variable",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ }
+ ]
+ },
+ "type": "array"
+ }
+ },
+ "required": ["properties"],
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Additional event (or action) an entity must emit at/after their first default exposure event before they count as exposed; exposure time becomes this event's timestamp. Only valid with the default exposure event, not a custom `exposure_config`."
+ },
"exposure_config": {
"anyOf": [
{
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-update.json
index 20b79a9fecac..225dfee56c60 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-update.json
@@ -64,6 +64,2200 @@
"anyOf": [
{
"properties": {
+ "activation_config": {
+ "anyOf": [
+ {
+ "properties": {
+ "event": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Custom exposure event name. Required when kind is 'ExperimentEventExposureConfig'."
+ },
+ "id": {
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Action ID. Required when kind is 'ActionsNode'."
+ },
+ "kind": {
+ "anyOf": [
+ {
+ "enum": ["ExperimentEventExposureConfig", "ActionsNode"],
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Defaults to 'ExperimentEventExposureConfig' when omitted. Pass 'ActionsNode' for an action-based exposure."
+ },
+ "properties": {
+ "description": "Property filters (event, person, and other supported types). Pass an empty array if no filters needed.",
+ "items": {
+ "anyOf": [
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "anyOf": [
+ {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": "exact"
+ },
+ "type": {
+ "const": "event",
+ "default": "event",
+ "description": "Event properties",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "person",
+ "default": "person",
+ "description": "Person properties",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "person_metadata",
+ "default": "person_metadata",
+ "description": "Top-level columns on the persons table (e.g. created_at), not properties JSON",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "enum": ["tag_name", "text", "href", "selector"],
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "element",
+ "default": "element",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "event_metadata",
+ "default": "event_metadata",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "session",
+ "default": "session",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "cohort_name": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "key": {
+ "const": "id",
+ "default": "id",
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "anyOf": [
+ {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": "in"
+ },
+ "type": {
+ "const": "cohort",
+ "default": "cohort",
+ "type": "string"
+ },
+ "value": {
+ "type": "number"
+ }
+ },
+ "required": ["value"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "anyOf": [
+ {
+ "enum": [
+ "duration",
+ "active_seconds",
+ "inactive_seconds"
+ ],
+ "type": "string"
+ },
+ {
+ "type": "string"
+ }
+ ]
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "recording",
+ "default": "recording",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "log_entry",
+ "default": "log_entry",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "group_key_names": {
+ "anyOf": [
+ {
+ "additionalProperties": {
+ "type": "string"
+ },
+ "propertyNames": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "group_type_index": {
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "group",
+ "default": "group",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "feature",
+ "default": "feature",
+ "description": "Event property with \"$feature/\" prepended",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "description": "The key should be the flag ID",
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "const": "flag_evaluates_to",
+ "default": "flag_evaluates_to",
+ "description": "Only flag_evaluates_to operator is allowed for flag dependencies",
+ "type": "string"
+ },
+ "type": {
+ "const": "flag",
+ "default": "flag",
+ "description": "Feature flag dependency",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "string"
+ }
+ ],
+ "description": "The value can be true, false, or a variant name"
+ }
+ },
+ "required": ["key", "value"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "type": {
+ "const": "hogql",
+ "default": "hogql",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "type": {
+ "const": "empty",
+ "default": "empty",
+ "type": "string"
+ }
+ },
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "data_warehouse",
+ "default": "data_warehouse",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "data_warehouse_person_property",
+ "default": "data_warehouse_person_property",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "error_tracking_issue",
+ "default": "error_tracking_issue",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "enum": [
+ "log",
+ "log_attribute",
+ "log_resource_attribute"
+ ],
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator", "type"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "metric_attribute",
+ "default": "metric_attribute",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "enum": [
+ "span",
+ "span_attribute",
+ "span_resource_attribute"
+ ],
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator", "type"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "revenue_analytics",
+ "default": "revenue_analytics",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "account_custom_property",
+ "default": "account_custom_property",
+ "description": "Customer analytics account custom property — the key is the property definition id",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "workflow_variable",
+ "default": "workflow_variable",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ }
+ ]
+ },
+ "type": "array"
+ }
+ },
+ "required": ["properties"],
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Additional event (or action) an entity must emit at/after their first default exposure event before they count as exposed; exposure time becomes this event's timestamp. Only valid with the default exposure event, not a custom `exposure_config`."
+ },
"exposure_config": {
"anyOf": [
{
diff --git a/services/mcp/tests/unit/schema.experiments.test.ts b/services/mcp/tests/unit/schema.experiments.test.ts
new file mode 100644
index 000000000000..e3decf842c4e
--- /dev/null
+++ b/services/mcp/tests/unit/schema.experiments.test.ts
@@ -0,0 +1,34 @@
+import { describe, expect, it } from 'vitest'
+
+import { ExperimentExposureQuerySchema } from '@/schema/experiments'
+
+describe('Experiment exposure query schema', () => {
+ // getExposures round-trips the stored exposure_criteria through this hand-written schema,
+ // and Zod 4 z.object strips unknown keys on parse, so a criteria field missing from the
+ // schema silently degrades the query the backend receives.
+ it('keeps every stored exposure_criteria field through a parse round-trip', () => {
+ const exposureCriteria = {
+ filterTestAccounts: true,
+ exposure_config: {
+ kind: 'ExperimentEventExposureConfig',
+ event: '$feature_flag_called',
+ properties: [],
+ },
+ activation_config: {
+ kind: 'ExperimentEventExposureConfig',
+ event: 'activated',
+ properties: [],
+ },
+ multiple_variant_handling: 'exclude',
+ }
+
+ const parsed = ExperimentExposureQuerySchema.parse({
+ kind: 'ExperimentExposureQuery',
+ experiment_id: 1,
+ experiment_name: 'test',
+ exposure_criteria: exposureCriteria,
+ })
+
+ expect(parsed.exposure_criteria).toEqual(exposureCriteria)
+ })
+})