-
Notifications
You must be signed in to change notification settings - Fork 107
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
Add ability to prime URL metrics across a site upon installation of Optimization Detective #1311
Comments
This would be cool to implement as a CLI tool as well, using Puppeteer. |
This would make sense to do in a hidden iframe in the post editor screen whenever a post has been updated. This would not require any new UI (which we've avoided until now) and it would ensure that posts get fresh URL metrics immediately. |
This would address the issue where someone blocks the REST API for authenticated requests. |
For very high traffic sites, this could be an alternative to collecting URL Metrics from visitors. See #1655. |
I've been working on a proof of concept (POC) for priming URL metrics and wanted to share an update and gather your thoughts on it. Current ImplementationThe POC uses URLs from WordPress sitemaps, fetched in batches. Breakpoints are calculated on the backend with simple logic: the height for each breakpoint is based on its width and the min/max aspect ratios.
These are placeholder settings for now and can be adjusted as needed. The
Parent-iframe communication uses Handling URLsThe
While this works for now, maybe a nonce would be a more secure approach. On the backend, the Demood-demo.mp4Note: To aid debugging, the current status of the processing URL, breakpoint dimensions, and the iframe are currently visible. These could be replaced with a progress bar later. This feature can be accessed through a new settings page in the tools. However, we need to discuss the UI design further. @ShyamGadde is also looking into adding a resume feature to skip URLs with completed metrics after a page refresh. |
@b1ink0 awesome!
For initial collection of URL Metrics this makes sense, but for incremental updates in the course of normal operations of a site, it would probably make more sense to prime URL metrics in the background on the post editor screen just for the current post's URL.
Is that necessary? Wouldn't the data be sent when navigating away anyway? For example, once the
At that point, the parent frame would know it is free to continue on to the next URL, allowing it to proceed with sending the metrics.
What feedback is needed?
Yes, a
Since desktop viewport size can be too large to display in the admin, you can consider using a Related: ampproject/amp-wp#4729 and the work that @thelovekesh did in ampproject/amp-wp#4729 (comment) (note the post editor integration, although for the actual implementation no button should be required as it should happen automatically when saving a post) Note also that Optimization Detective is a spiritual descendant of Layout Shift Terminator! |
Feature Description
When activating Optimization Detective, it starts gathering URL metrics from visitors to the site. However, it has a storage locking mechanism to prevent a user (by hashed IP address) from submitting URL metrics once every 60 seconds. Additionally, URL metrics are not collected for administrator users since pages often include additional elements for admins which will make the URL metrics not applicable to non-admins. All this means that if a site does not get much traffic it can take a few days (or longer) to gather enough URL metrics to apply the optimizations. We could speed up this process by providing a way for an administrator to initiate a site-wide collection of URL metrics. A new query parameter could be introduced which (1) loads the page as a non-admin and (2) disables any storage locking for URL metrics. Then given a list of URLs on the site (e.g. from the sitemaps), each one could be loaded up in an iframe for each breakpoint. A progress bar could also be shown. The process could be interrupted at any time, and if the user wants to start again they could either initiate collection only for URLs for which there are no URL metrics gathered or else to start again from scratch.
The text was updated successfully, but these errors were encountered: