Documentation

Guides and API reference for uploads, image transforms and video.

npm install @cd2/fileboy-react
API https://api.fileboy.io

Video analytics

See how your videos do: views, unique viewers, watch time, how much of a video people watch, completions, call-to-action clicks, a retention curve that shows where they drop off, where views came from, viewers' countries and who watched. The Fileboy player counts them, with no cookies, and names only viewers who are signed in.

Where to see them

Open a video in the dashboard and pick the Audience tab and its Analytics section: the numbers for the last 7, 30 or 90 days, views per day, and the retention curve with the video's chapters marked on it. The Videos page has the same numbers for all your videos together, and your most viewed ones. That tab also shows how well the video plays: start-up time, rebuffering and errors. Every chart can be shown as a table.

Or read them with the management API, below. Figures are added about every 30 minutes, once a viewer has stopped watching, and days are UTC days.

The watch and embed pages always count. On your own site, views count from <fileboy-player> 1.8.0 or later: earlier versions don't report them, so a page with an older player shows no views.

Views count from the moment a video plays, so the first viewers of a new upload or recording count while it is still processing: once its first quality is stored, or a recording's quick playable copy is there (the video's data says playable: true).

What each number means

Figures

views number

Playbacks that played at least 3 seconds (half the video, for one under 6 seconds). A page load that plays the video is one playback, however many times it pauses or seeks.

plays number

Playbacks that played anything, views included.

uniqueViewers number

Different viewers among the views, counted once a day: someone who watches on three days is three. Across a range it is the sum of the days.

watchSeconds number

Seconds watched by views, rewatched parts included.

averagePercentWatched number

The average share of the video each view played, counting each second once.

completions number

Views that played 90% or more of the video. completionRate is them as a percentage of views.

ctaClicks number

Clicks on the player's call-to-action button: at most 20 a playback, and one from a page that clicked it without playing the video.

retention object

100 percentages: of the views, how many played each hundredth of the video. Rewatching doesn't raise it above 100%; skipping a part lowers it there.

overflowPlays number

Plays past the daily cap on new playbacks (see What doesn't count). They are in plays, and what they played is in watchSeconds, but they aren't views and aren't in the averages, completions or retention. 0 for nearly every video.

Quality of experience

How well the video plays for your viewers, from the Fileboy player 1.9.0 and later, in qoe. It counts every playback that played, failed or measured its start, so a video that never starts for someone still shows. Playbacks from older players aren't in it, rather than counted as perfect: the dashboard says so when a range has views but none from a player that reports quality.

Quality figures

sessions number

Playbacks the figures come from.

startupTimeMedian number

Seconds from pressing play (or autoplay starting) to the first frame, for the middle playback: half started faster. Includes loading the stream. Worked out from a histogram, so it is accurate to within its bucket (a quarter of a second under 1 s, wider above).

startupTimeP90 number

The same for nine in ten playbacks: the slow end of what viewers wait.

rebufferRatio number

The percentage of watching time (playing plus stalled) spent stalled, waiting for video while playing. The wait after a seek and before the first frame don't count.

rebufferSessionRate number

The percentage of playbacks that stalled at least once. rebuffers and rebufferSeconds are the stalls and their seconds in all.

errorRate number

The percentage of playbacks where an error stopped playback. errorSessionRate counts any error, including ones the player recovered from (a segment downloaded again, a switch from native HLS to hls.js).

averageRenditionHeight number

The rendition height played (720 for 720p), averaged over the time played.

topErrors array

The five most common error codes, with how many playbacks had each and in how many it stopped playback. Codes: hls_network, hls_media, hls_mux, hls_key and hls_other (hls.js), media_aborted, media_network, media_decode and media_unsupported (the browser's own playback), stream_load (the stream failed to start), native_fallback, and other.

days array

Per day: sessions, startupTimeMedian, rebufferRatio and errorRate, null on days without sessions.

Viewers and sources

The Audience tab also shows where a video's views came from, the countries viewers watched from and who watched; the Videos page shows sources and countries for all your videos together. In the API they are sources, countries and, for one video, viewers. Each playback's source and country are decided once, when it starts.

Sources

embed host

Played on another site: a <fileboy-player> on it, or Fileboy's embed page in its iframe. host is that site.

referrer host

Watched on Fileboy's watch or link page after following a link on another site. host is that site.

share_link

Opened from an expiring video link, with no other site sending the viewer there.

direct

Fileboy's watch page with no referring site: a link typed or pasted, or opened from an app that sends no referrer (many chat and email apps don't).

Only the site's host is kept (lower case, without www.), never a page's path or query. A site on a bare IP address, or with a name that isn't a plain host, counts as an embed or a link with no host. A video names at most 50 sites a day; views from any further site that day are counted under the same kind without a host. Every playback since this release has a source; views from before have none. <fileboy-player> 1.17.0 and later reports the page it plays on. An older player on your site is still credited to it, from the request's Origin; an older player on Fileboy's pages (which run the latest, so only from a page left open) shows as direct.

Countries come from the viewer's IP address, looked up once when a playback starts in MaxMind's GeoLite2 database (or from Cloudflare, where Fileboy runs behind it). The address isn't kept for this, only the country. Views whose address has no known country are shown as Unknown. Where countries aren't set up yet, countriesAvailable is false and the dashboard says so. This product includes GeoLite2 data created by MaxMind, available from https://www.maxmind.com.

Who watched lists viewers by name only when they are signed in: members of your app signed in to Fileboy (on Fileboy's watch and embed pages, or signed in with the Fileboy sign-in on your site), and your own users when your server vouches for them with a viewer token (see Reactions and comments). A Fileboy account that isn't a member of your app is counted, not named. Everyone else stays anonymous, as before. For each viewer: their views, the most of the video they watched in one view, their watch time, completions and when they last watched. The list keeps a viewer for as long as the video; a Fileboy account removed from your app, or deleted, leaves it.

Trims, cuts and replacements

A trim, cut or new source changes what each moment of the video is, so the retention curve is kept per version and starts again with the new one. Earlier versions' curves stay readable with ?version=. Views, watch time and the share watched carry on across versions: each view's share is of the version it watched. A player still playing an old version stops being counted once the new one is ready.

What is collected, and what isn't

While a video plays, the player sends small batches to POST /videos/:id/views: every 10 seconds while there is something new, at once on pause, at the end and on a call-to-action click, and a last one when the page is hidden or closed. Each batch has:

  • an id for this playback and a view ticket, which come with the video's data when the player loads it and are kept only in memory (players before 1.9.0 make a random id and send no ticket);

  • the video's version, and the seconds played since the last batch;

  • which whole seconds of the video were played, as ranges;

  • pauses, seeks (from and to), the end and call-to-action clicks;

  • from 1.9.0, how playback went: the start-up time, stalls and how long they lasted, errors as a short code (never a URL or message) and whether they stopped playback, and the seconds played at each rendition height;

  • from 1.17.0, the host of the page the player is on (in an iframe, the site framing it) and of the page's referrer, hosts only; and for a viewer the page has signed in, their viewer session or your viewer token, so they can be named in Who watched.

There are no cookies, and nothing is kept in the viewer's browser. The player doesn't send a page's path or query, and sends nothing about a viewer who isn't signed in. To count unique viewers, Fileboy hashes the viewer's IP address (its /64 for IPv6), their browser's user agent and your app's id with a random salt made for each day. Salts are deleted after two days, so a hash can't be traced back to an address after that, and the same person has a different hash each day and in each app. The address and user agent themselves are never stored.

The per-playback rows and the daily viewer hashes are deleted after 90 days. The daily figures and retention counts are kept for as long as the video.

If you embed videos on your own site, check whether your privacy notice should say that the player reports viewing to Fileboy. Fileboy can't tell you what your notice needs.

What doesn't count

Bots, crawlers, link previews, headless browsers and HTTP libraries are left out by their user agent. So is any playback that reports more watching than it could have done: faster than 2x for the time it was open, or parts of the video it didn't play. Batches are capped at 16 KB and rate-limited per address, playback and video.

Each batch must carry the view ticket that came with the video's data, made for that video and playback and good for starting it for two hours, so reports can't be made up without loading the video. A playback starts when Fileboy first hears of it, not when the player says. One address can start at most 60 playbacks of a video an hour, and 300 of an app's videos (counted by each API server, so a little more where several share the load). Batches without a ticket, from players before 1.9.0, are still counted until 1 February 2027, with a lower limit of 30 an hour: update the player to keep counting after that.

A video can start at most 20,000 playbacks with their own records a day, and an app 100,000. Past that, a playback's plays and watch time are still added (overflowPlays), but it isn't counted as a view or in the averages, retention or quality figures.

A private, password or signed-URL video counts only views from players that may play it: each batch carries the player's signed query (signed-query), checked like every read of the video. The endpoint answers 204 to every well-formed batch, counted or not, so it never says whether a video exists.

Only the Fileboy player reports viewing. Other HLS or DASH players, and the dashboard's own preview, don't. A video's playCount (the views on its watch page and dashboard page) counts the same views as they happen, without waiting for the roll-up; loading a video without playing it adds nothing.

Read them in code

Every library has both reads. They need the app's private key, or a scoped key with videos:read.

// views, watch time, retention and CTA clicks (private key, or videos:read)
const a = await fileboy.getVideoAnalytics(video.id, { from: "2026-11-01", to: "2026-11-18" })
a.totals.views // also uniqueViewers, watchSeconds, averagePercentWatched, completionRate, ctaClicks
a.retention?.buckets // 100 percentages: of the views, how many watched each hundredth

const app = await fileboy.getVideosAnalytics({ sort: "watchSeconds", limit: 5 })
app.videos[0].name

Turn it off

Set analytics="off" on a <fileboy-player> (1.8.0 and later) and it loads and sends nothing for analytics. The player doesn't read Do Not Track or Global Privacy Control itself, as nothing it sends identifies a viewer who isn't signed in; your page can, and turn analytics off when they are set:

HTML
1
2
3
4
5
6
7
8
<fileboy-player video-id="VIDEO_ID" analytics="off"></fileboy-player>

<script>
  // Honour Global Privacy Control or Do Not Track on your own pages, if you choose to
  if (navigator.globalPrivacyControl || navigator.doNotTrack === "1") {
    document.querySelectorAll("fileboy-player").forEach(p => p.setAttribute("analytics", "off"))
  }
</script>

The analytics code is its own chunk of under 2 KB, loaded on the first play. See Play a video for the other attributes.

Get a video's analytics

Totals and one row per day from from to to (at most 366 days, days with nothing are zeroes), the retention curve of the version the video plays now, or of version, and the quality of experience (qoe: totals and a row per day). averageViewSeconds, averagePercentWatched and completionRate are null with no views; retention is null when that version has no views in the range; with no version given and no curve for the current one yet (a blur, say, makes a new version), it is the newest version's that has one, and retention.version says which. retentionVersions lists the versions with a curve, newest first. The qoe figures are null on days without sessions from a player that reports them. sources (up to 20) and countries (every one with views) are the views by where they came from and by country, most first; countriesAvailable is false where countries aren't set up, and countriesAttribution is MaxMind's attribution to show with them. viewers is who watched: up to 50 signed-in viewers, the latest first, with viewersTotal for them all (see Viewers and sources). 404 video_not_found. Scope videos:read.

GET
1
https://api.fileboy.io/videos/:id/analytics

URL Params

id string

The video's id.

Query Params

from string, optional

The first day, YYYY-MM-DD (UTC). Default: 29 days before to.

to string, optional

The last day, YYYY-MM-DD. Default: today.

version number, optional

The version whose retention curve to return. Default: the current one.

Example

REQUEST
1
curl "https://api.fileboy.io/videos/9b1c4d1e-5c1e-4b8e-9d57-3f0a4f1a7c10/analytics?from=2026-10-20&to=2026-11-18" -H "Authorization: token 0000000...."
RESPONSE
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
{
  "data": {
    "videoId": "9b1c4d1e-5c1e-4b8e-9d57-3f0a4f1a7c10",
    "from": "2026-10-20",
    "to": "2026-11-18",
    "version": 2,
    "duration": 184.2,
    "totals": {
      "plays": 412,
      "views": 368,
      "uniqueViewers": 301,
      "watchSeconds": 39310.5,
      "averageViewSeconds": 106.8,
      "averagePercentWatched": 61.4,
      "completions": 129,
      "completionRate": 35.1,
      "ctaClicks": 22,
      "overflowPlays": 0
    },
    "days": [
      { "date": "2026-10-20", "plays": 9, "views": 8, "uniqueViewers": 8, "watchSeconds": 803.2,
        "averagePercentWatched": 58.1, "completions": 2, "ctaClicks": 0 },
      ...
    ],
    "retention": {
      "version": 2,
      "duration": 184.2,
      "views": 240,
      "buckets": [100, 99.6, 98.8, ..., 31.2]
    },
    "retentionVersions": [2, 1],
    "updatedAt": "2026-11-18T06:55:00Z",
    "qoe": {
      "sessions": 355,
      "startupTimeMedian": 0.84,
      "startupTimeP90": 2.31,
      "rebufferRatio": 0.42,
      "rebufferSessionRate": 6.8,
      "rebuffers": 41,
      "rebufferSeconds": 151.6,
      "errorRate": 0.8,
      "errorSessionRate": 3.1,
      "averageRenditionHeight": 812,
      "topErrors": [
        { "code": "hls_network", "sessions": 8, "fatalSessions": 1 },
        { "code": "media_decode", "sessions": 2, "fatalSessions": 2 }
      ],
      "days": [
        { "date": "2026-10-20", "sessions": 8, "startupTimeMedian": 0.9,
          "rebufferRatio": 0, "errorRate": 0 },
        ...
      ]
    },
    "sources": [
      { "kind": "embed", "host": "shop.example", "views": 201, "watchSeconds": 22104.3 },
      { "kind": "referrer", "host": "news.example", "views": 88, "watchSeconds": 8610.0 },
      { "kind": "direct", "host": null, "views": 61, "watchSeconds": 6022.7 },
      { "kind": "share_link", "host": null, "views": 18, "watchSeconds": 2573.5 }
    ],
    "countries": [
      { "country": "GB", "views": 190 },
      { "country": "US", "views": 102 },
      ...
    ],
    "countriesAvailable": true,
    "countriesAttribution": "This product includes GeoLite2 data created by MaxMind, available from https://www.maxmind.com.",
    "viewers": [
      { "kind": "user", "name": "ada@example.com", "userId": "0c8a…", "views": 2,
        "watchSeconds": 296.1, "percentWatched": 100, "completions": 1,
        "lastWatchedAt": "2026-11-18T06:21:40Z" },
      { "kind": "app_user", "name": "Grace Hopper", "userId": null, "views": 1,
        "watchSeconds": 138.2, "percentWatched": 75, "completions": 0,
        "lastWatchedAt": "2026-11-17T15:02:11Z" }
    ],
    "viewersTotal": 2
  }
}

Get your videos' analytics

Every video of the app together, per day, the top videos by a figure, the quality of experience of all of them (qoe), and their sources and countries as for one video. Unique viewers here count a person once a day across all your videos; they are null for a range that reaches back more than 90 days (the viewer hashes are kept 90 days). Scope videos:read.

GET
1
https://api.fileboy.io/analytics/videos

Query Params

from string, optional

The first day, YYYY-MM-DD (UTC). Default: 29 days before to.

to string, optional

The last day, YYYY-MM-DD. Default: today.

sort string, optional

views (the default), watchSeconds, completions or ctaClicks.

limit number, optional

Top videos, 1 to 100, default 10.

Example

REQUEST
1
curl "https://api.fileboy.io/analytics/videos?sort=watchSeconds&limit=5" -H "Authorization: token 0000000...."
RESPONSE
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
  "data": {
    "from": "2026-10-20",
    "to": "2026-11-18",
    "sort": "views",
    "totals": { "plays": 1203, "views": 1088, "uniqueViewers": 702, ... },
    "days": [ ... ],
    "videos": [
      { "videoId": "9b1c4d1e-5c1e-4b8e-9d57-3f0a4f1a7c10", "name": "Launch day", "duration": 184.2, "plays": 412,
        "views": 368, "uniqueViewers": 301, "watchSeconds": 39310.5,
        "averagePercentWatched": 61.4, "completions": 129, "completionRate": 35.1,
        "ctaClicks": 22 }
    ],
    "updatedAt": "2026-11-18T06:55:00Z",
    "qoe": { "sessions": 1050, "startupTimeMedian": 0.79, ... },
    "sources": [ { "kind": "embed", "host": "shop.example", "views": 640, ... }, ... ],
    "countries": [ { "country": "GB", "views": 512 }, ... ],
    "countriesAvailable": true,
    "countriesAttribution": "This product includes GeoLite2 data created by MaxMind, available from https://www.maxmind.com."
  }
}

Report viewing (players)

What the Fileboy player sends, documented for other players. JSON in a text/plain body (so sendBeacon works and no preflight is needed), at most 16 KB. session and ticket are analytics.session and analytics.ticket from GET /videos/:id/data (one session per ticket; get the data again for another); seq counts up from 1 per session (a batch it has had is ignored); version is the video's version; played is seconds since the last batch (0 to 3,600); watched is up to 200 [start, end) ranges of whole seconds; events up to 50 of start, pause, seek, ended or cta (others are ignored); t is seconds since the session began (a hint only). With qoe: 1, also: startup (seconds to the first frame, once), rebuffers and rebuffered (stalls and their seconds since the last batch), errors (up to 10 of { code, fatal }) and renditions (up to 10 [height, seconds]); these are clamped, never refused. From 1.17.0: page (the host the player is on; in an iframe, the site framing it; the request's Origin wins when it is another site), ref (the referrer's host), and for a signed-in viewer viewer (their viewer session) or viewerToken (your viewer token); one that doesn't check out is ignored and the batch counts anonymously. Add the video's signed query for a private video. Answers 204, or 400 validation_error, 413 or 429 rate_limited; a batch with a wrong ticket, or the first batch of a playback whose ticket is over two hours old, gets 204 and isn't counted (later batches of a playback already going still count). No key.

POST
1
https://api.fileboy.io/videos/:id/views

URL Params

id string

The video's id.

Example

REQUEST
1
2
3
4
5
6
curl -X POST "https://api.fileboy.io/videos/9b1c4d1e-5c1e-4b8e-9d57-3f0a4f1a7c10/views" -H "Content-Type: text/plain" -d '{"session":"q3J9xV0bT1mZ8aP4cW2nLg","ticket":"v1.1795011461.Xb3…","seq":2,
       "version":1,"played":9.75,"watched":[[0,10]],
       "events":[{"type":"pause","at":9.75}],"t":12,
       "qoe":1,"startup":0.84,"rebuffers":1,"rebuffered":1.2,
       "errors":[{"code":"hls_network","fatal":false}],"renditions":[[720,9.75]],
       "page":"shop.example","ref":"news.example"}'
RESPONSE
1
204 No Content

Related guides