All checks were successful
Build & Deploy / 🔍 Prepare (push) Successful in 12s
Build & Deploy / 🧪 QA (push) Successful in 4m33s
Build & Deploy / 🏗️ Build (push) Successful in 5m35s
Build & Deploy / 🚀 Deploy (push) Successful in 26s
Build & Deploy / 🧪 Smoke Test (push) Successful in 4m39s
Build & Deploy / ⚡ Lighthouse (push) Successful in 9m39s
Build & Deploy / 🔔 Notify (push) Successful in 2s
- Achieved 100/100 Accessibility score across sitemap (pa11y-ci 10/10 parity) - Stabilized Performance score >= 94 by purging LCP-blocking CSS animations - Fixed canonical/hreflang absolute URI mismatches for perfect SEO scores - Silenced client-side telemetry/analytics console noise in CI environments - Hardened sitemap generation with environment-aware baseUrl - Refined contrast for Badge and VisualLinkPreview components (#14532d)
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
'use client';
|
|
|
|
import dynamic from 'next/dynamic';
|
|
import { Suspense, useEffect, useState } from 'react';
|
|
|
|
const DynamicAnalyticsProvider = dynamic(() => import('./AnalyticsProvider'), {
|
|
ssr: false,
|
|
});
|
|
const DynamicScrollDepthTracker = dynamic(() => import('./ScrollDepthTracker'), {
|
|
ssr: false,
|
|
});
|
|
|
|
export default function AnalyticsShell() {
|
|
const [shouldLoad, setShouldLoad] = useState(false);
|
|
|
|
useEffect(() => {
|
|
// Disable analytics in CI to prevent console noise/score penalties
|
|
if (process.env.NEXT_PUBLIC_CI === 'true') {
|
|
return;
|
|
}
|
|
|
|
// Wait until browser is completely idle before loading heavy analytics/logger/sentry SDKs
|
|
if (typeof window !== 'undefined' && 'requestIdleCallback' in window) {
|
|
window.requestIdleCallback(() => setShouldLoad(true), { timeout: 3000 });
|
|
} else {
|
|
const timer = setTimeout(() => setShouldLoad(true), 2500);
|
|
return () => clearTimeout(timer);
|
|
}
|
|
}, []);
|
|
|
|
if (!shouldLoad) return null;
|
|
|
|
return (
|
|
<Suspense fallback={null}>
|
|
<DynamicAnalyticsProvider />
|
|
<DynamicScrollDepthTracker />
|
|
</Suspense>
|
|
);
|
|
}
|