Skip to content

Commit

Permalink
trying with root url
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Grato committed Oct 3, 2023
1 parent 6324f05 commit 62e1bd2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion marketing/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,18 @@ import appleTouch from '../public/apple-touch-icon.png';
import { pageview } from 'services/analytics.service';
import { useEffect } from 'react';
import { useRouter } from 'next/router';
import getEnvVariable from 'config';

function MyApp({ Component, pageProps }: AppProps) {
const router = useRouter();

useEffect(() => {
const handleRouteChange = (url: string) => pageview(url);
const root = getEnvVariable('DASH_ROOT_DOMAIN');
pageview(root + router.route);

const handleRouteChange = (url: string) => {
pageview(root + url);
};

// Listen for route changes and call the handler
router.events.on('routeChangeComplete', handleRouteChange);
Expand Down

0 comments on commit 62e1bd2

Please sign in to comment.