Livestream: Track usage reliably by user

I’m considering using Cloudflare Stream for a live video streaming service. One critical requirement is that we be able to accurately track usage/minutes viewed by user.


  1. Long running livestreams. Don’t know in advance how long
  2. We will use signed URLs, and will be minting our own
  3. We can’t use the stream player’s analytics because those are client side and easily bypassed - and we may not even be using that player.
  4. We need granular usage data, hopefully down to about 5 minutes.

I was hoping someone might have some ideas. I’ve got two but there are issues with both.

Option 1: Server Side Analytics

There are bulk server-side analytics (${cloudflareDeveloperWebsite}/stream/getting-analytics/fetching-bulk-analytics/#server-side-analytics) via the GraphQL API available that almost are exactly what we need - but on the server side we have no way to filter or group by a user, token, etc. If there was a way to group by a token ID

Option 2: Expiring URLs

We could mint URLs that expire frequently and require the client to ask our service to issue them new ones periodically. Then we can track usage by user ourselves, and untrustworthy clients must check in with us to keep their stream going.

The problem with this one (and I haven’t tried this, but I’m guessing) is that I bet this will cause a noticeable hitch in playback - even if the Stream player lets us swap out the URL transparently.

Option 3: Revoke tokens

Similar to #2, we require clients to check in periodically to keep their stream going, but instead of giving a new token, we revoke tokens for clients that don’t check in with us frequently enough.

There is an API to revoke the signing key (${cloudflareApiWebsite}/#stream-signing-keys-delete-key] - and this could work if we could have a signing key per user. Alas - we are limited to 1000 keys total, and need to support more than 1000 users.

Does anyone have any other ideas of how we could make any of these work, or something else?

Any ideas here? I’m toying around with sticking an authenticating proxy in front of the HLS playlist files, but this feels like hacking around a feature gap/fragile.

Thanks for such a thoughtful writeup! We recently introduced a creator field that can be associated with each video to any arbitrary value and lets you filter analytics by creator. The natural next step is to enable something similar for tracking usage by viewer.

We don’t have an ETA yet for this but it is relatively high on our list of features we can’t wait to ship.

zaid - appreciate the response! Glad to hear it is at least on the radar/backlog somewhere. I’ll stay tuned - we can probably start prototyping without it for now anyway.