Tracking
How the script works
Exactly what the tracking script sends, when it sends it, what it leaves out, and its settings and limits.
At a glance
<script defer src="https://script.fivebar.eu/latest.js" data-site="your-site-id"></script>- 807 bytes compressed. It loads after your page has been drawn and never delays it.
- It sets no cookies and writes nothing to the browser’s storage.
- It sends three kinds of small request and nothing else: a pageview, the time a page was on screen, and a goal you chose to count.
What it sends
| Request | Sent when | Contains |
|---|---|---|
| Pageview | A page is opened | Your site id, the page’s hostname and path, the address of the page that linked here, a campaign tag if the link had one, and the browser’s time zone. |
| Time on screen | A page is left or hidden | Your site id, the hostname and path, and the number of seconds the page was actually visible. |
| Goal | You ask for it | Your site id, the hostname and path, and the goal’s name. |
The path is sent without the part after ?. Query strings often carry email addresses, search
words and login tokens, so they never leave the page.
Our server adds the time, and works out three things from the request itself: the country (from the IP address, which is then thrown away), the browser, system and device type (from the browser’s own description of itself, keeping only the family name such as “Firefox”), and a visitor number that changes every day. The time zone is only a fallback for the country, used when the address lookup has no answer. What Fivebar collects has the full list of what is stored and what never is.
When a pageview is counted
- When a page loads. One pageview per page.
- When the address changes without a reload. Websites built as single-page apps (React, Vue, Svelte, Next.js and others) swap pages without loading a new one. The script notices the address change and counts it, including the back and forward buttons. You do not need to call anything.
- Only when the path changes. A change to the part after
?or#alone is the same page and is not counted again. A site that keeps its pages after a#is counted as one page. - Only when the page is shown. Browsers sometimes load a page in the background before you click its link. That counts only if the page is then opened.
How time on a page is measured
The clock runs only while the tab is visible. Switching to another tab pauses it; coming back resumes it. The total is sent when the page is left, and one report can say 30 minutes at most, so a tab left open over lunch cannot distort your averages.
What is never counted
- Pages on
localhostor127.0.0.1, or opened straight from a file. - Browsers driven by a program, such as automated tests.
- Search engine crawlers, uptime monitors, link-preview fetchers and command-line tools. These are recognised on our server and dropped.
- Pages on a domain other than the one the site was added with. See which addresses are counted.
Settings
Everything is set on the script tag itself.
| Attribute | Needed | What it does |
|---|---|---|
src | Yes | Where the script is loaded from. Pageviews are sent back to the same address. |
data-site | Yes | Your site’s id, from the dashboard. Without it the script does nothing. |
defer | Recommended | Tells the browser to draw the page first and run the script afterwards. |
data-api | No | Sends pageviews to a different address. Leave it out; see the note below. |
The script also puts one function on the page, fivebar(), for counting goals from your own code. Goals explains it.
Limits
| What | Limit | If it is exceeded |
|---|---|---|
| Page path | 300 characters | The rest is cut off. |
| Source or campaign tag | 80 characters | The rest is cut off. |
| Goal name | 40 characters | The goal is not counted. |
| Time per report | 30 minutes | Counted as 30 minutes. |
| Requests from one internet connection | 120 per minute | The extra ones are dropped until the minute is over. |
The last limit counts pageviews, time reports and goals together. A person browsing never comes near it. A whole office sharing one connection could, if hundreds of pages are opened in the same minute.
Content Security Policy
If your site sends a Content-Security-Policy header, allow Fivebar in these two rules:
script-src https://script.fivebar.eu;
connect-src https://script.fivebar.eu;Ad blockers and private browsing
Some ad blockers and privacy-focused browsers block analytics scripts of every kind, including this one. Those visitors are not counted, and there is nothing to work around: it is their choice. Expect your numbers to be somewhat lower than your server’s own logs for this reason.