diff --git a/src/MainApp.jsx b/src/MainApp.jsx index b107e365..7beaa3d1 100755 --- a/src/MainApp.jsx +++ b/src/MainApp.jsx @@ -6,7 +6,7 @@ import { Helmet } from 'react-helmet'; import { Navigate, Route, Routes } from 'react-router-dom'; import { - EmbeddedRegistrationRoute, NotFoundPage, registerIcons, UnAuthOnlyRoute, + EmbeddedRegistrationRoute, NotFoundPage, registerIcons, RouteTracker, UnAuthOnlyRoute, } from './common-components'; import configureStore from './data/configureStore'; import { @@ -57,6 +57,7 @@ const MainApp = () => ( } /> } /> + ); diff --git a/src/common-components/RouteTracker.jsx b/src/common-components/RouteTracker.jsx new file mode 100644 index 00000000..4ba3dab6 --- /dev/null +++ b/src/common-components/RouteTracker.jsx @@ -0,0 +1,15 @@ +import { useEffect } from 'react'; + +import { useLocation } from 'react-router-dom'; + +const RouteTracker = () => { + const location = useLocation(); + + useEffect(() => { + window.tagular?.('pageView'); + }, [location]); + + return null; +}; + +export default RouteTracker; diff --git a/src/common-components/index.jsx b/src/common-components/index.jsx index 1334873c..c3d613d4 100644 --- a/src/common-components/index.jsx +++ b/src/common-components/index.jsx @@ -2,6 +2,7 @@ export { default as RedirectLogistration } from './RedirectLogistration'; export { default as registerIcons } from './RegisterFaIcons'; export { default as EmbeddedRegistrationRoute } from './EmbeddedRegistrationRoute'; export { default as UnAuthOnlyRoute } from './UnAuthOnlyRoute'; +export { default as RouteTracker } from './RouteTracker'; export { default as NotFoundPage } from './NotFoundPage'; export { default as SocialAuthProviders } from './SocialAuthProviders'; export { default as ThirdPartyAuthAlert } from './ThirdPartyAuthAlert'; diff --git a/src/logistration/Logistration.jsx b/src/logistration/Logistration.jsx index fc8d670c..fb15f2da 100644 --- a/src/logistration/Logistration.jsx +++ b/src/logistration/Logistration.jsx @@ -71,8 +71,6 @@ const Logistration = (props) => { return; } - window.tagular?.('pageView'); - sendTrackEvent(`edx.bi.${tabKey.replace('/', '')}_form.toggled`, { category: 'user-engagement', app_name: APP_NAME }); props.clearThirdPartyAuthContextErrorMessage(); if (tabKey === LOGIN_PAGE) {