34 lines
908 B
TypeScript
34 lines
908 B
TypeScript
"use client";
|
|
|
|
import Script from "next/script";
|
|
|
|
const GA_MEASUREMENT_ID = "G-QTT9QT0T3S";
|
|
|
|
export default function GoogleAnalytics() {
|
|
if (process.env.NODE_ENV !== "production") {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<Script src="/sys/libs/vendor-utils.js" strategy="lazyOnload" />
|
|
<Script id="google-analytics" strategy="lazyOnload">
|
|
{`
|
|
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>
|
|
</>
|
|
);
|
|
}
|