diff --git a/pages/_app.js b/pages/_app.js index bcb391f..03b3873 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -11,8 +11,18 @@ 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; @@ -21,9 +31,11 @@ const App = ({ Component, pageProps }) => { window.acsbJS.init(); } }; + document.head.appendChild(script); - const h = document.querySelector("head") || document.body; - h.appendChild(script); + return () => { + script.remove(); + }; }, []); return ( @@ -35,4 +47,4 @@ const App = ({ Component, pageProps }) => { ); }; -export default App; +export default App; \ No newline at end of file diff --git a/pages/_document.js b/pages/_document.js index 812c685..49dae51 100644 --- a/pages/_document.js +++ b/pages/_document.js @@ -1,10 +1,26 @@ -import { Html, Head, Main, NextScript } from 'next/document'; +// pages/_document.js +import { Html, Head, Main, NextScript } from "next/document"; export default function Document() { return ( - {/* ✅ Google Tag Manager (script) */} + {/* ✅ CSS Styles */} + + + + + + + + + + + + + + + {/* ✅ Google Tag Manager */} + {/* ✅ Google Analytics */} +