Open westonruter opened 4 months ago
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.
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.