Skip to content

Commit

Permalink
feat(nx-dev): add apollo.io tracking script to _app.tsx (nrwl#22339)
Browse files Browse the repository at this point in the history
Integrated Apollo.io embed code script to enable tracking functionality. The script has been added with 'afterInteractive' strategy to ensure it loads after the main content, optimizing performance and tracking accuracy.
  • Loading branch information
bcabanes authored and arekkubaczkowski committed Mar 19, 2024
1 parent 1c8bd2b commit c0a8c52
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions nx-dev/nx-dev/pages/_app.tsx
Expand Up @@ -76,6 +76,7 @@ export default function CustomApp({
Skip to content
</Link>
<Component {...pageProps} />

{/* Global Site Tag (gtag.js) - Google Analytics */}
<Script
id="gtag-script-dependency"
Expand All @@ -96,6 +97,15 @@ export default function CustomApp({
`,
}}
/>
{/* Apollo.io Embed Code */}
<Script
type="text/javascript"
id="apollo-script-loader"
strategy="afterInteractive"
dangerouslySetInnerHTML={{
__html: `function initApollo(){var n=Math.random().toString(36).substring(7),o=document.createElement("script"); o.src="https://assets.apollo.io/micro/website-tracker/tracker.iife.js?nocache="+n,o.async=!0,o.defer=!0,o.onload=function(){window.trackingFunctions.onLoad({appId:"65e1db2f1976f30300fd8b26"})},document.head.appendChild(o)}initApollo();`,
}}
/>
{/* HubSpot Analytics */}
<Script
id="hs-script-loader"
Expand Down

0 comments on commit c0a8c52

Please sign in to comment.