Skip to content

Commit

Permalink
Merge pull request #4618 from 3drepo/ISSUE_4569
Browse files Browse the repository at this point in the history
ISSUE #4569 - add hotjar
  • Loading branch information
carmenfan authored Jan 17, 2024
2 parents 2beec71 + 198ad0a commit 848f4d3
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 0 deletions.
2 changes: 2 additions & 0 deletions backend/src/v4/routes/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ function createClientConfig(serverConfig, req) {

clientConfig.apiUrls = config.apiUrls;

clientConfig.hotjar = config.hotjar;

clientConfig.C = {
GET_API : C.GET_API,
POST_API : C.POST_API,
Expand Down
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"@fortawesome/free-solid-svg-icons": "5.6.1",
"@fortawesome/react-fontawesome": "0.1.17",
"@hookform/resolvers": "2.8.5",
"@hotjar/browser": "1.0.9",
"@mui/icons-material": "5.4.4",
"@mui/lab": "5.0.0-alpha.71",
"@mui/material": "5.12.0",
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import rootSaga from './v4/modules/sagas';
import { NotFound } from '@/v5/ui/routes/notFound';
import { AuthenticatedRoute } from './v5/services/routing/authenticatedRoute.component';
import { initializeGoogleTagManager } from './v5/services/googleTagManager';
import { initializeHotjar } from './v5/services/hotjar';

window.UnityUtil = UnityUtil;

Expand All @@ -54,6 +55,8 @@ initializeIntl(navigator.language);

initializeSocket(clientConfigService.chatConfig);

initializeHotjar();

initializeGoogleTagManager();

// Injecting the instance of socket from v5 into v4
Expand Down
1 change: 1 addition & 0 deletions frontend/src/v4/services/clientConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export class ClientConfigService {
public imageSizeLimit;
public imageExtensions;
public apiUrls;
public hotjar;
private chatHost;
private chatPath;
private chatReconnectionAttempts;
Expand Down
27 changes: 27 additions & 0 deletions frontend/src/v5/services/hotjar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* Copyright (C) 2023 3D Repo Ltd
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import Hotjar from '@hotjar/browser';
import { clientConfigService } from '../../v4/services/clientConfig';

export const initializeHotjar = () => {
const { development, hotjar } = clientConfigService;

if (!development && hotjar) {
const { siteId, version } = hotjar;
Hotjar.init(siteId, version);
}
};
5 changes: 5 additions & 0 deletions frontend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1876,6 +1876,11 @@
resolved "https://registry.yarnpkg.com/@hookform/resolvers/-/resolvers-2.8.5.tgz#25b902bd40516c1755bc857753283de740560aff"
integrity sha512-n7eFm4snsejpfZVH8q2NU7YJbsGhF61IHB0TxgK11nmg08RymEr3KscnbTAZaPd9RaXa3vUPoULgBRN2nVDtMg==

"@hotjar/[email protected]":
version "1.0.9"
resolved "https://registry.yarnpkg.com/@hotjar/browser/-/browser-1.0.9.tgz#769b4ded3fa7b9557b785c107f0cd76d3f83789a"
integrity sha512-n9akDMod8BLGpYEQCrHwlYWWd63c1HlhUSXNIDfClZtKYXbUjIUOFlNZNNcUxgHTCsi4l2i+SWKsGsO0t93S8w==

"@humanwhocodes/config-array@^0.11.8":
version "0.11.11"
resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.11.tgz#88a04c570dbbc7dd943e4712429c3df09bc32844"
Expand Down

0 comments on commit 848f4d3

Please sign in to comment.