Hubfly spaceDocs
Console

Add a site

Web Analytics is coming soon

Web Analytics is not open for new sites yet, and nothing is charged for it. This guide describes how it works at launch; the prices are the launch prices.

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

  1. Open the project and go to Analytics, then Add website.
  2. 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.
  3. 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.
  4. 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:

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 404 page the tag also carries a data-404 attribute, 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 same nonce.
  • Downloads (Content-Disposition: attachment), partial responses, Cache-Control: no-transform and 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

  1. 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.
  2. Select Add website and enter your domain. Until you have verified it, Dashboard shows a DNS TXT record: 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.
  3. Copy the tag from the site's Settings → Install into the <head> of every page:
html
<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:

text
Content-Security-Policy: script-src 'self' https://hfa.<region>.hubfly.app; connect-src 'self' https://hfa.<region>.hubfly.app

Calls 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:

html
<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:

html
<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 localhost or 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

Add your office IP addresses under Exclude IP addresses in the site's Settings → Tracking, or run 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.

SettingSectionWhat it does
Domains, Include subdomainsGeneralOnly 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, CurrencyGeneralWhen report days start, and the currency revenue is summed in.
Add the script automaticallyTrackingHubfly space domains only: HubProxy adds the script to your HTML pages, except under the paths you exclude.
Outbound links, File downloads, Form submissions, 404 pagesTrackingRecords each as an automatic event. These are billable.
Web Vitals, JavaScript errorsTrackingAdds the matching module to the script. Never billed.
Hash-based routingTrackingKeeps #/… in page paths for apps that route with the URL hash.
Filter data-center trafficTrackingTreats visits from hosting and cloud networks as bots.
Count localhostTrackingCounts pages on localhost and private addresses, for testing.
Exclude pages, Exclude IP addressesTrackingUp to 50 of each. Matching visits are filtered before storage. Paths accept * for one segment and ** for any; IPs accept CIDR ranges.
Visitor identityPrivacyCookieless by default. Switch to persistent ids, optionally after consent; see privacy and consent.
Respect Do Not TrackPrivacySends nothing from browsers with DNT or Global Privacy Control set.
Raw data retentionData & export30 days by default, up to a year. History beyond 30 days is billed by size. Lowering it deletes older raw events.
Something unclear or out of date? Emailsupport@hubfly.spaceBack to top