Replies: 1 comment 2 replies
-
@anaclumos the good news is my own website https://thisweekinreact.com/ is on Vercel and I plan to add it for myself :) I guess it could be possible to build a Vercel plugin that declares a client module: https://docusaurus.io/docs/advanced/client#client-modules import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
if (ExecutionEnvironment.canUseDOM) {
reportWebVitals()
} Not sure it's the correct place to report though, this would likely run before React hydrates. May be better to report in Let me know if that works for you. We officially support/document Vercel/Netlify in core in an opinionated way so it could make sense to have an official Vercel plugin |
Beta Was this translation helpful? Give feedback.
-
Has anyone tried using Vercel Analytics with Docusaurus?
To use Vercel Analytics API, it seems like we need to embed a TS/JS code that will always run on page load; where would a suitable location in Docusaurus be? Also, it should be a position where the
document
is defined.Any recommendations?
Below is an example of using Vercel Analytics with a simple React App. Unfortunately, I couldn't find the equivalent of Docusaurus — maybe it involves touching the
docusaurus/core
, but it seems that is untouchable (no swizzling or modification whatsoever.)Beta Was this translation helpful? Give feedback.
All reactions