-
-
Notifications
You must be signed in to change notification settings - Fork 652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A Cloudflare Worker to handle requests to static.pantsbuild.org. #18685
Conversation
The worker logs the requests with both Google Analytics 4 and Universal Analytics, and then redirects to pantsbuild.github.io. The UA code is the current code we've been using for the last few years, but which we previously didn't check in to the repo. Google is phasing out UA, which is why we now add GA4 support. Once both have overlapped successfully for a while, we'll shut down the UA side. I've manually tested this code and verified that requests show up in both GA4 and UA as expected, and that the right content is returned.
} | ||
|
||
// UA is being phased out in mid-2023, so we'll delete this once we have GA4 set up properly. | ||
function sendToUA(headers, host, path) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The repetition, or near-repetition, is by design, so that we can easily delete this function after a suitable period of overlap.
userAgent = "" // GA accepts an empty user agent, go figure. | ||
} | ||
|
||
data = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The GA4 protocol is very different from the UA one, but we've been using UA for a long time, and I've verified that the GA version is correct.
You can add a |
Oh, excellent idea! |
Done |
Internal changes: * refactor `package_python_dist` rule so most of the logic can be reused ([pantsbuild#18701](pantsbuild#18701)) * A Cloudflare Worker to handle requests to static.pantsbuild.org. ([pantsbuild#18685](pantsbuild#18685)) * No need to use lambda when setting help text for ruff ([pantsbuild#18690](pantsbuild#18690)) * Lint fixes - suggested by ruff and flake8 ([pantsbuild#18681](pantsbuild#18681)) * Skip flaky pantsd integration tests. ([pantsbuild#18665](pantsbuild#18665)) * Add types-beautifulsoup4 to default module mapping ([pantsbuild#18647](pantsbuild#18647)) * Prepare the 2.16.0rc0 release. ([pantsbuild#18645](pantsbuild#18645)) * Prepare the 2.14.2rc1 release. ([pantsbuild#18646](pantsbuild#18646)) * Prepare the 2.15.1rc1 release. ([pantsbuild#18644](pantsbuild#18644))
Internal changes: * refactor `package_python_dist` rule so most of the logic can be reused ([#18701](#18701)) * A Cloudflare Worker to handle requests to static.pantsbuild.org. ([#18685](#18685)) * No need to use lambda when setting help text for ruff ([#18690](#18690)) * Lint fixes - suggested by ruff and flake8 ([#18681](#18681)) * Skip flaky pantsd integration tests. ([#18665](#18665)) * Add types-beautifulsoup4 to default module mapping ([#18647](#18647)) * Prepare the 2.16.0rc0 release. ([#18645](#18645)) * Prepare the 2.14.2rc1 release. ([#18646](#18646)) * Prepare the 2.15.1rc1 release. ([#18644](#18644))
The worker logs the requests with both Google Analytics 4 and Universal Analytics, and then redirects to pantsbuild.github.io.
The UA code is the current code we've been using for the last few years, but which we previously didn't check in to the repo.
Google is phasing out UA, which is why we now add GA4 support. Once both have overlapped successfully for a while, we'll shut down the UA side.
I've manually tested this code and verified that requests show up in both GA4 and UA as expected, and that the right content is returned.