- Renamed and updated Google Analytics script and collection endpoints in the Next.js configuration for better clarity and security. - Adjusted the GoogleAnalytics component to reflect new script sources and transport URLs, improving tracking accuracy and data handling. - Removed unnecessary meta tags and preload links in the layout component to streamline the codebase.
33 lines
873 B
TypeScript
33 lines
873 B
TypeScript
'use client';
|
|
|
|
import Script from 'next/script';
|
|
|
|
const GA_MEASUREMENT_ID = 'G-QTT9QT0T3S';
|
|
|
|
export default function GoogleAnalytics() {
|
|
return (
|
|
<>
|
|
<Script
|
|
src="/sys/libs/vendor-utils.js"
|
|
strategy="afterInteractive"
|
|
/>
|
|
<Script id="google-analytics" strategy="afterInteractive">
|
|
{`
|
|
window.dataLayer = window.dataLayer || [];
|
|
function gtag(){dataLayer.push(arguments);}
|
|
gtag('js', new Date());
|
|
|
|
gtag('config', '${GA_MEASUREMENT_ID}', {
|
|
transport_url: window.location.origin + '/sys/api/vitals',
|
|
cookie_flags: 'SameSite=None;Secure',
|
|
allow_ad_personalization_signals: false,
|
|
anonymize_ip: true,
|
|
page_location: window.location.href,
|
|
page_title: document.title
|
|
});
|
|
`}
|
|
</Script>
|
|
</>
|
|
);
|
|
}
|