Add a site
Web Analytics is coming soon
Every site belongs to a project, which pays for its events. Use the Analytics tab of the Cell or Box project that hosts the site, or create a Web Analytics project for sites hosted somewhere else. A project can have up to 50 sites and an account or organization up to 200; ask support if you need more. You can also add sites from a terminal with hubfly analytics.
A site hosted on Hubfly space
- Open the project and go to Analytics, then Add website.
- Choose Served by this project and one of the project's domains. A site on a Hubfly space domain tracks that domain only, so add one site per domain.
- Leave Add the script automatically on. HubProxy starts inserting the script tag into your HTML pages within a few minutes, with no code change or redeploy.
- Open your site in a browser, then the site's Realtime view in Dashboard. Set the site's time zone for daily reports in Settings → General.
With automatic injection, HubProxy adds this tag before </head> (or right after <body>) on GET responses with status 200 or 404 and Content-Type: text/html:
<script defer src="/.hubfly/a/s/hfa_k7m2p4q9x3w5n8r6.js" data-hfa></script>- Pages that already contain the tag are left unchanged, so adding it yourself as well is safe.
- On a
404page the tag also carries adata-404attribute, so the script can record 404 events in every browser. - When your response's Content Security Policy has a
nonce-…source, the tag gets the samenonce. - Downloads (
Content-Disposition: attachment), partial responses,Cache-Control: no-transformand the paths you list under Don't inject on paths starting with (up to 50, such as/admin) are never touched.
To place the tag yourself instead, turn off Add the script automatically in the site's Settings → Tracking and add the line above to your pages' <head>. The /.hubfly/a/ path still works on the domain.
A site hosted elsewhere
- In Dashboard, create a project of type Web Analytics and choose its region. Pick the one closest to most of your visitors; events are stored there.
- Select Add website and enter your domain. Until you have verified it, Dashboard shows a DNS
TXTrecord: add it at your DNS provider, wait a minute and select Check again. The site is added once the domain is verified, and a verified domain also covers its subdomains. - Copy the tag from the site's Settings → Install into the
<head>of every page:
<script defer src="https://hfa.<region>.hubfly.app/s/hfa_k7m2p4q9x3w5n8r6.js"></script>The script sends events to the same host it was loaded from. Framework-specific setups are in the framework guides.
Content Security Policy
On Hubfly space-hosted domains the script and its events are same-origin, so script-src 'self' and connect-src 'self' already allow them. For a site hosted elsewhere, allow the regional host in both directives:
Content-Security-Policy: script-src 'self' https://hfa.<region>.hubfly.app; connect-src 'self' https://hfa.<region>.hubfly.appCalls before the script loads
The tag uses defer, so your own code may run before it. Add this one-line stub before the tag and calls made early are queued, then sent once the script loads:
<script>window.hubfly=window.hubfly||function(){(window.hubfly.q=window.hubfly.q||[]).push(arguments)}</script>Visitors without JavaScript
A transparent pixel records a pageview, without engagement time, for visitors who have JavaScript turned off. Put it in a <noscript> block and fill in the page URL from your server template:
<noscript>
<img src="https://hfa.<region>.hubfly.app/e.gif?s=hfa_k7m2p4q9x3w5n8r6&u=https%3A%2F%2Fexample.com%2Fpricing" alt="" width="1" height="1">
</noscript>On Hubfly space-hosted domains use /.hubfly/a/e.gif instead of the regional host.
Check that it works
- Open a page of your site, then the site's Realtime view: the visit appears within a few seconds.
- Pages opened on
localhostor private addresses are ignored unless you turn on Count localhost for testing. - Your browser may be blocking it: privacy extensions, Do Not Track (when the site respects it) and an earlier
hubfly('opt_out')all stop collection on purpose. - Settings → Usage & limits (the Usage tab of a Web Analytics project) counts the events that were filtered, such as bots and exclusions, and those not collected, and says why while collection is paused.
Your own visits
hubfly('opt_out') once in your browser's console on the site. Excluded and opted-out visits are never stored or billed.Site settings
Change these in the site's Settings, which also holds the install snippet, goals, shared links, ingest keys and usage. Changes reach the script and the collector within a few minutes; the script is cached for up to five minutes.
| Setting | Section | What it does |
|---|---|---|
| Domains, Include subdomains | General | Only pages on these hosts are counted; events from other hosts are filtered. A site on a Hubfly space domain tracks that one domain. |
| Time zone, Currency | General | When report days start, and the currency revenue is summed in. |
| Add the script automatically | Tracking | Hubfly space domains only: HubProxy adds the script to your HTML pages, except under the paths you exclude. |
| Outbound links, File downloads, Form submissions, 404 pages | Tracking | Records each as an automatic event. These are billable. |
| Web Vitals, JavaScript errors | Tracking | Adds the matching module to the script. Never billed. |
| Hash-based routing | Tracking | Keeps #/… in page paths for apps that route with the URL hash. |
| Filter data-center traffic | Tracking | Treats visits from hosting and cloud networks as bots. |
| Count localhost | Tracking | Counts pages on localhost and private addresses, for testing. |
| Exclude pages, Exclude IP addresses | Tracking | Up to 50 of each. Matching visits are filtered before storage. Paths accept * for one segment and ** for any; IPs accept CIDR ranges. |
| Visitor identity | Privacy | Cookieless by default. Switch to persistent ids, optionally after consent; see privacy and consent. |
| Respect Do Not Track | Privacy | Sends nothing from browsers with DNT or Global Privacy Control set. |
| Raw data retention | Data & export | 30 days by default, up to a year. History beyond 30 days is billed by size. Lowering it deletes older raw events. |