docs(nx-dev): add Google Tag Manager script (#30977)

Integrated Google Tag Manager (GTM) with both script and noscript tags for analytics tracking. Ensured the script uses `afterInteractive` loading strategy and includes dynamic `gaMeasurementId` for proper configuration.
This commit is contained in:
Benjamin Cabanes 2025-05-01 16:07:08 -04:00 committed by GitHub
parent 95652aef88
commit a3415309b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -131,6 +131,29 @@ export default function CustomApp({
`,
}}
/>
<Script
id="gtm-script"
strategy="afterInteractive"
dangerouslySetInnerHTML={{
__html: `
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','${gaMeasurementId}');
`,
}}
/>
{/* Google Tag Manager - NoScript */}
<noscript>
<iframe
src={`https://www.googletagmanager.com/ns.html?id=${gaMeasurementId}`}
height="0"
width="0"
style={{ display: 'none', visibility: 'hidden' }}
/>
</noscript>
{/* Apollo.io Embed Code */}
<Script
type="text/javascript"