diff --git a/packages/next-plugin-google-analytics/package.json b/packages/next-plugin-google-analytics/package.json
index a1cd6adcbef2c..1b6a47d69fc9c 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 d10a05b41f925..b27a7c47fcc23 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 094b2c98b2add..e250a31500627 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,
})