diff options
| author | houston[bot] <astrobot-houston@users.noreply.github.com> | 2025-06-12 22:12:30 +0200 |
|---|---|---|
| committer | Yuval Adam <_@yuv.al> | 2025-06-12 22:12:30 +0200 |
| commit | 0f65b996085d8aa76029163817bf7f28215cd5d6 (patch) | |
| tree | ca6042b00b50d6712b401630932582c938ccb12d /src/components/Analytics.astro | |
Initial commit from Astro
Diffstat (limited to 'src/components/Analytics.astro')
| -rw-r--r-- | src/components/Analytics.astro | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/components/Analytics.astro b/src/components/Analytics.astro new file mode 100644 index 0000000..0352bea --- /dev/null +++ b/src/components/Analytics.astro @@ -0,0 +1,33 @@ +--- +import { analytics } from "../config/analytics"; + +const GOOGLE_ANALYTICS_ID = analytics.googleAnalyticsId; +const FATHOM_ANALYTICS_ID = analytics.fathomAnalyticsId; +--- + +{ + GOOGLE_ANALYTICS_ID && ( + <script + async + src={`https://www.googletagmanager.com/gtag/js?id=${GOOGLE_ANALYTICS_ID}`} + /> + <script define:vars={{ GOOGLE_ANALYTICS_ID }} is:inline> + window.dataLayer = window.dataLayer || []; + function gtag() { + dataLayer.push(arguments); + } + gtag("js", new Date()); + gtag("config", GOOGLE_ANALYTICS_ID); + </script> + ) +} +{ + FATHOM_ANALYTICS_ID && ( + <script + src="https://cdn.usefathom.com/script.js" + data-site={FATHOM_ANALYTICS_ID} + defer + /> + ) +} + |
