Analytics
How a site is doing, from code or an AI assistant: visitors and sessions counted without cookies, traffic, pages, sources, devices, countries, leads, conversions, revenue, Google search, workflow runs and site health, each compared with the period before.
The Analytics endpoints answer the questions an owner asks first: how is the site doing this month, which pages bring enquiries, where do visitors come from, what do people search for on Google. They are read-only, need the analytics:read scope, and live under /sites/{siteId}/analytics/.
| Endpoint | Answers | Plan feature |
|---|---|---|
GET …/analytics/summary | Headline numbers, what changed most, top pages, entry pages, lead pages, sources and queries | analytics |
GET …/analytics/traffic | Visitors, sessions, page views and leads over time, bounce rate, average session length, conversion rate | analytics |
GET …/analytics/pages | Pages by views, leads (sort=leads) or entries (sort=entries), with conversion rate and bounce rate | analytics |
GET …/analytics/sources | Referring sites and channels (direct, search, social, ai, email, referral), with visitors, sessions and the leads each brought | analytics |
GET …/analytics/devices | Views and leads on phones, tablets and computers | analytics |
GET …/analytics/countries | Views and leads by country | analytics |
GET …/analytics/conversions | Leads by form, payments, revenue and conversion rate over time | analytics |
GET …/analytics/leads | New contacts by source, the pipeline by stage, stage moves | analytics |
GET …/analytics/revenue | Revenue by currency and plan, active subscriptions | payments |
GET …/analytics/search | Google Search Console clicks, impressions, CTR, position, queries, pages, opportunities | growth.search |
GET …/analytics/workflows | Runs, failures, failure rate and run time per workflow | workflows |
GET …/analytics/health | Pages missing Google titles or descriptions, pages with no views, index status, PageSpeed, the latest growth report | analytics |
A site whose plan lacks the feature gets 403 with the code feature_not_in_plan and details.feature. A key without the scope gets 403 insufficient_scope.
Periods
Every endpoint takes the same period, in the site's own time zone (or UTC when it has none):
period:today,yesterday,7d,14d,28d(the default),30d,90d,365d,this_week,last_week,this_month,last_month,this_quarter,last_quarter,this_yearorlast_year. TheNdperiods end today; weeks start on Monday.- Or
fromandtoasYYYY-MM-DD, both included, up to 800 days.todefaults to today. compare:previous(the default),year(the same dates a year earlier) ornone. Withprevious, a calendar period compares with the one before it, solast_month(October) compares with all of September, andthis_month(1 to 23 November) with 1 to 23 October. Other periods compare with the same number of days just before.granularityon series endpoints:day(default),weekormonth. Buckets are clipped to the period.
Every answer starts with what it covers:
{
"period": { "preset": "last_month", "from": "2026-10-01", "to": "2026-10-31", "days": 31, "timeZone": "Pacific/Auckland", "timeZoneSource": "site" },
"previous": { "from": "2026-09-01", "to": "2026-09-30", "days": 30 },
"notes": ["Page views count every page opened, so a person who opens three pages counts three times.", "Visitors and sessions are counted without cookies, by a hash of the IP address and browser that changes every day and is never stored with either. …"]
}timeZoneSource is site when the site has its own time zone and default when it falls back to UTC. notes say what the numbers do and don't include; pass them on when you show the numbers to someone.
Numbers with their comparison
Every compared number has the same shape:
{ "current": 38, "previous": 29, "change": 0.31 }change is a fraction: 0.31 is 31% up, -0.5 is half. It is null when the previous value is 0, and previous is null with compare=none.
How is the site doing?
curl "https://api.unvop.com/v1/sites/site_…/analytics/summary?period=this_month" \
-H "Authorization: Bearer $UNVOP_KEY"The summary has metrics (visitors, sessions, bounce rate, average session length, views, views per day, leads, new contacts, conversion rate, payments and revenue, Google search totals when there is search data, workflow runs), highlights (sentences about the biggest changes, a new source, the page that brought the most leads, failed runs), and short lists of the top pages, lead pages, sources and queries. Drill into any of them with the endpoints below.
Which pages bring leads?
curl "https://api.unvop.com/v1/sites/site_…/analytics/pages?period=last_month&sort=leads&limit=5" \
-H "Authorization: Bearer $UNVOP_KEY"{
"sort": "leads",
"totals": { "pages": 14, "views": 4210, "leads": 38 },
"items": [
{ "path": "/services/hot-water", "title": "Hot water", "views": { "current": 450, "previous": 380, "change": 0.184 }, "leads": { "current": 14, "previous": 6, "change": 1.333 }, "conversionRate": 0.0311 }
]
}A lead is one form submission, and its page is the page the form was sent from. conversionRate is leads divided by page views.
Visitors and sessions
Visitors and sessions are counted without cookies or anything stored on the visitor's device, so a site needs no consent banner for them. For each page view the Worker hashes a random salt for the UTC day, the site, the IP address and the user agent; the hash matches page views within that day, and a session ends after 30 minutes without activity. The IP address and user agent are never stored, the per-session rows are rolled into daily totals and deleted about 40 minutes after the UTC day ends, and the salt expires when the next day ends. The method and the legal reasoning are in the repository's docs/ANALYTICS-PRIVACY.md.
What that means for the numbers:
- **
visitorsis daily visitors, summed.** A visitor is unique within one UTC day. Over a week, someone who came on three days counts three times. Say "daily visitors, summed" when you show it, or usesessionsfor "visits". - **
sessions,bounceRate(sessions with one page view, 0 to 1),avgSessionSeconds(first view to leaving the last page, from a beacon sent when the page is hidden) andviewsPerSession** come withvisitorsintrafficandsummary. A session that runs over UTC midnight counts as two. - Entry pages:
pagesitems carryentries(sessions that started there) and theirbounceRate;sort=entriesranks landing pages, andsummary.topEntryPageslists the top five. - Leads by source: a form submission records the first referrer of the visit it was sent in, so
sourcesitems and channels carryleads. Leads sent before visitor counting started, or with no counted visit (analytics off, a script), have no source;totals.leadsWithSourcesays how many do. - **
returningVisitors**: only when the owner turned on the optional Returning visitors setting and some visitors accepted its cookie:{ visitors, new, returning }, each person counted once over the period. Otherwisenull. - Visitor counts start on the day the feature shipped; the notes say so when a period reaches back before it.
"totals": {
"visitors": { "current": 1630, "previous": 1402, "change": 0.163 },
"sessions": { "current": 1910, "previous": 1655, "change": 0.154 },
"bounceRate": { "current": 0.46, "previous": 0.49, "change": -0.061 },
"avgSessionSeconds": { "current": 94, "previous": 88, "change": 0.068 },
"returningVisitors": null
}From an AI assistant
Connected through the MCP server, an assistant calls site_report for the summary, then execute for anything deeper. It can fetch several endpoints in one run and combine them:
async () => {
const site = 'site_…';
const q = { period: 'last_month' };
const [pages, sources] = await Promise.all([
unvop.request({ method: 'GET', path: `/sites/${site}/analytics/pages`, query: { ...q, sort: 'leads', limit: '5' } }),
unvop.request({ method: 'GET', path: `/sites/${site}/analytics/sources`, query: { ...q, limit: '5' } }),
]);
return {
leadPages: pages.items.map((p) => ({ page: p.path, leads: p.leads.current, before: p.leads.previous })),
sources: sources.items.map((s) => ({ source: s.source, views: s.views.current, change: s.views.change })),
};
}What is and isn't measured
- Page views are counted by the Analytics plugin per day, path and referrer, with no cookies and nothing that identifies a person. Visitors and sessions are counted by a daily hash (see Visitors and sessions). Both are stored per UTC day, so their day edges follow UTC even when the site has a time zone.
- Devices and countries are counted per day alongside views since November 2026, when they were added. Earlier days have none, and the notes say when the counts start.
- Leads carry the first referrer of the visit they were sent in, from when visitor counting started.
- Bookings made in an outside scheduler aren't counted (
bookingsisnull). - Search Console data comes from Google about two days late, on Google's own days, and only while Google search is connected.
- Revenue is in minor units (cents): paid one-off payments and active subscriptions, counted once when they started. List single payments with
GET /sites/{siteId}/payments(payments:read). - The design, broken-link and contrast checks of an AI build are kept with the build, not in
health.