Browse Source

Fix TS

main
Dan Abramov 3 years ago
parent
commit
9ac33fff1a
  1. 8
      beta/src/pages/_app.tsx

8
beta/src/pages/_app.tsx

@ -16,17 +16,21 @@ import Script from 'next/script';
const EmptyAppShell: React.FC = ({children}) => <>{children}</>; const EmptyAppShell: React.FC = ({children}) => <>{children}</>;
if (typeof window !== 'undefined') { if (typeof window !== 'undefined') {
// @ts-ignore
window.dataLayer = window.dataLayer || []; window.dataLayer = window.dataLayer || [];
// @ts-ignore
window.gtag = function () { window.gtag = function () {
dataLayer.push(arguments); // @ts-ignore
window.dataLayer.push(arguments);
}; };
// @ts-ignore
gtag('js', new Date()); gtag('js', new Date());
} }
export default function MyApp({Component, pageProps}: AppProps) { export default function MyApp({Component, pageProps}: AppProps) {
const router = useRouter(); const router = useRouter();
React.useEffect(() => { React.useEffect(() => {
const handleRouteChange = (url) => { const handleRouteChange = (url: string) => {
// @ts-ignore // @ts-ignore
gtag('config', process.env.NEXT_PUBLIC_GA_TRACKING_ID, { gtag('config', process.env.NEXT_PUBLIC_GA_TRACKING_ID, {
page_path: url, page_path: url,

Loading…
Cancel
Save