Make a settings in config for Google Analytics.

This commit is contained in:
prototypa
2022-08-28 18:49:04 -04:00
committed by GitHub
parent fe9141415a
commit 0ea029a242

View File

@ -1,4 +1,6 @@
--- ---
import { SITE } from "~/config.mjs"
import "~/assets/styles/base.css"; import "~/assets/styles/base.css";
import MetaTags from "~/components/core/MetaTags.astro"; import MetaTags from "~/components/core/MetaTags.astro";
@ -6,6 +8,7 @@ import BasicScripts from "~/components/core/BasicScripts.astro";
import Analytics from '@julian_cataldo/astro-analytics/Analytics.astro'; import Analytics from '@julian_cataldo/astro-analytics/Analytics.astro';
const { meta = {} } = Astro.props; const { meta = {} } = Astro.props;
const { googleAnalyticsId = false } = SITE;
--- ---
<!DOCTYPE html> <!DOCTYPE html>
@ -13,7 +16,7 @@ const { meta = {} } = Astro.props;
<head> <head>
<MetaTags {...meta} /> <MetaTags {...meta} />
<Analytics id='G-XXXXXXXXXX' /> {googleAnalyticsId && <Analytics id={googleAnalyticsId} />}
</head> </head>
<body class="antialiased text-gray-900 dark:text-slate-300 tracking-tight bg-white dark:bg-slate-900"> <body class="antialiased text-gray-900 dark:text-slate-300 tracking-tight bg-white dark:bg-slate-900">
@ -21,4 +24,4 @@ const { meta = {} } = Astro.props;
<BasicScripts /> <BasicScripts />
</body> </body>
</html> </html>