diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index af46e2c54..8536eda02 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -71,6 +71,8 @@ const bannerOffsetByPosition = { } const bannerOffset = bannerOffsetByPosition[siteConfig.banner.position || 'center'] + +const gtagId = siteConfig.googleAnalytics? siteConfig.googleAnalytics.id : '' --- @@ -78,6 +80,16 @@ const bannerOffset = data-overlayscrollbars-initialize > + {gtagId.length > 0 && + + + } {pageTitle} diff --git a/src/types/config.ts b/src/types/config.ts index 67e5f2596..adb8f8f0d 100644 --- a/src/types/config.ts +++ b/src/types/config.ts @@ -24,6 +24,9 @@ export type SiteConfig = { enable: boolean depth: 1 | 2 | 3 } + googleAnalytics?: { + id: string + } favicon: Favicon[] }