ProjectsAudio

Podcast hosting with fair download counts

Episodes served from R2, with downloads counted once per listener per day

Example design

  1. 01Fetch the feedApps poll the RSS feed. The Worker serves it from cache, and new episodes appear when the feed is rebuilt.
  2. 02Episode requestThe app requests the episode MP3 from the URL in the feed, often with a byte range.
  3. 03Log itThe Worker writes a data point with the episode, a hash of the IP address and user agent, the range, and the country.
  4. 04Serve the rangeIt streams the file from R2, honouring the byte range so apps can seek and resume.
  5. 05Nightly countA scheduled Worker queries Analytics Engine with SQL, collapses repeat requests from the same listener in a day, drops known bots, and stores the daily totals in D1.
  6. ifAn episode goes viralR2 has no egress fees, so a spike costs Worker requests and R2 reads. The counting rules mean the spike is reported as listeners, not as requests.

The problem

Podcast apps request the same episode many times: to resume, to seek, and to download in pieces. Counting raw requests inflates the numbers, and sponsors know it. The usual standard, the IAB Tech Lab's podcast measurement guidelines, counts repeat requests from the same listener within a day as one download and excludes known bots. A Worker in front of R2 can log every request, and a nightly job can apply those rules.

What it uses

R2
Audio files and artwork
Workers
Feed, delivery and request logging
Analytics Engine
The raw request log, queried with SQL
Cron Triggers and D1
The nightly count and the long-term totals

The decisions, and why

CountingOne per listener per day
This follows the IAB Tech Lab guidelines that sponsors and ad networks expect.
PrivacyIP address hashed before writing
The count needs to tell listeners apart, and it does not need to know who they are.
SamplingWeighted by the sample interval
Analytics Engine samples data at very high volumes, so counts are weighted by the interval it records against each row.
HistoryDaily totals in D1
Analytics Engine keeps data for three months, and sponsors ask about last year.

Limits to plan around

  • Analytics Engine keeps raw data for three months.
  • At very high volumes Analytics Engine samples, so totals are estimates weighted by the sample interval.
  • A data point holds up to 20 text fields and 20 numbers.

What you get

  • Worker for feeds, delivery and logging
  • Nightly counting job and D1 schema
  • Download report by episode, country and app
  • Feed migration from your current host, with redirects
  • Tests for the counting rules

Talk about your video project

Tell us what you are building, or what is not working in the platform you have.

Registered office
VI Data Services Ltd
128 City Road, London, EC1V 2NX, United Kingdom
Telephone

020 8058 7616

Company number

17420568
Registered in England and Wales