Web analytics
For instructions on how to authenticate to use this endpoint, see API overview.
Endpoints
POST | |
GET | |
GET |
Create web analytics fetch llms
Loads an llms.txt file from a public URL for coverage analysis without saving it.
Required API key scopes
web_analytics:readRequest parameters
- urlstring
Response
Example request
POST /api /projects /:project_id /web_analytics /llms_txtExample response
Status 200
Status 400 The URL is invalid, inaccessible, or does not return an llms.txt file.
Create web analytics fetch llms
Loads an llms.txt file from a public URL for coverage analysis without saving it.
Required API key scopes
web_analytics:readRequest parameters
- urlstring
Response
Example request
POST /api /projects /:project_id /web_analytics /llms_txtExample response
Status 200
Status 400 The URL is invalid, inaccessible, or does not return an llms.txt file.
Retrieve web analytics
The 'Wrapped'-style weekly recap: everything in the weekly digest (visitors, pageviews, sessions, bounce rate, average session duration with period-over-period comparisons, top pages, top sources, and goals) plus a single derived weekly persona and a short list of screenshot-worthy highlights for the period.
Required API key scopes
web_analytics:readQuery parameters
- comparebooleanDefault:
true - daysintegerDefault:
7
Response
Example request
GET /api /projects /:project_id /web_analytics /recapExample response
Status 200
Retrieve web analytics
The 'Wrapped'-style weekly recap: everything in the weekly digest (visitors, pageviews, sessions, bounce rate, average session duration with period-over-period comparisons, top pages, top sources, and goals) plus a single derived weekly persona and a short list of screenshot-worthy highlights for the period.
Required API key scopes
web_analytics:readQuery parameters
- comparebooleanDefault:
true - daysintegerDefault:
7
Response
Example request
GET /api /projects /:project_id /web_analytics /recapExample response
Status 200
Retrieve web analytics weekly
Also available via the PostHog MCP server:
web-analytics-weekly-digest— Summarize web analytics
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.
Required API key scopes
web_analytics:readQuery parameters
- comparebooleanDefault:
true - daysintegerDefault:
7
Response
Example request
GET /api /projects /:project_id /web_analytics /weekly_digestExample response
Status 200
Retrieve web analytics weekly
Also available via the PostHog MCP server:
web-analytics-weekly-digest— Summarize web analytics
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.
Required API key scopes
web_analytics:readQuery parameters
- comparebooleanDefault:
true - daysintegerDefault:
7
Response
Example request
GET /api /projects /:project_id /web_analytics /weekly_digest