The product question
A Twitch raid sends viewers from one channel to another. The arriving audience creates a visible spike, but a streamer also wants to understand what happens afterwards. I added raid events and audience comparisons to StreamHound to make that change easier to inspect.
Connect an event to a time series
The backend records a raid with its timestamp and reported audience size. The stream dashboard combines that event with timestamped viewer-count samples. The interface can then place the raid alongside the audience curve.
I implemented the event handling, stored raid model, API response and Vue presentation as parts of the same feature in January 2026. Later that month, I extended the presentation to explore relationships between channels through incoming and outgoing raids.
Calculate the estimate
For each raid, the calculation finds the sample closest to its timestamp. The previous sample supplies a baseline. When a previous sample is unavailable, the calculation estimates the baseline from the current count and the raid’s reported size, bounded at zero.
For checkpoints at 5, 10, 30 and 60 minutes, it selects the first available sample at or after the checkpoint. It subtracts the baseline from that viewer count, then divides the difference by the raid’s reported size to calculate a percentage.
For example, a baseline of 80 viewers and a later sample of 110 produce a gain of 30. For a raid reported as 50 viewers, the estimate is 60%. These numbers are illustrative.
What the estimate can support
The result measures the change in total audience relative to the baseline. Independent arrivals and departures affect it. Another raid can overlap the same period. Sampling frequency also affects which moment is represented by a checkpoint.
The implementation allows negative changes and values above 100%. It also returns zero when a checkpoint sample is unavailable. When interpreting the chart, missing observations therefore need particular care. The code demonstrates the calculation, while accurate claims about individual viewer retention would require different evidence.
Keeping collection observable
The analytics depend on background workers and external API calls. In the same period, I worked on Redis-backed request limiters, staggered collection startup and queue monitoring. Those tools expose the collection process when the dashboard needs investigation.