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 on `/_vercel/insights/script.js` #49

Closed agurtovoy closed 1 year ago

agurtovoy commented 1 year ago

Firstly, thank you for offering built-in analytics support, this by itself makes it worth upgrading to Pro for me!

I followed the steps in the Audiences Quickstart Guide, including redeployment, but I'm still getting 404 on a GET for /_vercel/insights/script.js:

... and, consequently, my production dashboard shows 0 visitors:

Interestingly enough, my preview deployments don't have this issue and are actually able to track visitors, but I think it's because they are doing it through a slightly different mechanism:

I saw that https://github.com/vercel/analytics/issues/1 was confirmed as resolved by people who were experiencing it earlier, so thought I'd open a new issue.

tobiaslins commented 1 year ago

Hey @agurtovoy! I just looked into this, it seems like you did deploy to production before analytics got enabled. Can you please try redeploying production and check if its working afterward.

Thanks :)

agurtovoy commented 1 year ago

Hey @tobiaslins, thanks so much for the quick response!

Redeployment did fix this, and I think I know what I did wrong: I redeployed after enabling Vercel Analytics, which is the prompt that is shown by default when you click on a project's Analytics tab, but I guess one also needs to redeploy after enabling Audiences.

The docs say as much, but, unlike the Vercel Analytics dialog, there is no explicit "Redeploy" button when you enable Audiences, so if you add this package first and then enable Audiences, you'll get a 404:

Vercel Analytics prompt Audiences prompt

It's definitely a user error, but perhaps there is something you could do with the UX to make this more clear.

Thanks again for the prompt reply!

tobiaslins commented 1 year ago

Thank you for the feedback! We're currently improving the setup flow because it can be confusing at the moment!