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(web-analytics): add page reports query schema types (#123073)

Jordan Mryyanb0b9d6854d25
diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.json
index 56b796b75b9e..56026bc1c871 100644
--- a/frontend/src/queries/schema.json
+++ b/frontend/src/queries/schema.json
@@ -16791,6 +16791,122 @@
],
"type": "object"
},
+ "CachedWebPageDirectoryQueryResponse": {
+ "additionalProperties": false,
+ "properties": {
+ "cache_key": {
+ "type": "string"
+ },
+ "cache_target_age": {
+ "format": "date-time",
+ "type": "string"
+ },
+ "calculation_trigger": {
+ "description": "What triggered the calculation of the query, leave empty if user/immediate",
+ "type": "string"
+ },
+ "error": {
+ "description": "Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.",
+ "type": "string"
+ },
+ "hasMore": {
+ "type": "boolean"
+ },
+ "hogql": {
+ "description": "Generated HogQL query.",
+ "type": "string"
+ },
+ "is_cached": {
+ "type": "boolean"
+ },
+ "last_refresh": {
+ "format": "date-time",
+ "type": "string"
+ },
+ "limit": {
+ "$ref": "#/definitions/integer"
+ },
+ "modifiers": {
+ "$ref": "#/definitions/HogQLQueryModifiers",
+ "description": "Modifiers used when performing the query"
+ },
+ "next_allowed_client_refresh": {
+ "format": "date-time",
+ "type": "string"
+ },
+ "offset": {
+ "$ref": "#/definitions/integer"
+ },
+ "query_metadata": {
+ "type": "object"
+ },
+ "query_scan": {
+ "$ref": "#/definitions/QueryScanSummary",
+ "description": "The rows and time of the run that produced these results, with its analysis once it is stored."
+ },
+ "query_status": {
+ "$ref": "#/definitions/QueryStatus",
+ "description": "Query status indicates whether next to the provided data, a query is still running."
+ },
+ "resolved_compare_date_range": {
+ "$ref": "#/definitions/ResolvedDateRangeResponse",
+ "description": "The resolved previous/comparison period date range, when comparing against another period"
+ },
+ "resolved_date_range": {
+ "$ref": "#/definitions/ResolvedDateRangeResponse",
+ "description": "The date range used for the query"
+ },
+ "results": {
+ "items": {
+ "$ref": "#/definitions/WebPageDirectoryRow"
+ },
+ "type": "array"
+ },
+ "siteTotals": {
+ "$ref": "#/definitions/WebPageDirectorySiteTotals"
+ },
+ "timezone": {
+ "type": "string"
+ },
+ "timings": {
+ "description": "Measured timings for different parts of the query generation process",
+ "items": {
+ "$ref": "#/definitions/QueryTiming"
+ },
+ "type": "array"
+ },
+ "used_data_warehouse_sources": {
+ "description": "Connector-synced data warehouse sources referenced by this query, if any.",
+ "items": {
+ "$ref": "#/definitions/DataWarehouseSourceUsage"
+ },
+ "type": "array"
+ },
+ "warnings": {
+ "description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. Also carries access control warnings when a system-table query filters out objects the user can't access.",
+ "items": {
+ "anyOf": [
+ {
+ "$ref": "#/definitions/DataWarehouseSyncWarning"
+ },
+ {
+ "$ref": "#/definitions/AccessControlFilterWarning"
+ }
+ ]
+ },
+ "type": "array"
+ }
+ },
+ "required": [
+ "cache_key",
+ "is_cached",
+ "last_refresh",
+ "next_allowed_client_refresh",
+ "results",
+ "timezone"
+ ],
+ "type": "object"
+ },
"CachedWebPageURLSearchQueryResponse": {
"additionalProperties": false,
"properties": {
@@ -39770,6 +39886,7 @@
"WebExternalClicksTableQuery",
"WebBotsTableQuery",
"WebAgentAnalyticsQuery",
+ "WebPageDirectoryQuery",
"WebGoalsQuery",
"WebVitalsQuery",
"WebVitalsPathBreakdownQuery",
@@ -58287,6 +58404,401 @@
"required": ["results"],
"type": "object"
},
+ "WebPageDirectoryMetric": {
+ "enum": [
+ "visitors",
+ "google_search",
+ "ai_referrals",
+ "ai_crawls",
+ "conversions",
+ "time_on_page",
+ "bounce_rate"
+ ],
+ "type": "string"
+ },
+ "WebPageDirectoryMetrics": {
+ "additionalProperties": false,
+ "properties": {
+ "aiCrawlerNames": {
+ "anyOf": [
+ {
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "aiCrawlers": {
+ "anyOf": [
+ {
+ "$ref": "#/definitions/integer"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "aiCrawls": {
+ "$ref": "#/definitions/WebPageDirectoryValue"
+ },
+ "aiReferrals": {
+ "$ref": "#/definitions/WebPageDirectoryValue"
+ },
+ "bounceRate": {
+ "type": ["number", "null"]
+ },
+ "conversions": {
+ "$ref": "#/definitions/WebPageDirectoryValue"
+ },
+ "googleSearch": {
+ "$ref": "#/definitions/WebPageDirectoryValue"
+ },
+ "timeOnPageP90": {
+ "type": ["number", "null"]
+ },
+ "visitors": {
+ "$ref": "#/definitions/WebPageDirectoryValue"
+ }
+ },
+ "type": "object"
+ },
+ "WebPageDirectoryQuery": {
+ "additionalProperties": false,
+ "properties": {
+ "aggregation_group_type_index": {
+ "anyOf": [
+ {
+ "$ref": "#/definitions/integer"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Groups aggregation - not used in Web Analytics but required for type compatibility"
+ },
+ "compareFilter": {
+ "$ref": "#/definitions/CompareFilter"
+ },
+ "conversionGoal": {
+ "anyOf": [
+ {
+ "$ref": "#/definitions/WebAnalyticsConversionGoal"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "dataColorTheme": {
+ "description": "Colors used in the insight's visualization - not used in Web Analytics but required for type compatibility",
+ "type": ["number", "null"]
+ },
+ "dateRange": {
+ "$ref": "#/definitions/DateRange"
+ },
+ "doPathCleaning": {
+ "type": "boolean"
+ },
+ "excludeStaticAssets": {
+ "type": "boolean"
+ },
+ "filterTestAccounts": {
+ "type": "boolean"
+ },
+ "includeRevenue": {
+ "deprecated": "ignored, always treated as disabled",
+ "type": "boolean"
+ },
+ "includeSiteTotals": {
+ "type": "boolean"
+ },
+ "interval": {
+ "$ref": "#/definitions/IntervalType",
+ "description": "Interval for date range calculation (affects date_to rounding for hour vs day ranges)"
+ },
+ "kind": {
+ "const": "WebPageDirectoryQuery",
+ "type": "string"
+ },
+ "limit": {
+ "$ref": "#/definitions/integer"
+ },
+ "metrics": {
+ "items": {
+ "$ref": "#/definitions/WebPageDirectoryMetric"
+ },
+ "type": "array"
+ },
+ "modifiers": {
+ "$ref": "#/definitions/HogQLQueryModifiers",
+ "description": "Modifiers used when performing the query"
+ },
+ "offset": {
+ "$ref": "#/definitions/integer"
+ },
+ "orderBy": {
+ "$ref": "#/definitions/WebAnalyticsOrderBy"
+ },
+ "pageKeys": {
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "properties": {
+ "$ref": "#/definitions/WebAnalyticsPropertyFilters"
+ },
+ "response": {
+ "$ref": "#/definitions/WebPageDirectoryQueryResponse"
+ },
+ "sampling": {
+ "$ref": "#/definitions/WebAnalyticsSampling",
+ "deprecated": "Use samplingFactor instead"
+ },
+ "samplingFactor": {
+ "description": "Sampling rate",
+ "type": ["number", "null"]
+ },
+ "search": {
+ "type": "string"
+ },
+ "sortBy": {
+ "$ref": "#/definitions/WebPageDirectorySortBy"
+ },
+ "sortDirection": {
+ "enum": ["ASC", "DESC"],
+ "type": "string"
+ },
+ "tags": {
+ "$ref": "#/definitions/QueryLogTags"
+ },
+ "useSessionsTable": {
+ "deprecated": "ignored, always treated as enabled *",
+ "type": "boolean"
+ },
+ "version": {
+ "description": "version of the node, used for schema migrations",
+ "type": "number"
+ }
+ },
+ "required": ["kind", "properties"],
+ "type": "object"
+ },
+ "WebPageDirectoryQueryResponse": {
+ "additionalProperties": false,
+ "properties": {
+ "error": {
+ "description": "Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.",
+ "type": "string"
+ },
+ "hasMore": {
+ "type": "boolean"
+ },
+ "hogql": {
+ "description": "Generated HogQL query.",
+ "type": "string"
+ },
+ "limit": {
+ "$ref": "#/definitions/integer"
+ },
+ "modifiers": {
+ "$ref": "#/definitions/HogQLQueryModifiers",
+ "description": "Modifiers used when performing the query"
+ },
+ "offset": {
+ "$ref": "#/definitions/integer"
+ },
+ "query_status": {
+ "$ref": "#/definitions/QueryStatus",
+ "description": "Query status indicates whether next to the provided data, a query is still running."
+ },
+ "resolved_compare_date_range": {
+ "$ref": "#/definitions/ResolvedDateRangeResponse",
+ "description": "The resolved previous/comparison period date range, when comparing against another period"
+ },
+ "resolved_date_range": {
+ "$ref": "#/definitions/ResolvedDateRangeResponse",
+ "description": "The date range used for the query"
+ },
+ "results": {
+ "items": {
+ "$ref": "#/definitions/WebPageDirectoryRow"
+ },
+ "type": "array"
+ },
+ "siteTotals": {
+ "$ref": "#/definitions/WebPageDirectorySiteTotals"
+ },
+ "timings": {
+ "description": "Measured timings for different parts of the query generation process",
+ "items": {
+ "$ref": "#/definitions/QueryTiming"
+ },
+ "type": "array"
+ },
+ "used_data_warehouse_sources": {
+ "description": "Connector-synced data warehouse sources referenced by this query, if any.",
+ "items": {
+ "$ref": "#/definitions/DataWarehouseSourceUsage"
+ },
+ "type": "array"
+ },
+ "warnings": {
+ "description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. Also carries access control warnings when a system-table query filters out objects the user can't access.",
+ "items": {
+ "anyOf": [
+ {
+ "$ref": "#/definitions/DataWarehouseSyncWarning"
+ },
+ {
+ "$ref": "#/definitions/AccessControlFilterWarning"
+ }
+ ]
+ },
+ "type": "array"
+ }
+ },
+ "required": ["results"],
+ "type": "object"
+ },
+ "WebPageDirectoryRow": {
+ "additionalProperties": false,
+ "properties": {
+ "aiCrawlerNames": {
+ "anyOf": [
+ {
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "aiCrawlers": {
+ "anyOf": [
+ {
+ "$ref": "#/definitions/integer"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "aiCrawls": {
+ "$ref": "#/definitions/WebPageDirectoryValue"
+ },
+ "aiReferrals": {
+ "$ref": "#/definitions/WebPageDirectoryValue"
+ },
+ "bounceRate": {
+ "type": ["number", "null"]
+ },
+ "conversions": {
+ "$ref": "#/definitions/WebPageDirectoryValue"
+ },
+ "googleSearch": {
+ "$ref": "#/definitions/WebPageDirectoryValue"
+ },
+ "page": {
+ "type": "string"
+ },
+ "timeOnPageP90": {
+ "type": ["number", "null"]
+ },
+ "visitors": {
+ "$ref": "#/definitions/WebPageDirectoryValue"
+ }
+ },
+ "required": ["page"],
+ "type": "object"
+ },
+ "WebPageDirectorySiteTotals": {
+ "additionalProperties": false,
+ "properties": {
+ "aiCrawlerNames": {
+ "anyOf": [
+ {
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "aiCrawlers": {
+ "anyOf": [
+ {
+ "$ref": "#/definitions/integer"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "aiCrawls": {
+ "$ref": "#/definitions/WebPageDirectoryValue"
+ },
+ "aiReferrals": {
+ "$ref": "#/definitions/WebPageDirectoryValue"
+ },
+ "bounceRate": {
+ "type": ["number", "null"]
+ },
+ "conversions": {
+ "$ref": "#/definitions/WebPageDirectoryValue"
+ },
+ "googleSearch": {
+ "$ref": "#/definitions/WebPageDirectoryValue"
+ },
+ "serverLogs": {
+ "$ref": "#/definitions/integer"
+ },
+ "timeOnPageP90": {
+ "type": ["number", "null"]
+ },
+ "visitors": {
+ "$ref": "#/definitions/WebPageDirectoryValue"
+ }
+ },
+ "required": ["serverLogs"],
+ "type": "object"
+ },
+ "WebPageDirectorySortBy": {
+ "enum": [
+ "page",
+ "visitors",
+ "google_search",
+ "ai_referrals",
+ "ai_crawls",
+ "conversions",
+ "time_on_page",
+ "bounce_rate"
+ ],
+ "type": "string"
+ },
+ "WebPageDirectoryValue": {
+ "additionalProperties": false,
+ "properties": {
+ "current": {
+ "type": "number"
+ },
+ "previous": {
+ "type": ["number", "null"]
+ }
+ },
+ "required": ["current"],
+ "type": "object"
+ },
"WebPageURLSearchQuery": {
"additionalProperties": false,
"properties": {
diff --git a/frontend/src/queries/schema/schema-general.ts b/frontend/src/queries/schema/schema-general.ts
index 37ed2c5a0405..3d28c19cc6e7 100644
--- a/frontend/src/queries/schema/schema-general.ts
+++ b/frontend/src/queries/schema/schema-general.ts
@@ -145,6 +145,7 @@ export enum NodeKind {
WebExternalClicksTableQuery = 'WebExternalClicksTableQuery',
WebBotsTableQuery = 'WebBotsTableQuery',
WebAgentAnalyticsQuery = 'WebAgentAnalyticsQuery',
+ WebPageDirectoryQuery = 'WebPageDirectoryQuery',
WebGoalsQuery = 'WebGoalsQuery',
WebVitalsQuery = 'WebVitalsQuery',
WebVitalsPathBreakdownQuery = 'WebVitalsPathBreakdownQuery',
@@ -4267,6 +4268,74 @@ export interface WebAgentAnalyticsQueryResponse extends AnalyticsQueryResponseBa
}
export type CachedWebAgentAnalyticsQueryResponse = CachedQueryResponse<WebAgentAnalyticsQueryResponse>
+export enum WebPageDirectoryMetric {
+ Visitors = 'visitors',
+ GoogleSearch = 'google_search',
+ AiReferrals = 'ai_referrals',
+ AiCrawls = 'ai_crawls',
+ Conversions = 'conversions',
+ TimeOnPage = 'time_on_page',
+ BounceRate = 'bounce_rate',
+}
+
+export enum WebPageDirectorySortBy {
+ Page = 'page',
+ Visitors = 'visitors',
+ GoogleSearch = 'google_search',
+ AiReferrals = 'ai_referrals',
+ AiCrawls = 'ai_crawls',
+ Conversions = 'conversions',
+ TimeOnPage = 'time_on_page',
+ BounceRate = 'bounce_rate',
+}
+
+export interface WebPageDirectoryQuery extends WebAnalyticsQueryBase<WebPageDirectoryQueryResponse> {
+ kind: NodeKind.WebPageDirectoryQuery
+ search?: string
+ sortBy?: WebPageDirectorySortBy
+ sortDirection?: 'ASC' | 'DESC'
+ metrics?: WebPageDirectoryMetric[]
+ pageKeys?: string[]
+ includeSiteTotals?: boolean
+ excludeStaticAssets?: boolean
+ limit?: integer
+ offset?: integer
+}
+
+export interface WebPageDirectoryValue {
+ current: number
+ previous?: number | null
+}
+
+export interface WebPageDirectoryMetrics {
+ visitors?: WebPageDirectoryValue
+ googleSearch?: WebPageDirectoryValue
+ aiReferrals?: WebPageDirectoryValue
+ aiCrawls?: WebPageDirectoryValue
+ aiCrawlers?: integer | null
+ aiCrawlerNames?: string[] | null
+ conversions?: WebPageDirectoryValue
+ timeOnPageP90?: number | null
+ bounceRate?: number | null
+}
+
+export interface WebPageDirectoryRow extends WebPageDirectoryMetrics {
+ page: string
+}
+
+export interface WebPageDirectorySiteTotals extends WebPageDirectoryMetrics {
+ serverLogs: integer
+}
+
+export interface WebPageDirectoryQueryResponse extends AnalyticsQueryResponseBase {
+ results: WebPageDirectoryRow[]
+ siteTotals?: WebPageDirectorySiteTotals
+ hasMore?: boolean
+ limit?: integer
+ offset?: integer
+}
+export type CachedWebPageDirectoryQueryResponse = CachedQueryResponse<WebPageDirectoryQueryResponse>
+
export interface WebGoalsQuery extends WebAnalyticsQueryBase<WebGoalsQueryResponse> {
kind: NodeKind.WebGoalsQuery
limit?: integer
diff --git a/frontend/src/scenes/saved-insights/insightTypesMetadata.tsx b/frontend/src/scenes/saved-insights/insightTypesMetadata.tsx
index 6d153bf73820..23c3d39677fa 100644
--- a/frontend/src/scenes/saved-insights/insightTypesMetadata.tsx
+++ b/frontend/src/scenes/saved-insights/insightTypesMetadata.tsx
@@ -309,6 +309,12 @@ export const QUERY_TYPES_METADATA: Record<NodeKind, InsightTypeMetadata> = {
icon: IconPieChart,
inMenu: false,
},
+ [NodeKind.WebPageDirectoryQuery]: {
+ name: 'Page directory',
+ description: 'See how each page earns its traffic, from search engines through to AI crawlers.',
+ icon: IconPieChart,
+ inMenu: false,
+ },
[NodeKind.WebVitalsQuery]: {
name: 'Web vitals',
description: 'View web vitals.',
diff --git a/posthog/clickhouse/query_tagging.py b/posthog/clickhouse/query_tagging.py
index 1127e8aa889a..db630bbcec6a 100644
--- a/posthog/clickhouse/query_tagging.py
+++ b/posthog/clickhouse/query_tagging.py
@@ -219,6 +219,7 @@ def kind_fallback_tags(kind: NodeKind) -> FallbackTags | None:
| NodeKind.WEB_EXTERNAL_CLICKS_TABLE_QUERY
| NodeKind.WEB_BOTS_TABLE_QUERY
| NodeKind.WEB_AGENT_ANALYTICS_QUERY
+ | NodeKind.WEB_PAGE_DIRECTORY_QUERY
| NodeKind.WEB_PAGE_URL_SEARCH_QUERY
| NodeKind.WEB_VITALS_QUERY
| NodeKind.WEB_VITALS_PATH_BREAKDOWN_QUERY
diff --git a/posthog/schema.py b/posthog/schema.py
index 8155ffb5f9a0..e855f012d044 100644
--- a/posthog/schema.py
+++ b/posthog/schema.py
@@ -295,6 +295,7 @@ from posthog.schema_enums import (
SnapchatAdsConversionValueFields as SnapchatAdsConversionValueFields,
SnapchatAdsDefaultSources as SnapchatAdsDefaultSources,
SnapshotSource as SnapshotSource,
+ SortDirection as SortDirection,
SourceType as SourceType,
SpanPropertyFilterType as SpanPropertyFilterType,
StartHandling as StartHandling,
@@ -338,6 +339,8 @@ from posthog.schema_enums import (
WebAnalyticsOrderByFields as WebAnalyticsOrderByFields,
WebAnalyticsPreComputeStrategy as WebAnalyticsPreComputeStrategy,
WebBotsBreakdown as WebBotsBreakdown,
+ WebPageDirectoryMetric as WebPageDirectoryMetric,
+ WebPageDirectorySortBy as WebPageDirectorySortBy,
WebsiteBrowsingHistoryProdInterest as WebsiteBrowsingHistoryProdInterest,
WebStatsBreakdown as WebStatsBreakdown,
WebVitalsMetric as WebVitalsMetric,
@@ -3579,6 +3582,14 @@ class WebOverviewItem(BaseModel):
value: float | None = None
+class WebPageDirectoryValue(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ current: float
+ previous: float | None = None
+
+
class WebVitalsPathBreakdownResultItem(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -9829,6 +9840,53 @@ class WebOverviewQueryResponse(BaseModel):
)
+class WebPageDirectoryMetrics(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ aiCrawlerNames: list[str] | None = None
+ aiCrawlers: int | None = None
+ aiCrawls: WebPageDirectoryValue | None = None
+ aiReferrals: WebPageDirectoryValue | None = None
+ bounceRate: float | None = None
+ conversions: WebPageDirectoryValue | None = None
+ googleSearch: WebPageDirectoryValue | None = None
+ timeOnPageP90: float | None = None
+ visitors: WebPageDirectoryValue | None = None
+
+
+class WebPageDirectoryRow(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ aiCrawlerNames: list[str] | None = None
+ aiCrawlers: int | None = None
+ aiCrawls: WebPageDirectoryValue | None = None
+ aiReferrals: WebPageDirectoryValue | None = None
+ bounceRate: float | None = None
+ conversions: WebPageDirectoryValue | None = None
+ googleSearch: WebPageDirectoryValue | None = None
+ page: str
+ timeOnPageP90: float | None = None
+ visitors: WebPageDirectoryValue | None = None
+
+
+class WebPageDirectorySiteTotals(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ aiCrawlerNames: list[str] | None = None
+ aiCrawlers: int | None = None
+ aiCrawls: WebPageDirectoryValue | None = None
+ aiReferrals: WebPageDirectoryValue | None = None
+ bounceRate: float | None = None
+ conversions: WebPageDirectoryValue | None = None
+ googleSearch: WebPageDirectoryValue | None = None
+ serverLogs: int
+ timeOnPageP90: float | None = None
+ visitors: WebPageDirectoryValue | None = None
+
+
class WebPageURLSearchQueryResponse(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -16648,6 +16706,72 @@ class CachedWebOverviewQueryResponse(BaseModel):
)
+class CachedWebPageDirectoryQueryResponse(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ cache_key: str
+ cache_target_age: AwareDatetime | None = None
+ calculation_trigger: str | None = Field(
+ default=None,
+ description=("What triggered the calculation of the query, leave empty if user/immediate"),
+ )
+ error: str | None = Field(
+ default=None,
+ description=(
+ "Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise."
+ ),
+ )
+ hasMore: bool | None = None
+ hogql: str | None = Field(default=None, description="Generated HogQL query.")
+ is_cached: bool
+ last_refresh: AwareDatetime
+ limit: int | None = None
+ modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
+ next_allowed_client_refresh: AwareDatetime
+ offset: int | None = None
+ query_metadata: dict[str, Any] | None = None
+ query_scan: QueryScanSummary | None = Field(
+ default=None,
+ description=("The rows and time of the run that produced these results, with its analysis once it is stored."),
+ )
+ query_status: QueryStatus | None = Field(
+ default=None,
+ description=("Query status indicates whether next to the provided data, a query is still running."),
+ )
+ resolved_compare_date_range: ResolvedDateRangeResponse | None = Field(
+ default=None,
+ description=("The resolved previous/comparison period date range, when comparing against another period"),
+ )
+ resolved_date_range: ResolvedDateRangeResponse | None = Field(
+ default=None, description="The date range used for the query"
+ )
+ results: list[WebPageDirectoryRow]
+ siteTotals: WebPageDirectorySiteTotals | None = None
+ timezone: str
+ timings: list[QueryTiming] | None = Field(
+ default=None,
+ description=("Measured timings for different parts of the query generation process"),
+ )
+ used_data_warehouse_sources: list[DataWarehouseSourceUsage] | None = Field(
+ default=None,
+ description=("Connector-synced data warehouse sources referenced by this query, if any."),
+ )
+ warnings: list[DataWarehouseSyncWarning | AccessControlFilterWarning] | None = Field(
+ default=None,
+ description=(
+ "Warnings about data warehouse sources referenced by the query whose"
+ " latest sync failed, is paused, hit a billing limit, or is otherwise"
+ " stale. Results may not reflect current source data. Accumulated"
+ " across every HogQL execution that contributes to this response — so"
+ " insights backed by warehouse tables (Trends, Funnels, etc.) receive"
+ " the same warnings as raw HogQL queries. Also carries access control"
+ " warnings when a system-table query filters out objects the user can't"
+ " access."
+ ),
+ )
+
+
class CachedWebPageURLSearchQueryResponse(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -26408,6 +26532,57 @@ class WebOverviewQuery(BaseModel):
version: float | None = Field(default=None, description="version of the node, used for schema migrations")
+class WebPageDirectoryQueryResponse(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ error: str | None = Field(
+ default=None,
+ description=(
+ "Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise."
+ ),
+ )
+ hasMore: bool | None = None
+ hogql: str | None = Field(default=None, description="Generated HogQL query.")
+ limit: int | None = None
+ modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
+ offset: int | None = None
+ query_status: QueryStatus | None = Field(
+ default=None,
+ description=("Query status indicates whether next to the provided data, a query is still running."),
+ )
+ resolved_compare_date_range: ResolvedDateRangeResponse | None = Field(
+ default=None,
+ description=("The resolved previous/comparison period date range, when comparing against another period"),
+ )
+ resolved_date_range: ResolvedDateRangeResponse | None = Field(
+ default=None, description="The date range used for the query"
+ )
+ results: list[WebPageDirectoryRow]
+ siteTotals: WebPageDirectorySiteTotals | None = None
+ timings: list[QueryTiming] | None = Field(
+ default=None,
+ description=("Measured timings for different parts of the query generation process"),
+ )
+ used_data_warehouse_sources: list[DataWarehouseSourceUsage] | None = Field(
+ default=None,
+ description=("Connector-synced data warehouse sources referenced by this query, if any."),
+ )
+ warnings: list[DataWarehouseSyncWarning | AccessControlFilterWarning] | None = Field(
+ default=None,
+ description=(
+ "Warnings about data warehouse sources referenced by the query whose"
+ " latest sync failed, is paused, hit a billing limit, or is otherwise"
+ " stale. Results may not reflect current source data. Accumulated"
+ " across every HogQL execution that contributes to this response — so"
+ " insights backed by warehouse tables (Trends, Funnels, etc.) receive"
+ " the same warnings as raw HogQL queries. Also carries access control"
+ " warnings when a system-table query filters out objects the user can't"
+ " access."
+ ),
+ )
+
+
class WebPageURLSearchQuery(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -30235,6 +30410,51 @@ class WebAgentAnalyticsQuery(BaseModel):
version: float | None = Field(default=None, description="version of the node, used for schema migrations")
+class WebPageDirectoryQuery(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ aggregation_group_type_index: int | None = Field(
+ default=None,
+ description=("Groups aggregation - not used in Web Analytics but required for type compatibility"),
+ )
+ compareFilter: CompareFilter | None = None
+ conversionGoal: ActionConversionGoal | CustomEventConversionGoal | None = None
+ dataColorTheme: float | None = Field(
+ default=None,
+ description=(
+ "Colors used in the insight's visualization - not used in Web Analytics but required for type compatibility"
+ ),
+ )
+ dateRange: DateRange | None = None
+ doPathCleaning: bool | None = None
+ excludeStaticAssets: bool | None = None
+ filterTestAccounts: bool | None = None
+ includeRevenue: bool | None = None
+ includeSiteTotals: bool | None = None
+ interval: IntervalType | None = Field(
+ default=None,
+ description=("Interval for date range calculation (affects date_to rounding for hour vs day ranges)"),
+ )
+ kind: Literal["WebPageDirectoryQuery"] = "WebPageDirectoryQuery"
+ limit: int | None = None
+ metrics: list[WebPageDirectoryMetric] | None = None
+ modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
+ offset: int | None = None
+ orderBy: list[WebAnalyticsOrderByFields | WebAnalyticsOrderByDirection] | None = None
+ pageKeys: list[str] | None = None
+ properties: list[EventPropertyFilter | PersonPropertyFilter | SessionPropertyFilter | CohortPropertyFilter]
+ response: WebPageDirectoryQueryResponse | None = None
+ sampling: WebAnalyticsSampling | None = None
+ samplingFactor: float | None = Field(default=None, description="Sampling rate")
+ search: str | None = None
+ sortBy: WebPageDirectorySortBy | None = None
+ sortDirection: SortDirection | None = None
+ tags: QueryLogTags | None = None
+ useSessionsTable: bool | None = None
+ version: float | None = Field(default=None, description="version of the node, used for schema migrations")
+
+
class WebVitalsPathBreakdownQuery(BaseModel):
model_config = ConfigDict(
extra="forbid",
diff --git a/posthog/schema_enums.py b/posthog/schema_enums.py
index ec165842e686..793131eb5865 100644
--- a/posthog/schema_enums.py
+++ b/posthog/schema_enums.py
@@ -2408,6 +2408,7 @@ class NodeKind(StrEnum):
WEB_EXTERNAL_CLICKS_TABLE_QUERY = "WebExternalClicksTableQuery"
WEB_BOTS_TABLE_QUERY = "WebBotsTableQuery"
WEB_AGENT_ANALYTICS_QUERY = "WebAgentAnalyticsQuery"
+ WEB_PAGE_DIRECTORY_QUERY = "WebPageDirectoryQuery"
WEB_GOALS_QUERY = "WebGoalsQuery"
WEB_VITALS_QUERY = "WebVitalsQuery"
WEB_VITALS_PATH_BREAKDOWN_QUERY = "WebVitalsPathBreakdownQuery"
@@ -3295,6 +3296,32 @@ class WebBotsBreakdown(StrEnum):
PATH = "Path"
+class WebPageDirectoryMetric(StrEnum):
+ VISITORS = "visitors"
+ GOOGLE_SEARCH = "google_search"
+ AI_REFERRALS = "ai_referrals"
+ AI_CRAWLS = "ai_crawls"
+ CONVERSIONS = "conversions"
+ TIME_ON_PAGE = "time_on_page"
+ BOUNCE_RATE = "bounce_rate"
+
+
+class SortDirection(StrEnum):
+ ASC = "ASC"
+ DESC = "DESC"
+
+
+class WebPageDirectorySortBy(StrEnum):
+ PAGE = "page"
+ VISITORS = "visitors"
+ GOOGLE_SEARCH = "google_search"
+ AI_REFERRALS = "ai_referrals"
+ AI_CRAWLS = "ai_crawls"
+ CONVERSIONS = "conversions"
+ TIME_ON_PAGE = "time_on_page"
+ BOUNCE_RATE = "bounce_rate"
+
+
class WebStatsBreakdown(StrEnum):
PAGE = "Page"
INITIAL_PAGE = "InitialPage"