openapi: 3.0.3 info: title: PostHog actions web_analytics API version: 1.0.0 description: '' tags: - name: web_analytics paths: /api/environments/{project_id}/web_analytics/weekly_digest/: get: operationId: web_analytics_weekly_digest description: 'Summarizes a project''s web analytics over a lookback window (default 7 days): unique visitors, pageviews, sessions, bounce rate, and average session duration with period-over-period comparisons, plus the top 5 pages, top 5 traffic sources, and goal conversions.' summary: Summarize web analytics parameters: - in: query name: compare schema: type: boolean default: true description: When true (default), include period-over-period change for each metric comparing against the prior equal-length period. Set to false to skip the comparison query (faster). - in: query name: days schema: type: integer default: 7 description: Lookback window in days (1–90). Defaults to 7. - $ref: '#/components/parameters/ProjectIdPath' tags: - web_analytics security: - PersonalAPIKeyAuth: - web_analytics:read responses: '200': content: application/json: schema: $ref: '#/components/schemas/WeeklyDigestResponse' description: '' x-explicit-tags: - web_analytics components: schemas: WeeklyDigestResponse: type: object properties: visitors: allOf: - $ref: '#/components/schemas/NumericMetric' description: Unique visitors. pageviews: allOf: - $ref: '#/components/schemas/NumericMetric' description: Total pageviews. sessions: allOf: - $ref: '#/components/schemas/NumericMetric' description: Total sessions. bounce_rate: allOf: - $ref: '#/components/schemas/NumericMetric' description: Bounce rate (0–100). avg_session_duration: allOf: - $ref: '#/components/schemas/DurationMetric' description: Average session duration. top_pages: type: array items: $ref: '#/components/schemas/TopPage' description: Top 5 pages by unique visitors. top_sources: type: array items: $ref: '#/components/schemas/TopSource' description: Top 5 traffic sources by unique visitors. goals: type: array items: $ref: '#/components/schemas/Goal' description: Goal conversions. dashboard_url: type: string format: uri description: Link to the Web analytics dashboard for this project. required: - avg_session_duration - bounce_rate - dashboard_url - goals - pageviews - sessions - top_pages - top_sources - visitors NumericMetric: type: object properties: current: type: number format: double description: Value for the most recent period. previous: type: number format: double nullable: true description: Value for the prior period, if available. change: allOf: - $ref: '#/components/schemas/WoWChange' nullable: true description: Period-over-period change, null when not meaningful. required: - change - current - previous DurationMetric: type: object properties: current: type: string description: Human-readable duration, e.g. '2m 34s'. previous: type: string nullable: true description: Prior-period duration, e.g. '2m 10s'. change: allOf: - $ref: '#/components/schemas/WoWChange' nullable: true description: Period-over-period change, null when not meaningful. required: - change - current - previous Goal: type: object properties: name: type: string description: Goal name (action name). conversions: type: integer description: Total conversions in the period. change: allOf: - $ref: '#/components/schemas/WoWChange' nullable: true description: Period-over-period change in conversions, null when not meaningful. required: - change - conversions - name TopSource: type: object properties: name: type: string description: Initial referring domain. visitors: type: integer description: Unique visitors from this source. change: allOf: - $ref: '#/components/schemas/WoWChange' nullable: true description: Period-over-period change in visitors, null when not meaningful. required: - change - name - visitors TopPage: type: object properties: host: type: string description: Host for the page, if recorded. path: type: string description: URL path. visitors: type: integer description: Unique visitors in the period. change: allOf: - $ref: '#/components/schemas/WoWChange' nullable: true description: Period-over-period change in visitors, null when not meaningful. required: - change - host - path - visitors WoWChange: type: object properties: percent: type: integer description: Absolute percentage change, rounded to nearest integer. direction: allOf: - $ref: '#/components/schemas/DirectionEnum' description: 'Direction of the change relative to the prior period. * `Up` - Up * `Down` - Down' color: type: string description: Hex color indicating whether the change is a positive or negative signal. text: type: string description: Short label, e.g. 'Up 12%'. long_text: type: string description: Verbose label, e.g. 'Up 12% from prior period'. required: - color - direction - long_text - percent - text DirectionEnum: enum: - Up - Down type: string description: '* `Up` - Up * `Down` - Down' parameters: ProjectIdPath: in: path name: project_id required: true schema: type: string description: Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/. securitySchemes: PersonalAPIKeyAuth: type: http scheme: bearer x-tagGroups: - name: All endpoints tags: - LLM Analytics - actions - activity_log - activity_logs - advanced_activity_logs - alerts - annotations - approval_policies - batch_exports - cdp - change_requests - code - code-invites - cohorts - comments - conversations - core - customer_analytics - customer_journeys - customer_profile_configs - dashboard_templates - dashboards - data_color_themes - data_modeling_jobs - data_warehouse - dataset_items - datasets - desktop_recordings - domains - early_access_feature - early_access_features - elements - endpoints - environments - error_tracking - evaluation_runs - evaluations - event_definitions - event_filter - event_schemas - events - experiment_holdouts - experiment_saved_metrics - experiments - exports - external_data_schemas - external_data_sources - feature_flags - file_system - file_system_shortcut - flag_value - groups - groups_types - health_issues - heatmap_screenshots - heatmaps - hog_flows - hog_function_templates - hog_functions - insight_variables - insights - integrations - invites - js-snippet - legal_documents - lineage - live_debugger_breakpoints - llm_analytics - llm_prompts - llm_skills - logs - managed_viewsets - max - max_tools - mcp_server_installations - mcp_servers - mcp_store - mcp_tools - members - notebooks - oauth_applications - object_media_previews - organizations - persisted_folder - persons - platform_features - plugin_configs - product_analytics - product_tours - project_secret_api_keys - projects - property_definitions - proxy_records - public_hog_function_templates - query - replay - reverse_proxy - role_external_references - roles - sandbox-environments - sandbox_environments - saved - schema_property_groups - sdk_doctor - session_group_summaries - session_recording_playlists - session_recordings - session_summaries - sessions - signals - subscriptions - surveys - taggers - task-automations - task-runs - task_automations - tasks - uploaded_media - user_home_settings - user_interviews - users - visual_review - warehouse_dag - warehouse_model_paths - warehouse_saved_queries - warehouse_saved_query_folders - warehouse_tables - warehouse_view_link - warehouse_view_links - web_analytics - web_experiments - web_vitals - welcome - workflows