Closed officert closed 5 months ago
Hey!
You can already overwrite both the script and endpoint
scriptSrc
and endpoint
https://github.com/vercel/speed-insights/blob/main/packages/web/src/types.ts#L9
Let me know if that works for you!
@tobiaslins thank you!
I posted in the vercel analytics project too: https://github.com/vercel/analytics/issues/139
but looks like the analytics project doesn't support the same endpoint
and scriptSrc
params.
I'm closing this ticket, feel free to re-open in case of need!
I'm using Vercel
speed-insights
andanalytics
with NextJS. However, our sites are behind a cloudflare proxy, where clients can point any path they want off their domain to our NextJS app. Ex:https://foobar.com/shop -> proxy to our NextJS app
Our NextJS then rewrites the incoming urls to map them to the folder structure of our NextJS app.
When using
speed-insights
the request for the Javascript file always points tohttps://foobar.com/_vercel/speed-insights/script.js
, which returns a 404 because we don't control that path on their domain.I was able to get around this by using the HTML version, and our
process.env.ASSET_PATH
like this:so that the script is served up from our Vercel provided domain name.
This works, however, all the tracking events are still pointing to
https://foobar.com/_vercel
.Is it possible to have both the script tag and the tracking event use the
process.env.ASSET_PATH
if one is set? Or at least have a way to configure wherespeed-insights
send the tracking events?