From abb2587055db67d7c285a91ee3a39747d603f829 Mon Sep 17 00:00:00 2001 From: Ahmad Abdolsaheb Date: Sat, 8 Mar 2025 01:36:34 +0300 Subject: [PATCH] fix: clean up google analytics (#59178) Co-authored-by: Oliver Eyton-Williams --- client/config/analytics-settings.ts | 3 --- client/src/analytics/call-ga.ts | 6 ----- client/src/analytics/index.ts | 6 ++--- .../templates/Challenges/classic/editor.tsx | 10 +------- .../Challenges/redux/action-types.js | 1 - .../src/templates/Challenges/redux/actions.js | 1 - .../redux/current-challenge-saga.js | 24 ++----------------- 7 files changed, 5 insertions(+), 46 deletions(-) diff --git a/client/config/analytics-settings.ts b/client/config/analytics-settings.ts index dd8d93ee501..0547e57a814 100644 --- a/client/config/analytics-settings.ts +++ b/client/config/analytics-settings.ts @@ -1,5 +1,2 @@ export const prodAnalyticsId = 'GTM-57R6KJM'; export const devAnalyticsId = 'GTM-WSS47LM'; - -// this id includes a stream for the spanish learn platform -export const prodAnalyticsESId = 'GTM-KCS6GSD'; diff --git a/client/src/analytics/call-ga.ts b/client/src/analytics/call-ga.ts index 0c9599c31bb..51c675d29db 100644 --- a/client/src/analytics/call-ga.ts +++ b/client/src/analytics/call-ga.ts @@ -54,11 +54,6 @@ interface DonationViewEvent { action: DonationViewEventAction; } -interface RenderTimeEvent { - event: 'render_time'; - render_time_msec: number; -} - interface PageViewEvent { event: 'pageview'; pagePath: string; @@ -96,7 +91,6 @@ export type GAevent = | DonationViewEvent | DonationEvent | DonationRelatedEvent - | RenderTimeEvent | PageViewEvent | ExperimentViewEvent | ChallengeFailedEvent diff --git a/client/src/analytics/index.ts b/client/src/analytics/index.ts index 27b6e75ef74..7f39d6bf638 100644 --- a/client/src/analytics/index.ts +++ b/client/src/analytics/index.ts @@ -2,17 +2,15 @@ import TagManager from 'react-gtm-module'; import { devAnalyticsId, - prodAnalyticsId, - prodAnalyticsESId + prodAnalyticsId } from '../../config/analytics-settings'; import envData from '../../config/env.json'; -const { deploymentEnv, clientLocale } = envData; +const { deploymentEnv } = envData; const analyticsIDSelector = () => { if (deploymentEnv === 'staging') return devAnalyticsId; - else if (clientLocale === 'espanol') return prodAnalyticsESId; else return prodAnalyticsId; }; diff --git a/client/src/templates/Challenges/classic/editor.tsx b/client/src/templates/Challenges/classic/editor.tsx index 23bd7081a5e..73ce85c5e99 100644 --- a/client/src/templates/Challenges/classic/editor.tsx +++ b/client/src/templates/Challenges/classic/editor.tsx @@ -47,8 +47,7 @@ import { initTests, stopResetting, openModal, - resetAttempts, - sendRenderTime + resetAttempts } from '../redux/actions'; import { attemptsSelector, @@ -98,7 +97,6 @@ export interface EditorProps { openResetModal: () => void; resizeProps: ResizeProps; saveChallenge: () => void; - sendRenderTime: (renderTime: number) => void; saveEditorContent: () => void; setEditorFocusability: (isFocusable: boolean) => void; submitChallenge: () => void; @@ -180,7 +178,6 @@ const mapDispatchToProps = { initTests, stopResetting, resetAttempts, - sendRenderTime, openHelpModal: () => openModal('help'), openResetModal: () => openModal('reset') }; @@ -1222,11 +1219,6 @@ const Editor = (props: EditorProps): JSX.Element => { // eslint-disable-next-line react-hooks/exhaustive-deps }, [props.challengeFiles, props.isResetting]); - useEffect(() => { - props.sendRenderTime(Date.now()); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [props.description]); - useEffect(() => { const { showProjectPreview, previewOpen } = props; if (!previewOpen && showProjectPreview) { diff --git a/client/src/templates/Challenges/redux/action-types.js b/client/src/templates/Challenges/redux/action-types.js index a988ea8bdee..4eeb795f261 100644 --- a/client/src/templates/Challenges/redux/action-types.js +++ b/client/src/templates/Challenges/redux/action-types.js @@ -38,7 +38,6 @@ export const actionTypes = createTypes( 'storePortalWindow', 'removePortalWindow', 'challengeMounted', - 'sendRenderTime', 'checkChallenge', 'resetChallenge', 'stopResetting', diff --git a/client/src/templates/Challenges/redux/actions.js b/client/src/templates/Challenges/redux/actions.js index 39970babac0..565c50bb548 100644 --- a/client/src/templates/Challenges/redux/actions.js +++ b/client/src/templates/Challenges/redux/actions.js @@ -71,7 +71,6 @@ export const storePortalWindow = createAction(actionTypes.storePortalWindow); export const removePortalWindow = createAction(actionTypes.removePortalWindow); export const challengeMounted = createAction(actionTypes.challengeMounted); -export const sendRenderTime = createAction(actionTypes.sendRenderTime); export const checkChallenge = createAction(actionTypes.checkChallenge); export const executeChallenge = createAction(actionTypes.executeChallenge); export const executeChallengeComplete = createAction( diff --git a/client/src/templates/Challenges/redux/current-challenge-saga.js b/client/src/templates/Challenges/redux/current-challenge-saga.js index e767f3bbff8..9e07be593b7 100644 --- a/client/src/templates/Challenges/redux/current-challenge-saga.js +++ b/client/src/templates/Challenges/redux/current-challenge-saga.js @@ -1,10 +1,7 @@ -import { put, takeEvery, select, call } from 'redux-saga/effects'; +import { put, takeEvery } from 'redux-saga/effects'; import store from 'store'; import { randomCompliment } from '../../../utils/get-words'; -import { setRenderStartTime } from '../../../redux/actions'; -import { renderStartTimeSelector } from '../../../redux/selectors'; -import callGA from '../../../analytics/call-ga'; import { CURRENT_CHALLENGE_KEY } from './action-types'; import { updateSuccessMessage } from './actions'; @@ -33,26 +30,9 @@ function* updateSuccessMessageSaga() { yield put(updateSuccessMessage(randomCompliment())); } -function* sendRenderTimeSaga({ payload }) { - /* - This saga sends the difference between a challenge submission time - and next challenge's description change time to google analytics. - */ - const renderStartTime = yield select(renderStartTimeSelector); - if (renderStartTime) { - const challengeRenderTime = payload - renderStartTime; - yield put(setRenderStartTime(null)); - yield call(callGA, { - event: 'render_time', - render_time_msec: challengeRenderTime - }); - } -} - export function createCurrentChallengeSaga(types) { return [ takeEvery(types.challengeMounted, currentChallengeSaga), - takeEvery(types.challengeMounted, updateSuccessMessageSaga), - takeEvery(types.sendRenderTime, sendRenderTimeSaga) + takeEvery(types.challengeMounted, updateSuccessMessageSaga) ]; }