@astrojs/web-vitals
Introduction
'Read the “', Introduction, '” section'This Astro integration enables tracking real-world website performance and storing the data in Astro DB. That data will be used in the StudioCMS dashboard to show the performance metrics of your website from the real world over time.
Installation
'Read the “', Installation, '” section'-
Install the package and add to your astro config using the following command:
Terminal window npx astro add @astrojs/web-vitalsTerminal window pnpm astro add @astrojs/web-vitalsTerminal window yarn astro add @astrojs/web-vitals -
Push the new configuration to your remote database:
Terminal window npx astro db pushTerminal window pnpm astro db pushTerminal window yarn astro db push
-
Install the package using the following command:
Terminal window npm i @astrojs/web-vitalsTerminal window pnpm add @astrojs/web-vitalsTerminal window yarn add @astrojs/web-vitals -
Add
@astrojs/web-vitals
to your astro config file:astro.config.mjs importnode from '@astrojs/node';function node(userOptions: UserOptions): AstroIntegrationimportstudioCMS from 'studiocms';const studioCMS: (options?: {dbStartPage?: boolean | undefined;rendererConfig?: {studiocms?: false | {callouts?: false | {theme?: "github" | "obsidian" | "vitepress" | undefined;} | undefined;autoLinkHeadings?: boolean | undefined;discordSubtext?: boolean | undefined;sanitize?: {allowElements?: string[] | undefined;blockElements?: string[] | undefined;dropElements?: string[] | undefined;allowAttributes?: Record<string, string[]> | undefined;dropAttributes?: Record<string, string[]> | undefined;allowComponents?: boolean | undefined;allowCustomElements?: boolean | undefined;allowComments?: boolean | undefined;} | undefined;} | undefined;renderer?: "studiocms" | CustomRenderer | "astro" | "markdoc" | "mdx" | undefined;markdocConfig?: {renderType?: "html" | MarkdocRenderer | "react-static" | undefined;argParse?: {file?: string | undefined;slots?: boolean | undefined;location?: boolean | undefined;} | undefined;transformConfig?: {tags?: Record<string, {}> | undefined;validation?: {parents?: any[] | undefined;validateFunctions?: boolean | undefined;environment?: string | undefined;} | undefined;nodes ...StudioCMS Integration
A CMS built for Astro by the Astro Community for the Astro Community.
importdb from '@astrojs/db';function db(): AstroIntegration[]importwebVitals from '@astrojs/web-vitals';function webVitals({ deprecated }?: {deprecated?: boolean;}): AstroIntegrationimport {defineConfig } from 'astro/config';function defineConfig<const TLocales extends Locales = never, const TDriver extends SessionDriverName = never>(config: AstroUserConfig<TLocales, TDriver>): AstroUserConfig<TLocales, TDriver>See the full Astro Configuration API Documentation https://astro.build/config
export defaultdefineConfig({defineConfig<never, never>(config: AstroUserConfig<never, never>): AstroUserConfig<never, never>See the full Astro Configuration API Documentation https://astro.build/config
site: 'https://demo.studiocms.dev/',AstroUserConfig<TLocales extends Locales = never, TSession extends SessionDriverName = never>.site?: stringoutput: 'server',AstroUserConfig<TLocales extends Locales = never, TSession extends SessionDriverName = never>.output?: "server" | "static"adapter:AstroUserConfig<TLocales extends Locales = never, TSession extends SessionDriverName = never>.adapter?: AstroIntegrationnode({function node(userOptions: UserOptions): AstroIntegrationmode: "standalone" }),UserOptions.mode: "standalone" | "middleware"Specifies the mode that the adapter builds to.
- 'middleware' - Build to middleware, to be used within another Node.js server, such as Express.
- 'standalone' - Build to a standalone server. The server starts up just by running the built script.
integrations: [AstroUserConfig<TLocales extends Locales = never, TSession extends SessionDriverName = never>.integrations?: (false | AstroIntegration | (false | AstroIntegration | null | undefined)[] | null | undefined)[]db(), // REQUIREDfunction db(): AstroIntegration[]webVitals(),function webVitals({ deprecated }?: {deprecated?: boolean;}): AstroIntegrationstudioCMS(),function studioCMS(options?: {dbStartPage?: boolean | undefined;rendererConfig?: {studiocms?: false | {callouts?: false | {theme?: "github" | "obsidian" | "vitepress" | undefined;} | undefined;autoLinkHeadings?: boolean | undefined;discordSubtext?: boolean | undefined;sanitize?: {allowElements?: string[] | undefined;blockElements?: string[] | undefined;dropElements?: string[] | undefined;allowAttributes?: Record<string, string[]> | undefined;dropAttributes?: Record<string, string[]> | undefined;allowComponents?: boolean | undefined;allowCustomElements?: boolean | undefined;allowComments?: boolean | undefined;} | undefined;} | undefined;renderer?: "studiocms" | CustomRenderer | "astro" | "markdoc" | "mdx" | undefined;markdocConfig?: {renderType?: "html" | MarkdocRenderer | "react-static" | undefined;argParse?: {file?: string | undefined;slots?: boolean | undefined;location?: boolean | undefined;} | undefined;transformConfig?: {tags?: Record<string, {}> | undefined;validation?: {parents?: any[] | undefined;validateFunctions?: boolean | undefined;environment?: string | undefined;} | undefined;nodes ...StudioCMS Integration
A CMS built for Astro by the Astro Community for the Astro Community.
],});Terminal window npm i @astrojs/web-vitalsTerminal window pnpm add @astrojs/web-vitalsTerminal window yarn add @astrojs/web-vitals -
Push the new configuration to your remote database:
Terminal window npx astro db pushTerminal window pnpm astro db pushTerminal window yarn astro db push