pmc-performance-metrics
Record performance metrics, such as Google's Web Vitals, via existing analytics integrations.
Usage
On a site that loads Google Analytics or Google Tag Manager, enable the pmc-performance-metrics plugin. As long as either GA or GTM is loaded using PMC's corresponding plugin, this plugin will automatically report metrics.
If the site uses a custom analytics integration, the \PMC\Performance_Metrics\Web_Vitals::FILTER_TAG_PROVIDER constant provides access to a filter tag that should be used to set the analytics provider to either ga or gtag.
In non-production environments, if an analytics provider isn't present, metrics are logged to the console.
Data
Once enabled, Google Analytics will record "Web Vitals (opens in a new tab)" events capturing the following:
- CLS: Cumulative Layout Shift (Chromium)
- FCP: First Contentful Paint (Chromium)
- FID: First Input Delay (Chromium, Firefox, Safari)
- LCP: Largest Contentful Paint (Chromium)
- TTFB: Time to first byte (Chromium, Firefox, Safari, Internet Explorer)
- TTFB-RT: Time to first btye, less time spent on DNS lookup, connection negotiation, network latency, and unloading the previous document (Chromium, Firefox, Safari, Internet Explorer)