Modulify

Read visitor analytics

get_site_analytics

Reads a site's visitor numbers over a fixed period, the six headline metrics plus a visitors series to chart.

The six numbers are visitors, visits, pageviews, viewsPerVisit, bounceRate and visitDuration. period defaults to 7d. day is today so far, from midnight UTC, 24h is the current hour and the 23 before it, 7d, 30d and 90d are the last 7, 30 and 90 days counting today, 12mo is this month and the 11 before it, and all is all time.

The response echoes the period and the interval of the series, hour for day and 24h, month for 12mo and all, otherwise day. The values sit in visitorsSeries, and seriesLabels are the UTC start of each bucket as ISO timestamps. The series never runs past the present: when the period reaches now, its last bucket is the one still in progress and lastBucketPartial is true, so that last value is not final and a low number there is not a drop in traffic.

published says whether the site is live right now. A site that was never published answers with zeros, while a site taken offline still returns its history. If the analytics backend cannot answer, the call fails with an error rather than reporting zeros, so a failure never means no traffic.

Each call costs 2 of the 1,200 analytics lookups access tokens share per site per hour, one for the totals and one for the series, as Rate limits and result size explains. A part already cached costs nothing, and neither does a site that was never published. Over that limit it fails with Access tokens, through MCP clients or the API, used their 1,200 analytics lookups for this site this hour. Wait and try again! See The six metrics.

Inputs

Input Type Required Description
projectId string Yes The site id.
period string No The window to report on: day (today so far), 24h, 7d, 30d, 90d, 12mo or all. Defaults to 7d, and anything outside this list is refused before the call runs.