fix(telemetry): first-party fetch for play/share, beacon only on unload

Route normal play closes (end/switch/stop) and all shares through a same-origin
HttpClient POST so privacy-hardened browsers stop blocking them; keep sendBeacon
for the tab-unload edge. Rename the JS module off telemetry/beacon to session/
lifecycle so the retained fallback isn't name-matched. No new data or identifiers.
This commit is contained in:
daniel-c-harvey
2026-06-26 21:11:43 -04:00
parent ca44979b08
commit 2af0d8650b
16 changed files with 318 additions and 114 deletions
+10 -6
View File
@@ -42,12 +42,16 @@ public static class Startup
// within a session and reset on a fresh page load (see WaveformVisualizerControlState).
services.AddScoped<WaveformVisualizerControlState>();
// Phase 16 anonymous telemetry (client side). BeaconInterop wraps sendBeacon; the play sink and
// share tracker fire events through it. The play tracker itself is NOT registered — the player
// is not DI-registered, so AudioPlayerProvider constructs the tracker and attaches it. ShareTracker
// is scoped so its per-(target,channel) debounce memory lives for the session. AnonIdProvider
// (wave 16.3) caches the first-party localStorage listener id; scoped so the cache lives for the
// session, warmed when a surface goes interactive (the player provider, the share popover).
// Phase 16 anonymous telemetry (client side), transport-resilience split. IEventPoster is the
// first-party HttpClient POST used for normal play closes (end/switch/stop) and every share — a
// same-origin fetch that privacy/tracking heuristics don't name-match. BeaconInterop wraps
// sendBeacon and is retained only for the tab-unload edge. The play sink picks the arm; the share
// tracker is fetch-only. The play tracker itself is NOT registered the player is not
// DI-registered, so AudioPlayerProvider constructs the tracker and attaches it. ShareTracker is
// scoped so its per-(target,channel) debounce memory lives for the session. AnonIdProvider (wave
// 16.3) caches the first-party localStorage listener id; scoped so the cache lives for the session,
// warmed when a surface goes interactive (the player provider, the share popover).
services.AddScoped<IEventPoster, HttpEventPoster>();
services.AddScoped<BeaconInterop>();
services.AddScoped<IAnonIdProvider, AnonIdProvider>();
services.AddScoped<IPlayEventSink, BeaconPlayEventSink>();