mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-06 04:22:01 +00:00
[all] Update naming for Next.js Analytics (#9835)
Updates the name of Next.js Analytics to Next.js Speed Insights closes ALY-484
This commit is contained in:
@@ -32,7 +32,7 @@ export function sendToAnalytics(metric, options) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (options.debug) {
|
if (options.debug) {
|
||||||
console.log("[Analytics]", metric.name, JSON.stringify(body, null, 2));
|
console.log("[Web Vitals]", metric.name, JSON.stringify(body, null, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
const blob = new Blob([new URLSearchParams(body).toString()], {
|
const blob = new Blob([new URLSearchParams(body).toString()], {
|
||||||
@@ -61,6 +61,6 @@ export function webVitals(options) {
|
|||||||
onCLS((metric) => sendToAnalytics(metric, options));
|
onCLS((metric) => sendToAnalytics(metric, options));
|
||||||
onFCP((metric) => sendToAnalytics(metric, options));
|
onFCP((metric) => sendToAnalytics(metric, options));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("[Analytics]", err);
|
console.error("[Web Vitals]", err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ function sendToAnalytics(metric, options) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (options.debug) {
|
if (options.debug) {
|
||||||
console.log('[Analytics]', metric.name, JSON.stringify(body, null, 2));
|
console.log('[Web Vitals]', metric.name, JSON.stringify(body, null, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
const blob = new Blob([new URLSearchParams(body).toString()], {
|
const blob = new Blob([new URLSearchParams(body).toString()], {
|
||||||
@@ -61,6 +61,6 @@ export function webVitals(options) {
|
|||||||
getCLS((metric) => sendToAnalytics(metric, options));
|
getCLS((metric) => sendToAnalytics(metric, options));
|
||||||
getFCP((metric) => sendToAnalytics(metric, options));
|
getFCP((metric) => sendToAnalytics(metric, options));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('[Analytics]', err);
|
console.error('[Web Vitals]', err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ export default async function main(client: Client): Promise<number> {
|
|||||||
output.debug(`Loaded environment variables from "${envPath}"`);
|
output.debug(`Loaded environment variables from "${envPath}"`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// For Vercel Analytics support
|
// For Vercel Speed Insights support
|
||||||
if (project.settings.analyticsId) {
|
if (project.settings.analyticsId) {
|
||||||
envToUnset.add('VERCEL_ANALYTICS_ID');
|
envToUnset.add('VERCEL_ANALYTICS_ID');
|
||||||
process.env.VERCEL_ANALYTICS_ID = project.settings.analyticsId;
|
process.env.VERCEL_ANALYTICS_ID = project.settings.analyticsId;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
This plugin sends [Core Web Vitals](https://web.dev/vitals/) to Vercel Analytics. This plugin is configured by default on Vercel. You **do not** need to install it manually. For more information, [read this post](https://vercel.com/blog/gatsby-analytics).
|
This plugin sends [Core Web Vitals](https://web.dev/vitals/) to Vercel Speed Insights. This plugin is configured by default on Vercel. You **do not** need to install it manually. For more information, [read this post](https://vercel.com/blog/gatsby-analytics).
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@vercel/gatsby-plugin-vercel-analytics",
|
"name": "@vercel/gatsby-plugin-vercel-analytics",
|
||||||
"version": "1.0.9",
|
"version": "1.0.9",
|
||||||
"description": "Track Core Web Vitals in Gatsby projects with Vercel Analytics.",
|
"description": "Track Core Web Vitals in Gatsby projects with Vercel Speed Insights.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"files": [
|
"files": [
|
||||||
"gatsby-browser.js",
|
"gatsby-browser.js",
|
||||||
|
|||||||
@@ -403,7 +403,7 @@ export const build: BuildV2 = async ({
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
debug(
|
debug(
|
||||||
`No analytics plugin injected for framework ${framework.slug}`
|
`No Web Vitals plugin injected for framework ${framework.slug}`
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ import { DeepWriteable, readPackageJson, writePackageJson } from './_shared';
|
|||||||
const ANALYTICS_PLUGIN_PACKAGE = '@nuxtjs/web-vitals';
|
const ANALYTICS_PLUGIN_PACKAGE = '@nuxtjs/web-vitals';
|
||||||
|
|
||||||
export async function injectVercelAnalyticsPlugin(dir: string) {
|
export async function injectVercelAnalyticsPlugin(dir: string) {
|
||||||
// First update the `.nuxtrc` file to inject the analytics plugin.
|
// First update the `.nuxtrc` file to inject the Speed Insights (formerly Analytics) plugin.
|
||||||
// See: https://gist.github.com/pi0/23b5253ac19b4ed5a70add3b971545c9
|
// See: https://gist.github.com/pi0/23b5253ac19b4ed5a70add3b971545c9
|
||||||
const nuxtrcPath = join(dir, '.nuxtrc');
|
const nuxtrcPath = join(dir, '.nuxtrc');
|
||||||
console.log(
|
console.log(
|
||||||
`Injecting Nuxt.js analytics plugin "${ANALYTICS_PLUGIN_PACKAGE}" to \`${nuxtrcPath}\``
|
`Injecting Nuxt.js Speed Insights plugin "${ANALYTICS_PLUGIN_PACKAGE}" to \`${nuxtrcPath}\``
|
||||||
);
|
);
|
||||||
update(
|
update(
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user