Files
next.js/errors
821849261d Deprecation warning for config.analyticsId (#60677)
### ย ๐Ÿง What's in there?

`config.analyticsId` is a rarely-used mechanism, initially intended to
Next.js users hosting their application themselves and willing to report
Core Web Vitals to Vercel Speed Insights.

This platform specific mechanism can be replaced with the built-in
[`useReportWebVitals`](https://nextjs.org/docs/app/api-reference/functions/use-report-web-vitals).

### ๐Ÿงช How to test?

1. make a new Next.js app
1. define env variable `VERCEL_ANALYTICS_ID` to a dummy value
1. start your application in dev mode:
   ```shell
โš  config.analyticsId is deprecated and will be removed in next major
version. Read more:
https://nextjs.org/docs/messages/deprecated-analyticsid
   
      โ–ฒ Next.js 14.0.5-canary.58
      - Local:        http://localhost:3000
    โœ“ Ready in 917ms
   ```
1. build your application:
   ```shell
      โ–ฒ Next.js 14.0.5-canary.58
   
      Creating an optimized production build ...
    โœ“ Compiled successfully
      Linting and checking validity of types  .
โš  The Next.js plugin was not detected in your ESLint configuration. See
https://nextjs.org/docs/basic-features/eslint#migrating-existing-config
    โœ“ Linting and checking validity of types
    โœ“ Collecting page data
    โœ“ Generating static pages (4/4)
โš  `config.analyticsId` is deprecated and will be removed in next major
version. Read more:
https://nextjs.org/docs/messages/deprecated-analyticsid
    ```
1. remove the env variable, add a `next.config.js` file with a dummy
`analyticsId` variable:
   ```js
   module.exports = { analyticsId: "UA-12345678-9" };
   ```
1. start your application in dev mode: it'll issue the same warning.
1. build your application: it'll issue the same warning.

---------

Co-authored-by: Tim Neutkens <[email protected]>
2024-01-19 14:45:05 +01:00
..