mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix: clean up google analytics (#59178)
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
@@ -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';
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -38,7 +38,6 @@ export const actionTypes = createTypes(
|
||||
'storePortalWindow',
|
||||
'removePortalWindow',
|
||||
'challengeMounted',
|
||||
'sendRenderTime',
|
||||
'checkChallenge',
|
||||
'resetChallenge',
|
||||
'stopResetting',
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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)
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user