Closed samuelcole closed 1 year ago
Hey @samuelcole! Have you enabled audiences in the dashboard for that domain? -> https://vercel.com/docs/concepts/analytics/audiences/quickstart
What's the basePath
of your project?
Thanks!
so this app, directory
has the basePath
of /directory
foodhelpline.org
is managed by another app, foodhelpline
, which does not have analytics enabled at all. i would prefer not to have analytics enabled for both apps, but maybe you're saying it's required to have analytics enabled on the domain level as well as the project level?
You could maybe add a rewrite to vercel.json
or next.config.js
that proxies
/_vercel/insights/script.js
to the subpath? Where is you're project with basePath
accessible?
This is an issue for my team as well. We have basePath: '/collection'
, but <Analytics />
requests /_vercel/insights/script.js
, not /collection/_vercel/insights/script.js
.
We fixed it by proxying all /_vercel
traffic to the appropriate app, but that is configured externally.
What is interesting though is that it is available under /collection/_vercel
, it's just not being requested there.
Have there been any updates to this? We're about to be expanding into more of a multi-tenant setup and can't have the Vercel Analytics script loading from the same /_vercel
route for 3 applications.
Hey @gsheppard !
You can use the HTML integration to inject the script with a custom path + custom endpoint (instead of using inject
or <Analytics />
For example:
<script data-endpoint="/blog/_vercel/insights" src="/blog/_vercel/insights/script.js" defer></script>
We will add support for the package later on.
Let me know if that helps!
if i'm reading this line correctly: https://github.com/vercel/analytics/blob/5e3051aec49572a52b0688285a8349c6f5f51d0f/packages/web/src/generic.ts#L24
it does not consider the
basePath
of the vercel project, which results in 404s in my production application