Skip to content

Commit 5f901d0

Browse files
authored
Rename VITE_GTM_ID env var to VITE_GTAG_ID (#190)
1 parent 23fe282 commit 5f901d0

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

.vitepress/config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,18 +130,18 @@ export default defineConfigWithTheme<ThemeConfig>({
130130
});
131131

132132
function getAnalyticsTags(env: NodeJS.ProcessEnv): HeadConfig[] {
133-
if (!env.VITE_GTM_ID) {
133+
if (!env.VITE_GTAG_ID) {
134134
return [];
135135
}
136136
return [
137137
[
138138
'script',
139-
{ src: `https://www.googletagmanager.com/gtag/js?id=${env.VITE_GTM_ID}`, async: '' },
139+
{ src: `https://www.googletagmanager.com/gtag/js?id=${env.VITE_GTAG_ID}`, async: '' },
140140
],
141141
[
142142
'script',
143143
{},
144-
`function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag('js',new Date),gtag('config','${env.VITE_GTM_ID}',{anonymize_ip:true})`,
144+
`function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag('js',new Date),gtag('config','${env.VITE_GTAG_ID}',{anonymize_ip:true})`,
145145
],
146146
];
147147
}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,15 @@ For production, the docs expect the following environment variables to be define
105105

106106
- `VITE_ALGOLIA_ID`: Algolia `appId`.
107107
- `VITE_ALGOLIA_KEY`: Algolia `apiKey`.
108-
- `VITE_GTM_ID`: Google Tag Manager id.
108+
- `VITE_GTAG_ID`: Google Analytics id.
109109

110110
They can be defined in CI server configuration, or in a `.env` file:
111111

112112
```sh
113113
# .env
114114
VITE_ALGOLIA_ID='******'
115115
VITE_ALGOLIA_KEY='******'
116-
VITE_GTM_ID='******'
116+
VITE_GTAG_ID='******'
117117
```
118118

119119
---

0 commit comments

Comments
 (0)