refactor: Simplify script loading conditions in HeadDefault function
This commit is contained in:
parent
0893e6d2f0
commit
7c61d3afd6
@ -3,24 +3,26 @@ import logoUrl from "@/assets/logo.svg";
|
||||
import React from "react";
|
||||
|
||||
export default function HeadDefault() {
|
||||
const pageContext = usePageContext();
|
||||
|
||||
console.log("pageContext", pageContext.cookies);
|
||||
const { cookies } = usePageContext();
|
||||
|
||||
return (
|
||||
<>
|
||||
<link rel="icon" href={logoUrl} />
|
||||
<script defer src="https://cloud.umami.is/script.js" data-website-id="ba70261e-d145-4dd1-b0e8-27cbf4927b74" />
|
||||
{cookies.consent.analytics && (
|
||||
<>
|
||||
<script defer src="https://cloud.umami.is/script.js" data-website-id="ba70261e-d145-4dd1-b0e8-27cbf4927b74" />
|
||||
|
||||
<script async src={`https://www.googletagmanager.com/gtag/js?id=GTM-NRMKQ68K`}></script>
|
||||
<script
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
gtag('config', 'GTM-NRMKQ68K');`,
|
||||
}}
|
||||
></script>
|
||||
<script async src={`https://www.googletagmanager.com/gtag/js?id=GTM-NRMKQ68K`} />
|
||||
<script
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
gtag('config', 'GTM-NRMKQ68K');`,
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user