Skip to content
cloudhostDocs
Products

Web analytics and speed insights

See who comes to your site, from where and on what device, and how fast your pages are for real visitors. The script loads from your site's own hostname and reports to it, so it depends on no other host and blockers of third-party scripts do not drop it.

Turn it on#

Web analytics and speed insights are Pro features, turned on per app or function: in the dashboard, project → Settings → Analytics. Turn on both or either one. On Hobby the card shows the Upgrade button and the API answers 402 plan_required.

cloudhost analytics enable my-site            # both
cloudhost analytics enable my-site --speed    # speed insights only
cloudhost analytics settings my-site --speed-sample 50
Until a feature is on, the events that arrive are dropped and cost nothing, so you can add the script ahead of time.

Add the script#

The platform serves the script at /_insights/script.js on the hostname of every site it hosts. It is about 4 KB, has no dependencies and stores nothing in the browser. Add one of these to your site:

<script defer src="/_insights/script.js"></script>
  • The script sends a page view on every page load and on every single-page navigation (it follows history.pushState), and the Web Vitals of the page load when the page is hidden.
  • Events are batched and sent with sendBeacon, and the server answers at once: analytics never slows a site. Under heavy load extra events are dropped, never your site's requests.
  • The Next.js and Astro components only add the route pattern (/blog/[slug]), so speed insights groups pages the way your app does. Without them, numbers, ids and long hashes in a path become [id].
  • Only /_insights/script.js and /_insights/event are the platform's; any other path under /_insights/ is your site's own.

What each page shows#

PageWhat it shows
AnalyticsVisitors, page views and bounce rate over the period, against the period before; a chart; and the top pages, referring sites, countries, devices, operating systems and browsers.
Speed insightsA score from 0 to 100 and the 75th percentile of each metric, on mobile or desktop; how it moved over the period; the share of good, needs-improvement and poor reports for each metric; and the same per route, worst first.
Settings → AnalyticsEach feature on or off, the speed sample, the script to copy, and deleting all the data.

Production and preview are kept apart; production is the default. Periods of two days or less are shown by the hour, longer ones by day (Tehran time).

Period and filters#

The period is 24 hours, 7, 30 or 90 days, 12 months, or any range the plan keeps. Every list is a filter: click a country to see that country's pages. Filters combine.

FilterValue
pathone page, such as /pricing
referrerthe referring site's hostname
countrya two-letter country code; XX is unknown
devicedesktop, mobile or tablet
os, browseran operating system or browser name, as the list shows it
environmentproduction (default), preview or all
  • Visitors are counted per day (Tehran time); someone who comes on two days is two visitors. This is the price of not tracking.
  • Filtered to one page, the visitors are that page's own, and bounce rate is not shown.
  • Bounce rate is the share of visits that saw one page only.
  • Distinct paths per hour are capped (2,000 on Pro); the rest count as (other), so a bot inventing URLs cannot flood your data.

Score and thresholds#

Each metric scores 0 to 100 on a log-normal curve through its thresholds: the “good” threshold scores 90 and the “poor” one 50, as page-speed tools do. The score is the weighted mean of the metric scores at the 75th percentile; a metric with no reports shares its weight out. 90 and up is good, 50 to 89 needs improvement, below 50 is poor.

MetricGood up toPoor fromWeight in the score
LCP, largest contentful paint2.5 s4 s30%
INP, interaction to next paint200 ms500 ms30%
CLS, cumulative layout shift0.10.2525%
FCP, first contentful paint1.8 s3 s15%
TTFB, time to first byte0.8 s1.8 sshown, not scored

Mobile and desktop are measured apart (tablets count as mobile). Percentiles are read from counts of reports in logarithmic ranges and are accurate to about 10%.

The speed sample#

A busy site does not need every page load's vitals. In Settings, set the sample from 1 to 100 percent: at 10%, one page load in ten keeps its vitals and speed insights costs a tenth. A page load's vitals are kept or dropped together. Page views are never sampled.

CLI
cloudhost analytics settings my-site --speed-sample 10

Plans and prices#

HobbyProEnterprise
Web analytics, speed insights—yesyes
Kept for—400 days800 days
Event rate limit per team—200 a second, bursts of 4,0002,000 a second, bursts of 40,000
Distinct paths per project and hour—2,00010,000
MeterWhat is countedIncluded in Pro
Web analytics events (analytics_events)page views100,000 a month
Speed insights data points (speed_datapoints)Web Vitals reports, one per metric per page load kept100,000 a month

Past the included amount you pay per 100,000; the prices are on the pricing page. Events that are dropped (feature off, bots, over the limit, not sampled) are not billed.

CLI#

CLI
cloudhost analytics my-site --period 30d
cloudhost analytics my-site --country IR --by path --limit 20
cloudhost analytics list
cloudhost speed my-site --device desktop --period 7d
cloudhost speed my-site --json
CommandWhat it does
cloudhost analytics <project> [--period 24h|7d|30d|90d|12mo] [--env production|preview|all] [--path] [--referrer] [--country] [--device] [--by <list>] [--limit <n>] [--json]Totals and top lists for the period; with --by (path, referrer, country, device, os, browser) one full list
cloudhost analytics listThe team's projects: on or off, and the last 7 days' visitors and page views
cloudhost analytics enable <project> [--web] [--speed]Turn on; with neither flag, both
cloudhost analytics disable <project> [--web] [--speed]Turn off; the data stays until the plan's retention ends
cloudhost analytics settings <project> --speed-sample <n>The speed sample, 1 to 100 percent
cloudhost analytics delete <project>Turn both off and delete every count kept (needs step-up)
cloudhost speed <project> [--device mobile|desktop] [--period] [--route <route>] [--json]The score, each metric's 75th percentile and the routes, worst first

MCP and API#

MCP toolWhat it does
get_analyticsA project's totals, series and top lists for a period, with the same filters (read-only)
get_speed_insightsA project's score, metrics and routes on mobile or desktop (read-only)
update_analytics_settingsTurn each feature on or off and set the speed sample
API
curl -H "Authorization: Bearer $KEY" \
  "https://api.ibel.ai/v1/apps/my-site/analytics?period=30d&country=IR"

curl -H "Authorization: Bearer $KEY" \
  "https://api.ibel.ai/v1/apps/my-site/speed-insights?device=mobile&period=7d"

Every route, parameter and error code is in the API reference.

Privacy#

Web analytics and speed insights collect no personal data. You can link this statement from your site's privacy notice.

  • No cookies, no local storage, no fingerprinting. The script stores nothing in the visitor's browser.
  • No addresses kept. The visitor's IP address is used once, when an event arrives, to look up a country, and is then discarded. It is never written to disk or to a log.
  • Visitors are counted with a hash that cannot be reversed. To count unique visitors, we compute a hash of the visitor's address and browser string with a random salt that changes every day (Tehran time) and is deleted after the next day. The hash is kept only for that day and the next, then deleted with the salt. It cannot be linked to a person, nor to the same visitor on another day or another site.
  • Only counts are stored. What is kept is how many page views and visitors each page had in each hour, by referring site (its hostname only, never the full address), country, device class (desktop, mobile, tablet), operating system and browser name; and, for speed, how many reports fell in each range of each metric, by route and device class.
  • Query strings and fragments are dropped before anything is stored, so search terms, tokens and emails in URLs are never kept.
  • Data stays in Iran, on the platform's own servers, and is deleted when the plan's retention ends, or at once when the project owner turns analytics off and deletes the data.
  • No consent banner is needed for this data under the usual cookie rules, as no information is stored on or read from the visitor's device; site owners remain responsible for their own privacy notice.

The country comes from an IP-to-country list kept on the platform's servers; nothing is sent anywhere to look it up. Visits from bots (by browser string) are not counted.

Turn off and delete#

Turning off stops collection; the counts already kept stay until the retention ends. “Delete data” in Settings (or cloudhost analytics delete) turns both off and deletes every count at once; with a dashboard session it needs step-up.