feat(analytics): enhance Google Analytics with privacy compliance and comprehensive tracking

- Add automatic route change tracking for SPA navigation
- Implement Cookie consent banner for GDPR compliance
- Add performance tracking (LCP, FID, CLS Web Vitals)
- Add outbound link click tracking
- Integrate contact form submission tracking with conversion events
- Add CTA button click tracking in hero section
- Integrate error tracking in ErrorBoundary component
- Extend analytics utility library with 15+ tracking functions
- Configure IP anonymization and privacy settings
- Remove unused test files and deployment scripts
- Update case studies to include only specified cases
- Fix mobile navigation active state issues
- Fix lint errors in test files and components

BREAKING CHANGE: Google Analytics now requires user consent before tracking
This commit is contained in:
张翔
2026-04-22 07:19:29 +08:00
parent b117372b03
commit 2f45818724
45 changed files with 652 additions and 2293 deletions
+11 -1
View File
@@ -7,6 +7,12 @@ import { HeroSection } from "@/components/sections/hero-section";
import { SectionSkeleton } from "@/components/ui/loading-skeleton";
import type { ReactNode } from 'react';
declare global {
interface Window {
__isProgrammaticScroll?: boolean;
}
}
const ServicesSection = dynamic(
() => import('@/components/sections/services-section').then(mod => ({ default: mod.ServicesSection })),
{
@@ -77,7 +83,11 @@ function HomeContent({ heroStats }: { heroStats: ReactNode }) {
const scrollToSection = () => {
const targetElement = document.getElementById(section);
if (targetElement) {
window.__isProgrammaticScroll = true;
targetElement.scrollIntoView({ behavior: 'smooth', block: 'start' });
setTimeout(() => {
window.__isProgrammaticScroll = false;
}, 2000);
return true;
}
return false;
@@ -96,7 +106,7 @@ function HomeContent({ heroStats }: { heroStats: ReactNode }) {
}, [searchParams]);
return (
<main className="min-h-screen bg-white dark:bg-(--color-bg-primary)">
<main id="main-content" className="min-h-screen bg-white dark:bg-(--color-bg-primary)">
<HeroSection heroStats={heroStats} />
<ServicesSection />
<HomeSolutionsSection />