vercel / analytics

Privacy-friendly, real-time traffic insights
https://vercel.com/analytics
Mozilla Public License 2.0
422 stars 26 forks source link

HTTP 404 error for /_vercel/insights/script.js #83

Closed michaelcais closed 1 year ago

michaelcais commented 1 year ago

I added the Vercel Web Analytics to my project. I enabled the feature on Vercel project dashboard, installed the package and initialized the package inside my project but I'm getting an HTTP 404 error for /_vercel/insights/script.js. My site is proxied through Cloudflare. Is there any special configuration needed other than what was documented here?

I have automatic deployments to Vercel from Github commits. I have also added in my Content Security Policy the domains;

image
michaelcais commented 1 year ago

I found another closed issue that refers to deployment. I went back to the Vercel Dashboard and redeployed manually the project and this seemed to fix the issue and Web Analytics is now getting data. Is there an issue with automatic deployment from GitHub that I have to manually initiate a redeployment from the dashboard?

Steps I did are the following;

  1. Enabled Web Analytics on Vercel Dashboard
  2. Installed the npm package to my project
  3. Added the Analytics Component to the _app.js document
  4. Committed and pushed to upstream
  5. Project production branch successfully deployed to Vercel
  6. Vercel Dashboard toast message reported not getting any data
  7. Website showed error on the console log, missing _vercel script folder
  8. Went to Vercel Dashboard Deployments and redeployed most recent deployment
  9. Vercel dashboard now shows analytic data
tobiaslins commented 1 year ago

Hey @michaelcais!

The automatic deployment works here as well. The only thing that is important is the order. Web Analytics needs to be enabled before the deployment is started.

Glad that you resolved it!

RylanBot commented 11 months ago

Hi, I enabled Web Analytics before the deployment started, but it still fails to work.

It's been spinning, showing that it's loading.

I use Vue2 to import this dependency, and it seems to work locally.

Hey @michaelcais!

The automatic deployment works here as well. The only thing that is important is the order. Web Analytics needs to be enabled before the deployment is started.

Glad that you resolved it!