-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Vercel analytics file missing #6230
Comments
(I may be wrong) I'm feeling that this issue is about this specific loc from From my understanding, Vercel should add this script (see the "else" part of the ternary above) but for some reasons, it does not 🤔 Have you tried enabling analytics and the re-building (without cache)? |
I had to also enable "Audiences" in the Vercel Analytics settings and redeploy. Now the script.js gets added. |
Could it be that for Web Vitals you don't need to add anything to your Astro setup? That the analytics package is only needed for the audiences feature? |
@fschroiff I see the script loading successfully on your site: It could be that you have a browser extension that blocks tracking scripts? I also see a 404 when enabling Ghostery as Ghostery recognises Vercel’s analytics scripts and blocks it. Locally this script is not available though as it is injected by Vercel (and you probably don’t want to collect analytics from local development). Maybe we should avoid injecting the analytics script during development? |
@delucis After enabling "Audiences" analytics in the Vercel dashboard and redeploying without cache everything worked as expected. Theres two types of analytics in Vercel: "Web Vitals" and "Audiences". For the "Web Vitals" you don't need to install this analytics package at all. For "Audiences" you need this package. I thought the analytics package was needed for "Web Vitals" as well. This is not the case. So what happened was: I installed the analytics package and activated "Web Vitals". The package adds the link to script.js, but as I have not activated "Audiences" Vercel has not added the script.js file. Hence the error. Could you make the analytics package add the script.js file only when "Audiences" is active? I guess it would be better/ easier to tweak the docs a bit. |
I don’t think we can know if a deployment has “Audiences” enabled or not but can definitely document that you need to manually enable it. 👍 |
What version of
astro
are you using?2.0.10
Are you using an SSR adapter? If so, which one?
Vercel
What package manager are you using?
npm
What operating system are you using?
Mac
Describe the Bug
On my site https://www.fsch.ro I get a 404 on the file
/_vercel/insights/script.js
.also when building locally I don’t see the script.js file.
This is my config:
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-4s4gze?file=package.json
Participation
The text was updated successfully, but these errors were encountered: