fix(download-proxy): Report telemetry per download, not per range - #975
Merged
Conversation
…uest Download managers fetch an installer as several concurrent byte ranges and browsers resume paused downloads with a new Range request; each request emitted its own download_started/download_completed, inflating both ~3x for those clients. Only the request covering byte 0 now starts a download and only the one delivering the last byte ends it; middle segments are logged locally. Every GA4 event also carries an attributed (1/0) param so downloads from browsers that blocked GA (and so never fired download_vpr) are distinguishable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GA4 showed more `download_completed` events than `download_vpr` clicks on ad-wave days. Two causes, one of which is fixable in the Worker:
Changes
Result: an 8-range IDM download yields 1 started + 1 completed instead of 8 + 8; a browser pause/resume yields 1 started, 1 aborted, 1 completed.
Known edge: a Safari-style `bytes=0-1` probe still emits one extra `download_started` (no end event).
After merge
Testing