diff --git a/.vitepress/config.ts b/.vitepress/config.ts index 140c2f0d..edb81572 100644 --- a/.vitepress/config.ts +++ b/.vitepress/config.ts @@ -130,18 +130,18 @@ export default defineConfigWithTheme({ }); function getAnalyticsTags(env: NodeJS.ProcessEnv): HeadConfig[] { - if (!env.VITE_GTM_ID) { + if (!env.VITE_GTAG_ID) { return []; } return [ [ 'script', - { src: `https://www.googletagmanager.com/gtag/js?id=${env.VITE_GTM_ID}`, async: '' }, + { src: `https://www.googletagmanager.com/gtag/js?id=${env.VITE_GTAG_ID}`, async: '' }, ], [ 'script', {}, - `function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag('js',new Date),gtag('config','${env.VITE_GTM_ID}',{anonymize_ip:true})`, + `function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag('js',new Date),gtag('config','${env.VITE_GTAG_ID}',{anonymize_ip:true})`, ], ]; } diff --git a/README.md b/README.md index 5ff51132..5884aad4 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,7 @@ For production, the docs expect the following environment variables to be define - `VITE_ALGOLIA_ID`: Algolia `appId`. - `VITE_ALGOLIA_KEY`: Algolia `apiKey`. -- `VITE_GTM_ID`: Google Tag Manager id. +- `VITE_GTAG_ID`: Google Analytics id. They can be defined in CI server configuration, or in a `.env` file: @@ -113,7 +113,7 @@ They can be defined in CI server configuration, or in a `.env` file: # .env VITE_ALGOLIA_ID='******' VITE_ALGOLIA_KEY='******' -VITE_GTM_ID='******' +VITE_GTAG_ID='******' ``` ---