Skip to content

Commit 2b3b1ad

Browse files
small fix
1 parent e5e7917 commit 2b3b1ad

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

src/components/seo.jsx

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,12 @@ function SEO({ lang,
4242
let loadGTM = false;
4343

4444
if (typeof window !== 'undefined') {
45-
loadGTM = window.location.href.includes("testsigma.com") || window.location.href.includes("https://www.testsigma.com/") || window.location.href.includes("https://testsigma.com/");
45+
loadGTM = window.location.href.includes("tutorials") || window.location.href.includes("https://www.testsigma.com/") || window.location.href.includes("https://testsigma.com/");
4646
}
4747

4848
useEffect(() => {
4949
if (loadGTM) {
5050
const script = document.createElement('script');
51-
const noscript = document.createElement('noscript');
5251
script.type = 'text/javascript';
5352
script.innerHTML = `
5453
(function(w,d,s,l,i){
@@ -60,18 +59,13 @@ function SEO({ lang,
6059
f.parentNode.insertBefore(j,f);
6160
})(window,document,'script','dataLayer','GTM-5F8HTVT');
6261
`;
63-
noscript.innerHTML = `
64-
<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-5F8HTVT"
65-
height="0" width="0" style="display:none;visibility:hidden">
66-
</iframe>
67-
`
6862
document.head.appendChild(script);
69-
document.head.appendChild(noscript);
7063
}
7164
}, []);
7265

7366
return (
74-
<Helmet
67+
<>
68+
<Helmet
7569
htmlAttributes={{
7670
lang,
7771
}}
@@ -177,6 +171,18 @@ function SEO({ lang,
177171
<script type="text/javascript" id="hs-script-loader" async defer src="//js.hs-scripts.com/23341221.js"></script>
178172

179173
</Helmet>
174+
{loadGTM && (
175+
<>
176+
<noscript>
177+
{`
178+
<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-5F8HTVT"
179+
height="0" width="0" style="display:none;visibility:hidden">
180+
</iframe>
181+
`}
182+
</noscript>
183+
</>
184+
)}
185+
</>
180186
);
181187
}
182188

0 commit comments

Comments
 (0)