Contents
PR Summary
What problems was I solving
Page analytics users need to export large amounts of analytics data as CSV files. Previously, this operation was synchronous and could time out for large datasets. This PR redesigns the export system to use an asynchronous job-based approach with tracking and status queries.
What user-facing changes did I ship
Added 'CSV Export' button on the analytics tab that initiates an asynchronous export job. Users can watch progress while the export runs in the background and download when ready. Added 'Group by' dropdown to enable grouping analytics by attribution dimensions (UTM fields or custom query params). Comparison tables and cards now show attribution group labels, helping users understand which attribution data generated each metric row.
How I implemented it
The new export system consists of: (1) A new analytics_export_jobs table that stores export job metadata and the full request payload (for later reuse), (2) Temporal workflow (pageAnalyticsCsvExportWorkflow) that orchestrates CSV generation, (3) File Service's new storeFileContent API to upload CSV content directly (20MB max), (4) Attribution grouping support across analytics APIs allowing exports grouped by UTM fields or additional query params, (5) Export UI that polls for job completion and auto-starts download when ready. The frontend changes from synchronous export to job submission + polling (15s default timeout, retries backoff). All new fields are backwards-compatible (optional in schemas).
Description for the changelog
Implemented async page analytics CSV export with job tracking and progress display. Added attribution grouping support to analytics queries and export output, enabling users to analyze performance by marketing channel (UTM) or custom query parameters. Export UI now shows group labels and lets users select multiple grouping dimensions. CSV export job table indexes by tenant, user, and status for efficient listing and cleanup.