diff --git a/packages/next-plugin-google-analytics/package.json b/packages/next-plugin-google-analytics/package.json
index a1cd6adcbef2c6edc17f0b806671739fedb125fd..1b6a47d69fc9c132e0047addbc5bda550a116cec 100644
--- a/packages/next-plugin-google-analytics/package.json
+++ b/packages/next-plugin-google-analytics/package.json
@@ -8,7 +8,7 @@
"nextjs": {
"name": "Google Analytics",
"required-env": [
- "GA_TRACKING_ID"
+ "NEXT_PUBLIC_GA_TRACKING_ID"
]
},
"peerDependencies": {
diff --git a/packages/next-plugin-google-analytics/src/document-head-tags-server.js b/packages/next-plugin-google-analytics/src/document-head-tags-server.js
index d10a05b41f925985878bb9b7f3d3db87eb2234c3..b27a7c47fcc2316c2e5de85379ae3b1b3b6162f0 100644
--- a/packages/next-plugin-google-analytics/src/document-head-tags-server.js
+++ b/packages/next-plugin-google-analytics/src/document-head-tags-server.js
@@ -5,7 +5,7 @@ export default async function headTags() {
<>
diff --git a/packages/next-plugin-google-analytics/src/on-init-client.js b/packages/next-plugin-google-analytics/src/on-init-client.js
index 094b2c98b2addc4bd6aa80849300eb3c59742526..e250a315006277590fe15934ec671a66df4c0a19 100644
--- a/packages/next-plugin-google-analytics/src/on-init-client.js
+++ b/packages/next-plugin-google-analytics/src/on-init-client.js
@@ -1,7 +1,7 @@
export default async function initClient({ router }) {
router.events.on('routeChangeComplete', (url) => {
setTimeout(() => {
- window.gtag('config', process.env.GA_TRACKING_ID, {
+ window.gtag('config', process.env.NEXT_PUBLIC_GA_TRACKING_ID, {
page_location: url,
page_title: document.title,
})