diff --git a/pages/_app.js b/pages/_app.js index 03b3873..d00dcce 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -11,18 +11,8 @@ const App = ({ Component, pageProps }) => { return () => clearTimeout(timer); }, []); + // ✅ Add accessiBe script useEffect(() => { - if (typeof window === "undefined") return; - - const host = window.location.hostname; - const isLocal = - host === "localhost" || - host === "127.0.0.1" || - host.endsWith(".vercel.app") || - host.endsWith(".netlify.app"); - - if (process.env.NODE_ENV !== "production" || isLocal) return; - const script = document.createElement("script"); script.src = "https://acsbapp.com/apps/app/dist/js/app.js"; script.async = true; @@ -31,11 +21,9 @@ const App = ({ Component, pageProps }) => { window.acsbJS.init(); } }; - document.head.appendChild(script); - return () => { - script.remove(); - }; + const h = document.querySelector("head") || document.body; + h.appendChild(script); }, []); return ( diff --git a/pages/_document.js b/pages/_document.js index 49dae51..812c685 100644 --- a/pages/_document.js +++ b/pages/_document.js @@ -1,26 +1,10 @@ -// pages/_document.js -import { Html, Head, Main, NextScript } from "next/document"; +import { Html, Head, Main, NextScript } from 'next/document'; export default function Document() { return ( - {/* ✅ CSS Styles */} - - - - - - - - - - - - - - - {/* ✅ Google Tag Manager */} + {/* ✅ Google Tag Manager (script) */} + {/* ✅ Google Analytics (gtag.js) */} +