Can we exclude the user-agent “Chrome-Lighthouse” from crawlers and thereby show Lighthouse the real application view?
This enables Lightouse in Chrome DevTools and PageSpeed Insights to measure the performance of Discourse like viewed by an user.
Until now Lighthouse measured the performance for an user-device which is rendering the crawler-layout - this never happens in reality.
When they run those lighthose performance tests on a recent iPhone model (even an iPhone 8 or later), I am open to this. Right now android performance is 3x (or more) slower than iPhone unfortunately.
Until they run lighthouse on an iPhone (any model) for context, I am absolutely opposed to any change here. When they do, I will happily accept the PR, with gusto.
For their metrics they are already collecting “real-user experience data” (CrUX dataset) from ~200 EUR/USD Android phones running Chrome - and this data gets into the Core Web Vitals report on Google Search Console.
How about putting this behind a flag or enable it for development environments only?
You can run lighthouse with a custom user agent from your machine to get the SPA perf numbers.
For this solution to measure the intended Discourse view:
- mobile-view: add
?mobile_view=1 to the url
- desktop-view: add
?mobile_view=0 to the url
This setting is remembered in LocalStorage. So reset it once if necessary:
?mobile_view=auto to the url.