-
-
Notifications
You must be signed in to change notification settings - Fork 215
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 Web Vitals information using web-vitals.js #765
base: develop
Are you sure you want to change the base?
Add Web Vitals information using web-vitals.js #765
Conversation
Does this auto run, or wait to be requested? If it auto runs, can we please include a way to disable it from auto running? I'm certainly not interested in this running on every page load. |
@adamsilverstein Can you please respond to my previous comment?
|
Hi @crstauf Good question (just saw it now)! Turns out, this was enqueueing on every page load which seems excessive (even though the actual impact is very low). I pushed an update (0aaf299) so that it only runs when the admin-bar is showing which means only when you are logged in. I think this makes sense, since you need the admin-bar to access QM anyway, right? Does this address your concern about running on every page load? Note: also move the enqueue to the footer, and will add "defer" once 6.3 ships and this is part of the Script API. The script doesn't need to load early to work ref Looks like QM queues up a bunch of stuff regardless, so I assume it is best practice to not run QM in production? |
@adamsilverstein I was thinking a constant or filter to enable the panel: running a performance evaluation on every request is unnecessary, even if it's impact is low. |
Sounds reasonable - I'll leave that suggestion up to @johnbillion. Small clarification on the operation: the script doesn't actually run any additional performance evaluation, instead the script uses the performance observer API to show information that the browser performance APIs have already collected (see ref). So the impact is really just the overhead of loading the script itself which is why I said it is minimal. (Not disagreeing that it should only be enqueued when needed!) |
Oh? The browser has already done the evaluation, all the script does is get the info from the browser? Fascinating. That resolves my concern then. May be smart to have a default output, waiting for the info to populate, as well as a situation where |
|
@adamsilverstein Submitted PR for the notice and handling missing |
Thanks @crstauf! will review. |
Add waiting notice and support missing `web-vitals` script
merged, thanks! Still awaiting review from @johnbillion :) |
Thanks for the reminder! I've put a temporary pause on new features until the spring. |
Happy spring! 💐 @johnbillion 💐 I realize you may be busy with the rewrite you mentioned, let me know if you can use some help or testing there. I updated the PR here with the latest |
@johnbillion have you resumed working on the plugin? If so, I would appreciate any feedback on this PR. |
In general, I like this. I think it's a very neat addition. I will try to find some time in the next few weeks to do a proper review 👍 |
This PR aims to address #714.
Here is what I have so far -
To use this on the front end, you need to have the wp-admin toolbar enabled, then open query monitor to the Web Vitals tab and reload the page. You will now see the initial metrics:
Once you interact with the page, you will see LCP and FID appear:
Some ideas to measure INP and CLS would be:
We could also leave these off for now and work on adding them in a follow up change. What do you think @johnbillion?