LCP tracking
Largest Contentful Paint, captured on the final paint event before user input
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...
Key Features:
Additional Services
Built-in from day one. No add-ons, no upsell, no licence keys to renew.
Largest Contentful Paint, captured on the final paint event before user input
First Input Delay for legacy browsers and backwards compatibility
Interaction to Next Paint, the official replacement CWV since March 2024
Cumulative Layout Shift with session-window aggregation
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.
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:
Core Web Vitals Monitor tracks and optimizes real-user performance behavior:
PerformanceObserver.sendBeacon to a custom endpoint.Server-Timing, and RFC 8288 Link preconnect headers.preload with font-display: swap to reduce FOIT and CLS.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.
window.coreWebVitalsMetricsdefer<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 resourcesServer-Timing: php;dur=NN — PHP execution time visible in DevTools TimingX-DNS-Prefetch-Control: on — enables speculative DNS on supporting browsersLink: <https://...>; rel=preconnect — RFC 8288 preconnect at the header layer (fires before HTML parses)<link rel="preload" as="font" type="font/woff2" crossorigin> for critical fontsfont-display: swap guidance to eliminate FOIT (Flash of Invisible Text)gtag with event_category: "Web Vitals"navigator.sendBeacon to a custom endpoint via window.panthCoreWebVitalsEndpointCustomEvents: coreWebVitals:lcp, coreWebVitals:fid, coreWebVitals:inp, coreWebVitals:clsPanth_Core base module)| 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 tell the browser to do costly network work earlier than it would naturally schedule it. Configure each list under Resource Hints in the admin.
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.
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.
Late-rendering webfonts are a top cause of poor CLS and slow LCP. The module can:
<link rel="preload" as="font" type="font/woff2" crossorigin> for fonts you list as criticalfont-display: swap via layout examples — renders fallback text immediatelysize-adjust fallbacksResult: measurably lower CLS and a more stable LCP on above-the-fold text blocks.
A scheduled job (panth_corewebvitals_collect) runs hourly and:
Disable the cron via the Enable Metric Collection Cron toggle in the admin if you prefer a zero-server-state setup.
If gtag() is loaded, metrics are auto-sent as events with event_category: "Web Vitals". No extra config required.
<script>window.panthCoreWebVitalsEndpoint = 'https://your-collector.example.com/rum';</script>
Metrics are POSTed as JSON via navigator.sendBeacon.
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));
| 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.
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
| 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).
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
app/code/Panth/CoreWebVitals/Panth_Core is also present under app/code/Panth/Core/bin/magento module:enablebin/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.
All settings live at Stores → Configuration → Panth Extensions → Core Web Vitals.
| 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. |
| 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 |
| 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. |
Panth Core Web Vitals is distributed under a proprietary license — see LICENSE.txt.
| Module Category | Performance |
|---|---|
| Best For | Mid-Market |
Talk to Kishan directly — written quote, scope and timeline within 24 hours. No sales call.
Core Web Vitals Monitor for Magento 2