Advanced Web Analytics Config with @vercel/analytics
To get started with analytics, follow our Quickstart guide which will walk you through the process of setting up analytics for your project.
Override the automatic environment detection.
You can manually disable it to prevent debug messages in your browsers console.
With the option, you can modify the event data before it's sent to Vercel. Below, you will see an example that ignores all events that have a inside the URL.
Returning will ignore the event and no data will be sent. You can also modify the URL and check our docs about redacting sensitive data.
The option allows you to report the collected analytics to a different url than the default: .
This is useful when deploying several projects under the same domain, as it allows you to keep each application isolated.
For example, when is managed outside of Vercel:
- "alice-app" is deployed under , vercel alias is
- "bob-app" is deployed under , vercel alias is
- is routed to
Both applications are sending their analytics to . To restore the isolation, "bob-app" should use:
The option allows you to load the Web Analytics script from a different URL than the default one.
Was this helpful?