Comments (6)
The curly brace is being added by another analytics package (matomo). Maybe it could be encoded, but as far as I can tell, urls with curly braces in the query strings are still valid. The page doesn't seem to have a problem loading, so it seems odd that vercel analytics would decide that our url is invalid.
I agree double-encoding the url isn't the right answer, but the real problem is that the analytics api gives a 400 on a valid url because the uri validator is not conforming to the url spec. https://url.spec.whatwg.org/#query-percent-encode-set A fix to that validator should resolve this issue.
from analytics.
I think that
body: JSON.stringify(encodeURI(f))
should solve this issue,
f
is an object here. Perhaps you meant f.o = encodeURI(f.o);
?
from analytics.
Hey @danielcliu-ifixit!
I don't think that we should use encodeURI
in our script because if params are already encoded (as they should be in the URL) we would double encode them. For example when I search on ifixit.com for {
the location is https://www.ifixit.com/Search?query=%7B
and when we would use encodeURI
it would be https://www.ifixit.com/Search?query=%257B
so the actual value would not be recoverable easily.
My question is: why do you have the unencoded character in the URL in the first place?
One possible solution would be to use beforeSend
in the script to encode the params before sending them.
<Analytics beforeSend={(event) => {
if(event.url.includes("exampleVercelError") {
return {
...event,
url: encodeURI(event.url)
}
}
return event;
}
} />
Let me know what you think!
from analytics.
Thanks for bringing that up.
We just deployed a fix for that and you should now not see any 400's anymore. Let me know if you can confirm @danielcliu-ifixit
from analytics.
actually i think
f = {
o: encodeURI(d),
sv: "0.1.2",
sdkn: null != (r = null == t ? void 0 : t.getAttribute("data-sdkn")) ? r : void 0,
sdkv: null != (l = null == t ? void 0 : t.getAttribute("data-sdkv")) ? l : void 0,
ts: Date.now(),
...null != a && a.withReferrer && !s ? {
r: u
} : {},
..."event" === i && o && {
en: o.name,
ed: o.data
}
};
would be best
from analytics.
@tobiaslins thanks for the fix! My issue seems to be resolved.
from analytics.
Related Issues (20)
- Error 400 when using analytics/server track in server actions HOT 2
- Vercel build failed with Turborepo and multiple apps deployed HOT 5
- Vercel Analytics Endpoints HOT 1
- Docs: Specify if `track` runs in development mode or not HOT 1
- Page changes are no longer tracked in SvelteKit 2 HOT 9
- Feature Request: Allow nonce as optional prop in analytics component for content security policy HOT 1
- Integration with Docusaurus HOT 1
- Module resolution warnings under Yarn PnP: `Unable to resolve path to module '@vercel/analytics/react'.eslintimport/no-unresolved` HOT 5
- City-Level analytics HOT 3
- CJS files are missing in 1.2.0 HOT 10
- Feature request: Exports HOT 3
- Cannot install the latest version of `@vercel/analytics` with `[email protected]` HOT 2
- Vercel Analytics being blocked by AdBlockers HOT 1
- SvelteKitError: Not found: /_vercel/insights/script.js with playwright/test HOT 2
- Use process.env.ASSET_PREFIX when sending tracking data #63 HOT 1
- Version Compatibility
- CORS errors HOT 1
- script.js doesn't load with Next.js Dyamic Routes? [Error on build only] HOT 2
- unclear how to view and export custom events + properties? HOT 1
- Access-Control-Allow-Origin header won't attached when reverse-proxying
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from analytics.