feat: adding hotjar support

This commit is contained in:
Leangseu Kim
2022-12-07 16:06:04 -05:00
committed by leangseu-edx
parent 03e42f45bb
commit 6003099a73
6 changed files with 42 additions and 2 deletions

View File

@@ -4,6 +4,9 @@ import { useDispatch } from 'react-redux';
import { Helmet } from 'react-helmet';
import { useIntl } from '@edx/frontend-platform/i18n';
import { logError } from '@edx/frontend-platform/logging';
import { initializeHotjar } from '@edx/frontend-enterprise-hotjar';
import { ErrorPage, AppContext } from '@edx/frontend-platform/react';
import Footer from '@edx/frontend-component-footer';
import { Alert } from '@edx/paragon';
@@ -59,8 +62,18 @@ export const App = () => {
window.thunkActions = thunkActions;
window.track = track;
}
});
if (process.env.HOTJAR_APP_ID) {
try {
initializeHotjar({
hotjarId: process.env.HOTJAR_APP_ID,
hotjarVersion: process.env.HOTJAR_VERSION,
hotjarDebug: !!process.env.HOTJAR_DEBUG,
});
} catch (error) {
logError(error);
}
}
}, [authenticatedUser, dispatch]);
return (
<Router>
<Helmet>