Skip to content

Commit

Permalink
Removed outdated code related to web analytics (#8755)
Browse files Browse the repository at this point in the history
  • Loading branch information
bsekachev authored Dec 2, 2024
1 parent 0c57d24 commit 4681dd6
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 26 deletions.
1 change: 0 additions & 1 deletion Dockerfile.ui
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ COPY cvat-canvas3d/ /tmp/cvat-canvas3d/
COPY cvat-canvas/ /tmp/cvat-canvas/
COPY cvat-ui/ /tmp/cvat-ui/

ARG WA_PAGE_VIEW_HIT
ARG UI_APP_CONFIG
ARG CLIENT_PLUGINS
ARG DISABLE_SOURCE_MAPS
Expand Down
5 changes: 1 addition & 4 deletions cvat-ui/src/components/cvat-app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ import { Organization, getCore } from 'cvat-core-wrapper';
import {
ErrorState, NotificationState, NotificationsState, PluginsState,
} from 'reducers';
import { customWaViewHit } from 'utils/environment';
import showPlatformNotification, {
platformInfo,
stopNotifications,
Expand Down Expand Up @@ -142,7 +141,7 @@ class CVATApplication extends React.PureComponent<CVATAppProps & RouteComponentP

public componentDidMount(): void {
const core = getCore();
const { history, location, onChangeLocation } = this.props;
const { history, onChangeLocation } = this.props;
const {
HEALTH_CHECK_RETRIES, HEALTH_CHECK_PERIOD, HEALTH_CHECK_REQUEST_TIMEOUT,
SERVER_UNAVAILABLE_COMPONENT, RESET_NOTIFICATIONS_PATHS,
Expand Down Expand Up @@ -170,9 +169,7 @@ class CVATApplication extends React.PureComponent<CVATAppProps & RouteComponentP
}
};

customWaViewHit(location.pathname, location.search, location.hash);
history.listen((newLocation) => {
customWaViewHit(newLocation.pathname, newLocation.search, newLocation.hash);
const { location: prevLocation } = this.props;

onChangeLocation(prevLocation.pathname, newLocation.pathname);
Expand Down
22 changes: 1 addition & 21 deletions cvat-ui/src/utils/environment.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (C) 2020-2022 Intel Corporation
// Copyright (C) 2022 CVAT.ai Corp
// Copyright (C) 2024 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT

Expand All @@ -9,23 +9,3 @@
export function isDev(): boolean {
return process.env.NODE_ENV === 'development';
}

export function customWaViewHit(pageName?: string, queryString?: string, hashInfo?: string): void {
const waHitFunctionName = process.env.WA_PAGE_VIEW_HIT;
if (waHitFunctionName) {
const waHitFunction = new Function(
'pageName',
'queryString',
'hashInfo',
`if (typeof ${waHitFunctionName} === 'function') {
${waHitFunctionName}(pageName, queryString, hashInfo);
}`,
);
try {
waHitFunction(pageName, queryString, hashInfo);
} catch (error: any) {
// eslint-disable-next-line
console.error(`Web analytics hit function has failed. ${error.toString()}`);
}
}
}

0 comments on commit 4681dd6

Please sign in to comment.