Git Product home page Git Product logo

web-vitals's People

Contributors

atinux avatar ats0405 avatar burda-osowiecki avatar daliborgogic avatar danielroe avatar gerrywilko avatar iranagame avatar mhshakouri avatar pi0 avatar pizzapete avatar renovate[bot] avatar stafyniaksacha avatar vlozanov avatar zitscher avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

web-vitals's Issues

Add INP measurements

INP is added to core web-vitals and will be effective from March 2024, it is a good idea to add support for INP (getINP) to let nuxt developers be more accurate on performance issues.

further more, by the documentation, getCLS/getFCP/getLCP/... etc has changed to onCLS/onFCP/onLCP/... etc.

Accessing app is not supported in Nuxt3

Getting the following error in the console when using this plugin with nuxt 3:

Accessing app is not supported in Nuxt3.
mock @ legacy-app.mjs:4
get @ legacy-app.mjs:88
default @ vitals.client.js:8
(anonymous) @ nuxt.mjs:69
callWithNuxt @ nuxt.mjs:91
applyPlugin @ nuxt.mjs:48
applyPlugins @ nuxt.mjs:57
await in applyPlugins (async)
initApp @ bootstrap.mjs:28
(anonymous) @ bootstrap.mjs:38

And the plugin itself does not work with both vercel and log providers (not tested with google)

Illegal invocation

I just discovered that Vercel is injecting the package @nuxt/web-vitals into my Nuxt app, for speed insights:

Screenshot 2023-12-07 at 14 51 10

Their speed insight stats are great, but I get a lot of "Illegal invocation" errors as a result of this dependency:

TypeError: Illegal invocation
  at send(../../../node_modules/.pnpm/@[email protected]/node_modules/@nuxtjs/web-vitals/dist/runtime/utils.mjs:29:15)
  at sendToAnalytics(../../../node_modules/.pnpm/@[email protected]/node_modules/@nuxtjs/web-vitals/dist/runtime/providers/vercel.mjs:19:3)
  at e(../../../node_modules/.pnpm/@[email protected]/node_modules/@nuxtjs/web-vitals/dist/runtime/web-vitals.mjs:10:25)
  at r(../../../node_modules/.pnpm/[email protected]/node_modules/web-vitals/dist/web-vitals.js:1:1114)
  at <anonymous>(../../../node_modules/.pnpm/[email protected]/node_modules/web-vitals/dist/web-vitals.js:1:6764)
  at sentryWrapped(../../../node_modules/.pnpm/@[email protected]/node_modules/@sentry/browser/esm/helpers.js:90:17)

Any idea how to solve this?

Not sure if this is a bug in this module or on Vercel's side. I also posted it here, to be sure: https://github.com/orgs/vercel/discussions/5105

Vercel analytics "Awaiting data"

Hi

I am not sure the problem is this module, however Vercel refers to this module in their docs.
My problem is, I have enabled Vercel analytics and for a few months I have been getting "Awaiting data".

image

Vercel docs state I don't have to add this module manually, however it does not seem to make it work.
https://vercel.com/docs/analytics

Has anybody got Nuxt and Vercel analytics to work?

Edit: I have been in contact with the Vercel Support team, who tried re-enabling and re-deploying, with no success. They said it might be caused by having set Content Security Policy to disallow vitals.vercel-insights.com - which I have not.

Events not sent to GA, parameters appends together in wrong format

Events not being sent to GoogleAnalytic provider!

When you inspect the request, you will see the URL in the following format:
https://www.google-analytics.com/collect?v=1&t=eventtid=UA-XXXXXXXXX-Xcid=0.883871679636306.0.12895864114226074ec=Web%20Vitalsea=CLSel=v1-1628200888064-2067831876287dl=%2Fdh=https%3A%2F%2Fxyz.com%2Fni=truez=1628200898652

As you can see, the request is invalid since the parameters doesn't implode with & symbol, the following format is expected which is worked:
https://www.google-analytics.com/collect?v=1&t=event&tid=UA-XXXXXXXXX-X&cid=0.883871679636306.0.12895864114226074&ec=Web%20Vitals&ea=CLS&el=v1-1628200888064-2067831876287&dl=%2F&dh=https%3A%2F%2Fxyz.com%2F&ni=true&z=1628200898652

Nothing happens

I connected web-vitals to nuxt3 app using buildModules: [ '@nuxtjs/web-vitals', ], webVitals: { provider: 'log', debug: true, },

But i cannot see anything related to this in console? Also I tried a custom API config but there were nothing in network tab as well. How should it work? BTW I use nuxt3 + vue3 in the project

Increase precision for CLS events

History: #9

We can support an option to add multiplier for different events. Since this is a breaking change, we either have to default it to 1 or release as a major version to ask updating google anyltics.

node: 14.16.1 and yarn: 1.22.10 -> I into this problem, how should I fix it? Error: Cannot find module './runtime/providers/log'

 WARN  Module @nuxtjs/web-vitals not found. Please ensure @nuxtjs/web-vitals is in devDependencies and installed. HINT: During build step, for npm/yarn, NODE_ENV=production or --production should NOT be used.


 FATAL  Cannot find module './runtime/providers/log'                              15:57:32
Require stack:
- /node_modules/@nuxtjs/web-vitals/dist/index.cjs
- /node_modules/@nuxt/core/dist/core.js

  Require stack:
  - node_modules/@nuxtjs/web-vitals/dist/index.cjs
  - node_modules/@nuxt/core/dist/core.js
  at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
  at Function.a [as resolve] (node_modules/jiti/dist/v8cache.js:2:2508)
  at Object.<anonymous> (node_modules/@nuxtjs/web-vitals/dist/index.cjs:13:22)
  at Module.o._compile (node_modules/jiti/dist/v8cache.js:2:2778)
  at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
  at Module.load (internal/modules/cjs/loader.js:928:32)
  at Function.Module._load (internal/modules/cjs/loader.js:769:14)
  at Module.require (internal/modules/cjs/loader.js:952:19)
  at require (internal/modules/cjs/helpers.js:88:18)
  at Resolver.f [as _require] (node_modules/jiti/dist/jiti.js:1:53846)

@nuxtjs/web-vitals 0.1.7

Nuxt 3 support

Hey,

I will work on making the module work with Nuxt 3 out of the box.

VuePress version

Hi there,

My site is built on VuePress and hosted on Vercel.

Would you be interested in a VuePress version of this lib?

I would hope any port would be obvious and straightforward.

LMK

Use the metric ID for the label instead of fullPath

I know it's probably not quite clear why ID is needed, but it's actually really important—if you're sending this data to Google Analytics—that you have a dimension you can use to drill down into each individual metric occurrence. Without this, you won't be able to create a histogram or report on anything other than the metric average (and even then you won't be able to report on the average for CLS).

Regarding the use of fullPath, if what you want is the URL path of the page that was loaded when this metric was tracked, you can use the page dimension (or dp in the measurement protocol):

async function sendToAnalytics(fullPath, metric) {
  const { name, delta, id, entries } = metric
  let opts = {
    ec: 'Web Vitals',
    ea: name,
    el: id,
    // Google Analytics metrics must be integers, so the value is rounded.
    ev: parseInt(delta),
    dp: fullPath,
    ni: true
  }

  // ...
}

Note: I also set the ni param to true. Not sure if this was a mistake or not, but setting this to false will make your bounce rate go to zero (unless that's what you want).

Disabling Browser Cookies results in error

If browser cookies are disabled the module crashes with error "Failed to read the 'localStorage' property from 'Window': Access is denied for this document."
nuxt_web_vitals
When using only console logging this message is not relevant and the modules should keep logging vitals in the console.

src/runtime/utils.ts
export const KEY = 'ga:user' export const UID: string = (localStorage[KEY] = localStorage[KEY] || Math.random() + '.' + Math.random())

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Warning

These dependencies are deprecated:

Datasource Name Replacement PR?
npm standard-version Available

Other Branches

These updates are pending. To force PRs open, click the checkbox below.

  • chore(deps): replace devdependency standard-version with commit-and-tag-version ^9.5.0

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

github-actions
.github/workflows/ci.yml
  • actions/checkout v4
  • actions/setup-node v4
npm
package.json
  • @nuxt/kit ^3.11.2
  • defu ^6.1.4
  • pathe ^1.1.2
  • ufo ^1.5.3
  • web-vitals ^3.5.2
  • @nuxt/module-builder ^0.5.5
  • eslint ^9.1.1
  • nuxt ^3.11.2
  • standard-version ^9.5.0
  • typescript ^5.4.5
  • @nuxt/eslint-config ^0.3.9
playground-nuxt2/package.json
  • nuxt ^2.17.3
playground/package.json

  • Check this box to trigger a request for Renovate to run again on this repository

How can I set anonymize_ip ?

I need to set anonymize_ip: true, but right now I don't have access to url that is send to GA. Even when I run ga('set', 'anonymizeIp', true); or gtag('config', '<GA_TRACKING_ID>', { 'anonymize_ip': true }); (I use gtm). How can I solve it?

[0.1.7] Critical Error: Cannot find module './runtime/providers/log'

Hello!

The latest version, 0.1.7 is generating a fatal error when I try to deploy my app on Vercel.

 ✖ Nuxt Fatal Error
Error: Cannot find module './runtime/providers/log
Require stack:
 - /vercel/cea6d456332c12ca/.build-utils/.builder/node_modules/@nuxtjs/web-vitals/dist/index.cjs
 - /vercel/path0/node_modules_dev/@nuxt/core/dist/core.js
Require stack:
 - /vercel/cea6d456332c12ca/.build-utils/.builder/node_modules/@nuxtjs/web-vitals/dist/index.cjs
 - node_modules_dev/@nuxt/core/dist/core.js

Build Modules

Usually, modules are only required during development and build time. Using buildModules helps to make production startup faster and also significantly decreasing node_modules size for production deployments.

NOTE: If we are going to offer using buildModules need to mention that this feature is only available since Nuxt v2.9. Older users should upgrade Nuxt or use the modules section.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.