From ec01f4c57ee1e5f95eb139dcedf414f6fe15bc31 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Wed, 29 Nov 2023 14:06:42 +0800 Subject: [PATCH] fix: _app client build (#13) --- pages/_app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/_app.js b/pages/_app.js index 652a91c..d115323 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -27,7 +27,7 @@ const tagManagerArgs = { gtmId: process.env.NEXT_PUBLIC_GTM_ID, } -if (tagManagerArgs.gtmId) { +if (tagManagerArgs.gtmId && typeof window !== 'undefined') { TagManager.initialize(tagManagerArgs) }