Skip to content

Commit b44f20c

Browse files
committed
fix: allow multiple declarations of GoogleTagManager, fixes issue when GTM is defined multiple times and scripts are not being fired, when navigating between pages vercel#77946
1 parent 7ca56e9 commit b44f20c

File tree

1 file changed

+2
-2
lines changed
  • packages/third-parties/src/google

1 file changed

+2
-2
lines changed

packages/third-parties/src/google/gtm.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export function GoogleTagManager(props: GTMParams) {
4040
return (
4141
<>
4242
<Script
43-
id="_next-gtm-init"
43+
id={`_next-gtm-init-${gtmId}`}
4444
dangerouslySetInnerHTML={{
4545
__html: `
4646
(function(w,l){
@@ -52,7 +52,7 @@ export function GoogleTagManager(props: GTMParams) {
5252
nonce={nonce}
5353
/>
5454
<Script
55-
id="_next-gtm"
55+
id={`_next-gtm-${gtmId}`}
5656
data-ntpc="GTM"
5757
src={`${gtmScriptUrl}?id=${gtmId}${gtmLayer}${gtmAuth}${gtmPreview}`}
5858
nonce={nonce}

0 commit comments

Comments
 (0)