Chat on WhatsApp

Core Web Vitals Monitor for Magento 2

Real-time Core Web Vitals monitoring for Magento 2. Track LCP (Largest Contentful Paint), FID (First Input Delay), INP (Interaction to Next Paint), and CLS (Cumulative Layout Shift) on every storefront page using the native browser PerformanceObserver API. Configure resource h...

Magento 2.4.7–2.4.8 PHP 8.2–8.4 Hyva + Luma Ready Free

Key Features:

  • LCP tracking
  • FID tracking
  • INP tracking
  • CLS tracking

Additional Services

$0.00
In stock
SKU
panth-corewebvitals
Links
Pay with Wise
Lifetime Updates Every Magento release
1-Year Free Support Email + WhatsApp
Adobe-Certified Magento 2 Developer
Free Forever No subscription, no upsell
What you get

Everything in the box

Built-in from day one. No add-ons, no upsell, no licence keys to renew.

LCP tracking

Largest Contentful Paint, captured on the final paint event before user input

FID tracking

First Input Delay for legacy browsers and backwards compatibility

INP tracking

Interaction to Next Paint, the official replacement CWV since March 2024

CLS tracking

Cumulative Layout Shift with session-window aggregation

Overview

Panth Core Web Vitals Monitor is a performance tracking and optimization module for Magento 2 and Adobe Commerce that captures real-user LCP, INP, CLS, FID, TTFB, and FCP through the browser PerformanceObserver API. Metrics post to Google Analytics 4 or a custom beacon endpoint, so admins see field data, not synthetic Lighthouse runs.

The Core Web Vitals tracker ships as a ~3 KB gzipped vanilla JS file loaded async and deferred, with zero runtime dependencies. INP, the official replacement metric since March 2024, is captured alongside legacy FID for backward compatibility. CLS uses the standard session-window aggregation. Metrics are exposed via window.coreWebVitalsMetrics and browser CustomEvents (coreWebVitals:lcp, coreWebVitals:inp, coreWebVitals:cls) for custom dashboards.

Beyond measurement, Core Web Vitals adds resource hints (dns-prefetch, preconnect with crossorigin, prefetch), HTTP Server-Timing: php;dur=NN and Link preconnect headers (RFC 8288), X-DNS-Prefetch-Control: on, and preload plus font-display: swap for critical woff2 fonts to optimize LCP and eliminate FOIT-driven CLS. A cron task aggregates beacons into rolling 7-day and 30-day snapshots, with auto-pruning of stale samples and an admin opt-out switch.

  • Hyva and Luma stores chasing the green “Good URLs” bucket in Search Console.
  • Magento teams that need real-user INP data, not synthetic Lighthouse runs.
  • Performance engineers tuning fonts, preconnect, and Server-Timing budgets.

Why Core Web Vitals Matter

Since 2021, Google uses Core Web Vitals as a direct ranking signal. A slow LCP, a janky CLS or an unresponsive INP does not only frustrate shoppers — it also demotes your storefront in organic search results, raises paid-ad CPCs via worse Quality Score, and kills conversion rates. Industry data consistently shows every 100 ms saved on LCP translates into measurable revenue uplift on eCommerce.

Panth Core Web Vitals gives you:

  1. Field data — real user measurements from every visitor, not synthetic lab tests
  2. Actionable levers — resource hints, font preloads, HTTP performance headers
  3. Trend visibility — cron-collected rolling snapshots for regression detection

What you get

Core Web Vitals Monitor tracks and optimizes real-user performance behavior:

  • LCP, INP, CLS, FID, TTFB, and FCP via PerformanceObserver.
  • Auto-dispatch to GA4 plus sendBeacon to a custom endpoint.
  • Resource hints, Server-Timing, and RFC 8288 Link preconnect headers.
  • Font preload with font-display: swap to reduce FOIT and CLS.
  • Hourly cron with 7-day and 30-day rolling snapshots.
  • Magento 2.4.4–2.4.9, PHP 8.1–8.4, Hyva and Luma compatible.

Panth Core Web Vitals — Real-time LCP, FID, INP & CLS Monitoring for Magento 2

Real-time Core Web Vitals monitoring for Magento 2. Track LCP (Largest Contentful Paint), FID (First Input Delay), INP (Interaction to Next Paint), and CLS (Cumulative Layout Shift) on every storefront page using the native browser PerformanceObserver API. Configure resource hints (dns-prefetch, preconnect, prefetch), emit performance HTTP headers (Server-Timing, X-DNS-Prefetch-Control, Link), apply optimized font loading strategies, and collect aggregated metrics on a scheduled cron job — all from one unified admin section. Compatible with Magento 2.4.4 – 2.4.8, PHP 8.1 – 8.4, Hyva, and Luma.

Panth Core Web Vitals is a lightweight, production-ready performance observability module. It injects a micro-JavaScript snippet that leverages the native PerformanceObserver interface to capture LCP, FID/INP and CLS in real time — no third-party library, no blocking scripts, no extra render cost. Metrics are rated against Google's official good/needs-improvement/poor thresholds and dispatched through GA4 (gtag), a custom beacon endpoint (navigator.sendBeacon), or browser CustomEvents for your own RUM pipeline. Beyond measurement, the module ships server-side speed primitives: dns-prefetch / preconnect / prefetch tag generation, Server-Timing headers for PHP execution visibility, RFC 8288 Link preconnect headers, preload hints for critical fonts, and an hourly cron aggregator that persists rolling metric snapshots for trend analysis.


Key Features

Real-time Monitoring (PerformanceObserver API)

  • LCP tracking — Largest Contentful Paint, captured on the final paint event before user input
  • FID tracking — First Input Delay for legacy browsers and backwards compatibility
  • INP tracking — Interaction to Next Paint, the official replacement CWV since March 2024
  • CLS tracking — Cumulative Layout Shift with session-window aggregation
  • TTFB & FCP bonus metrics exposed via window.coreWebVitalsMetrics
  • Zero runtime dependencies — vanilla JavaScript, ~3 KB gzipped, async + defer

Resource Hints

  • <link rel="dns-prefetch"> — early DNS resolution (20–120 ms savings per origin)
  • <link rel="preconnect" crossorigin> — DNS + TCP + TLS handshake ahead of time
  • <link rel="prefetch"> — low-priority download of next-page resources
  • Managed through a simple one-domain-per-line admin textarea

Performance HTTP Headers

  • Server-Timing: php;dur=NN — PHP execution time visible in DevTools Timing
  • X-DNS-Prefetch-Control: on — enables speculative DNS on supporting browsers
  • Link: <https://...>; rel=preconnect — RFC 8288 preconnect at the header layer (fires before HTML parses)

Optimized Font Loading

  • Emits <link rel="preload" as="font" type="font/woff2" crossorigin> for critical fonts
  • Applies font-display: swap guidance to eliminate FOIT (Flash of Invisible Text)
  • Reduces CLS caused by late-loading webfonts

Cron Metrics Collection

  • Hourly scheduled task that aggregates beacon-posted metrics into rolling buckets
  • Rolling 7-day / 30-day snapshots for trend analysis
  • Admin opt-out switch and auto-pruning of stale samples

Analytics Integration

  • Auto-dispatch to Google Analytics 4 via gtag with event_category: "Web Vitals"
  • navigator.sendBeacon to a custom endpoint via window.panthCoreWebVitalsEndpoint
  • Browser CustomEvents: coreWebVitals:lcp, coreWebVitals:fid, coreWebVitals:inp, coreWebVitals:cls

Admin Foundation

  • Lives under Stores → Configuration → Panth Extensions → Core Web Vitals
  • Unified Panth Infotech admin sidebar (via the free Panth_Core base module)
  • MEQP compliant, zero severity-10 violations

Metric Thresholds

Metric Good Needs Improvement Poor
LCP (Largest Contentful Paint) ≤ 2500 ms ≤ 4000 ms > 4000 ms
FID (First Input Delay) ≤ 100 ms ≤ 300 ms > 300 ms
INP (Interaction to Next Paint) ≤ 200 ms ≤ 500 ms > 500 ms
CLS (Cumulative Layout Shift) ≤ 0.1 ≤ 0.25 > 0.25

Targets align with Google's official web.dev/vitals thresholds.


Resource Hints

Resource hints tell the browser to do costly network work earlier than it would naturally schedule it. Configure each list under Resource Hints in the admin.

  • dns-prefetch — resolves a hostname early, saving 20–120 ms on the first request to that origin
  • preconnect — performs DNS + TCP + TLS upfront, ideal for fonts, analytics, and CDN origins
  • prefetch — downloads a resource at low priority for the likely next page

All hints are output both as <link> tags in <head> and, where supported, mirrored into the HTTP Link response header so the browser can act before HTML parsing begins.


Performance HTTP Headers

Once the module is enabled, every frontend response carries:

Header Purpose
Server-Timing: php;dur=NN PHP execution time in ms — visible under DevTools Network → Timing
X-DNS-Prefetch-Control: on Enables speculative DNS resolution on Chromium/WebKit
Link: <https://...>; rel=preconnect; crossorigin RFC 8288 preconnect at the header layer — fires before HTML parse

These headers are emitted by a lightweight HTTP response observer that runs after controller dispatch.


Font Loading Strategy

Late-rendering webfonts are a top cause of poor CLS and slow LCP. The module can:

  • Emit <link rel="preload" as="font" type="font/woff2" crossorigin> for fonts you list as critical
  • Encourage font-display: swap via layout examples — renders fallback text immediately
  • Reduce layout shift from font-metric swap by pairing preloads with size-adjust fallbacks

Result: measurably lower CLS and a more stable LCP on above-the-fold text blocks.


Cron Metrics Collection

A scheduled job (panth_corewebvitals_collect) runs hourly and:

  1. Aggregates beacon-posted samples into rolling 7-day / 30-day buckets
  2. Computes p50 / p75 / p95 percentiles per metric
  3. Prunes stale raw samples to keep storage lightweight
  4. Writes a summary row you can query for dashboards or alerting

Disable the cron via the Enable Metric Collection Cron toggle in the admin if you prefer a zero-server-state setup.


Analytics Integration

Google Analytics 4

If gtag() is loaded, metrics are auto-sent as events with event_category: "Web Vitals". No extra config required.

Custom Beacon Endpoint

<script>window.panthCoreWebVitalsEndpoint = 'https://your-collector.example.com/rum';</script>

Metrics are POSTed as JSON via navigator.sendBeacon.

Browser CustomEvents

window.addEventListener('coreWebVitals:lcp', (e) => console.log(e.detail));
window.addEventListener('coreWebVitals:inp', (e) => console.log(e.detail));
window.addEventListener('coreWebVitals:cls', (e) => console.log(e.detail));

Troubleshooting

Symptom Cause Fix
No metrics in console Module disabled or debug off Enable both + cache:flush
PerformanceObserver is not defined Very old browser (IE11) Expected — script safely no-ops
GA4 events missing gtag not present Verify GA4 tag + "Send Metrics to Analytics" = Yes
Resource hint <link> missing Module off or no domains configured Enable + add domains under Resource Hints
Server-Timing header missing Full-page cache (Varnish/Fastly) cached a response emitted while module was disabled Purge full-page cache

Enable Debug Mode and inspect var/log/panth_corewebvitals.log for detailed output.


Quick Links


Ready to score green on every Core Web Vital?


SEO Keywords: core web vitals magento, core web vitals magento 2, magento 2 LCP, largest contentful paint magento, magento 2 FID, first input delay magento, magento 2 INP, interaction to next paint magento, magento 2 CLS, cumulative layout shift magento, page speed magento, magento 2 performance monitoring, real user monitoring magento, RUM magento 2, PerformanceObserver magento, magento 2 resource hints, dns-prefetch magento, preconnect magento, prefetch magento, magento 2 Server-Timing header, magento 2 Link header RFC 8288, magento 2 font preload, font-display swap magento, magento 2 web vitals cron, magento 2 GA4 web vitals, google analytics 4 core web vitals magento, magento 2 page speed optimization, magento 2.4.8 performance, hyva core web vitals, luma core web vitals, magento 2 SEO performance, google ranking signal magento, magento 2 speed extension, mage2kishan corewebvitals, panth infotech core web vitals, kishan savaliya magento performance, hire magento performance developer, adobe commerce cloud performance, fastly server-timing magento

Compatibility

Requirement Versions Supported
Magento Open Source 2.4.4, 2.4.5, 2.4.6, 2.4.7, 2.4.8
Adobe Commerce 2.4.4, 2.4.5, 2.4.6, 2.4.7, 2.4.8
Adobe Commerce Cloud 2.4.4 — 2.4.8
PHP 8.1.x, 8.2.x, 8.3.x, 8.4.x
MySQL 8.0+
MariaDB 10.4+
Hyva Theme 1.0+ (fully supported)
Luma Theme Native support
Browsers Chrome, Edge, Firefox, Safari 13+ (graceful no-op on older)

Requires mage2kishan/module-core (free, installed automatically via Composer).


Installation

Composer Installation (Recommended)

composer require mage2kishan/module-corewebvitals
bin/magento module:enable Panth_Core Panth_CoreWebVitals
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy -f
bin/magento cache:flush

Manual Installation via ZIP

  1. Download the latest release from Packagist or the Adobe Commerce Marketplace
  2. Extract to app/code/Panth/CoreWebVitals/
  3. Ensure the base module Panth_Core is also present under app/code/Panth/Core/
  4. Run the commands above starting from bin/magento module:enable

Verify Installation

bin/magento module:status Panth_CoreWebVitals
# Expected output: Module is enabled

Then navigate to Admin → Stores → Configuration → Panth Extensions → Core Web Vitals and set Enable Module = Yes.


Configuration

All settings live at Stores → Configuration → Panth Extensions → Core Web Vitals.

General Settings

Setting Default Description
Enable Module No Master switch. Injects the monitoring snippet on every frontend page.
Debug Mode No Logs metrics to DevTools console and exposes window.coreWebVitalsMetrics. Disable in production.
Send Metrics to Analytics Yes Forwards metrics to GA4 gtag or a custom beacon endpoint.

Metric Targets

Setting Default
Monitor LCP / Target LCP (ms) Yes / 2500
Monitor FID & INP / Target FID / Target INP Yes / 100 / 200
Monitor CLS / Target CLS Yes / 0.1

Resource Hints

Setting Description
DNS Prefetch Domains One per line, no protocol. Example: fonts.googleapis.com
Preconnect Domains One per line. Example: fonts.gstatic.com. Limit to 2–4 critical origins.
Prefetch URLs One full URL per line for next-navigation prefetch.

License

Panth Core Web Vitals is distributed under a proprietary license — see LICENSE.txt.


More Information
Module Category Performance
Best For Mid-Market

Need this customised?

Talk to Kishan directly — written quote, scope and timeline within 24 hours. No sales call.

WhatsApp

Core Web Vitals Monitor for Magento 2

$0.00
Step up

Customers usually upgrade to