Closed M1ck0 closed 1 year ago
Hi there! Mind sharing a preview URL for this?
@timolins
It is currently on my work-in-progress website. Here is the link https://www.miletadulovic.me/
When you do a hard reload Command + Shift + R (Ctrl + Shift + R) while the network tab is open in the console, you'll see script.js
file that is 1.1-1.3 kb heavy and loading for a long time. I just rechecked it, It took 3.57 sec.
This really reduces page speed score on both Vercel analytics, and Google Page Speed analytics. I first wasn't sure from where is this coming, but after disabling Vercel analytics, this file vanished from the network tab.
Here are the headers for this file
Any updates on this? @timolins
@M1ck0 I saw that the script is currently embedded on your page and did several speed score tests (Google Page Speed, etc) and did not see anything poping up because of that longer script load time. (It's async
and soon defer
so will not block anything)
Can you share us some results that shows the script impacts your page?
@timolins Here are the screenshots
Take a look at Time to Interactive and Total Blocking time. The difference is enormous.
Also, look at the treemap, when is the first frame presented to a user?
Are you sure that you can't see anything wrong with this? And let me also say that the page I am testing is just a page with few lines of text, no API calls, no interactions, or anything.
When I removed @vercel/analytics
it was much better. With that package when I try to load the site in incognito, I always see blank (white) screen for like second or two (based on my connection) and then page appears.
Interesting, thanks for investigating! Mind sharing a preview deployment link with us that has Audiences enabled? So we can compare as well.
I'll send you a link in a few hours.
@timolins I added it to the main deployment so you can go check it there.
The initial issue you mentioned appeared to be caused by Cloudflare, which sits in-front of your deployment. We recently switched to a more loose caching policy, allowing Cloudflare to cache the script, which should resolve the issue you mentioned.
To make sure, I made an experiment that compares the Next.js 13 starter in 4 different environments:
A ran this test multiple times and there was no notable difference for environments that had Audiences enabled.
I'll close this issue for now.
It might be worth to experimenting with removing Google Tag Manager as well, which could be the cause of the slow down.
The app is deployed on Vercel normally, but when loading the app, there is a script file that loads for 1+ sec. Here is screenshot
When I removed analytics package, website loaded much faster and FCP was much lower.