mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-10-01 15:48:23 -05:00
Add GA
This commit is contained in:
28
app/root.tsx
28
app/root.tsx
@@ -131,6 +131,7 @@ function Document({
|
||||
<PWALinks />
|
||||
<Fonts />
|
||||
</head>
|
||||
<GTM />
|
||||
<body>
|
||||
<React.StrictMode>
|
||||
<Layout patrons={data?.patrons} isCatchBoundary={isCatchBoundary}>
|
||||
@@ -202,6 +203,33 @@ export const ErrorBoundary: ErrorBoundaryComponent = ({ error }) => {
|
||||
);
|
||||
};
|
||||
|
||||
function GTM() {
|
||||
const id = process.env["GTM_ID"];
|
||||
|
||||
if (!id) return null;
|
||||
|
||||
return (
|
||||
<>
|
||||
<script async src={`https://www.googletagmanager.com/gtag/js?id=${id}`} />
|
||||
<script>
|
||||
{`window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag("consent", "default", {
|
||||
ad_storage: "denied",
|
||||
analytics_storage: "denied",
|
||||
functionality_storage: "denied",
|
||||
personalization_storage: "denied",
|
||||
security_storage: "denied"
|
||||
});
|
||||
|
||||
gtag('config', '${id}');`}
|
||||
</script>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function Fonts() {
|
||||
return (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user