From 764c349ce94ce11bc34cdaaa645655580f637f75 Mon Sep 17 00:00:00 2001 From: andrew setterfield Date: Wed, 14 Aug 2024 13:36:52 +0100 Subject: [PATCH] initial commit for removal of UA --- .../back-to-office.analytics.effects.spec.ts | 65 +- .../back-to-office.analytics.effects.ts | 26 +- ...andidate-details.analytics.effects.spec.ts | 36 +- .../candidate-details.analytics.effects.ts | 26 +- .../candidate-licence.analytics.effects.ts | 6 +- .../communication.analytics.effects.spec.ts | 76 - .../communication.analytics.effects.ts | 62 +- ...irm-test-details.analytics.effects.spec.ts | 17 - .../confirm-test-details.analytics.effects.ts | 23 +- .../dashboard.analytics.effects.spec.ts | 109 +- .../dashboard/dashboard.analytics.effects.ts | 65 +- .../debrief.analytics.effects.spec.ts | 15 - .../debrief/debrief.analytics.effects.ts | 10 +- .../fake-journal.analytics.effects.spec.ts | 13 - .../fake-journal.analytics.effects.ts | 9 - ...alth-declaration.analytics.effects.spec.ts | 41 +- .../health-declaration.analytics.effects.ts | 14 +- .../journal.analytics.effects.spec.ts | 69 - .../journal/journal.analytics.effects.ts | 50 - .../pages/login/__tests__/login.page.spec.ts | 5 - src/app/pages/login/login.page.ts | 3 - ...ass-finalisation.analytics.effects.spec.ts | 92 -- ...non-pass-finalisation.analytics.effects.ts | 53 +- .../office.analytics.effects.spec.ts | 181 +-- .../pages/office/office.analytics.effects.ts | 104 +- ...ass-certificates.analytics.effects.spec.ts | 3 - .../pass-certificates.analytics.effects.ts | 2 - ...ass-finalisation.analytics.effects.spec.ts | 143 +- .../pass-finalisation.analytics.effects.ts | 104 +- .../post-debrief-holding.analytics.spec.ts | 11 - .../post-debrief-holding.analytics.effects.ts | 7 +- .../rekey-reason.analytics.effects.spec.ts | 10 - .../rekey-reason.analytics.effects.ts | 18 +- .../rekey-search.analytics.effects.spec.ts | 13 +- .../rekey-search.analytics.effects.ts | 11 - ...y-upload-outcome.analytics.effects.spec.ts | 5 - .../rekey-upload-outcome.analytics.effects.ts | 6 +- ...t-centre-journal.analytics.effects.spec.ts | 61 - .../test-centre-journal.analytics.effects.ts | 49 - ...report-dashboard.analytics.effects.spec.ts | 10 - ...test-report-dashboard.analytics.effects.ts | 30 +- .../test-report.analytics.effects.spec.ts | 1302 ++--------------- ...se-diagram-modal.analytics.effects.spec.ts | 52 +- ...reverse-diagram-modal.analytics.effects.ts | 47 +- .../test-report.analytics.effects.ts | 626 ++------ ...t-results-search.analytics.effects.spec.ts | 37 +- .../test-results-search.analytics.effects.ts | 22 +- ...unuploaded-tests.analytics.effects.spec.ts | 13 - .../unuploaded-tests.analytics.effects.ts | 12 - ...iew-test-results.analytics.effects.spec.ts | 7 - .../view-test-result.analytics.effects.ts | 4 - ...ting-room-to-car.analytics.effects.spec.ts | 103 +- ...modal.cat-a-mod2.analytics.effects.spec.ts | 50 +- ...ecks-modal.cat-a-mod2.analytics.effects.ts | 45 +- ...al.cat-adi-part2.analytics.effects.spec.ts | 26 +- ...s-modal.cat-adi-part2.analytics.effects.ts | 22 +- ...le-checks-modal.cat-c.analytics.effects.ts | 43 +- ...ecks-modal.cat-d.analytics.effects.spec.ts | 60 +- ...le-checks-modal.cat-d.analytics.effects.ts | 56 +- ...s-modal.cat-home.analytics.effects.spec.ts | 43 - ...s-modal.cat-home-test.analytics.effects.ts | 44 +- .../waiting-room-to-car.analytics.effects.ts | 102 +- .../waiting-room.analytics.effects.ts | 45 +- .../analytics/__tests__/analytics.spec.ts | 46 - .../providers/analytics/analytics.model.ts | 12 - src/app/providers/analytics/analytics.ts | 101 -- .../__tests__/tests.analytics.effects.spec.ts | 120 +- .../test-status.analytics.effects.spec.ts | 20 +- .../test-status.analytics.effects.ts | 26 +- src/store/tests/tests.analytics.effects.ts | 125 +- 70 files changed, 428 insertions(+), 4436 deletions(-) diff --git a/src/app/pages/back-to-office/__tests__/back-to-office.analytics.effects.spec.ts b/src/app/pages/back-to-office/__tests__/back-to-office.analytics.effects.spec.ts index 0ea615066..d87bc8a09 100644 --- a/src/app/pages/back-to-office/__tests__/back-to-office.analytics.effects.spec.ts +++ b/src/app/pages/back-to-office/__tests__/back-to-office.analytics.effects.spec.ts @@ -5,10 +5,8 @@ import { provideMockActions } from '@ngrx/effects/testing'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { - AnalyticsDimensionIndices, - AnalyticsEventCategories, - AnalyticsEvents, - AnalyticsScreenNames, GoogleAnalyticsCustomDimension, + AnalyticsScreenNames, + GoogleAnalyticsCustomDimension, GoogleAnalyticsEventPrefix, GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, @@ -39,7 +37,6 @@ describe('BackToOfficeAnalyticsEffects', () => { let actions$: ReplaySubject; let store$: Store; const screenName = AnalyticsScreenNames.BACK_TO_OFFICE; - const screenNamePracticeMode = `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsScreenNames.BACK_TO_OFFICE}`; const mockApplication: Application = { applicationId: 123456, bookingSequence: 78, @@ -87,10 +84,6 @@ describe('BackToOfficeAnalyticsEffects', () => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(screenName); - // GA4 Analytics expect(analyticsProviderMock.setGACurrentPage) .toHaveBeenCalledWith(screenName); @@ -107,11 +100,6 @@ describe('BackToOfficeAnalyticsEffects', () => { effects.backToOfficeViewDidEnter$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(screenNamePracticeMode); - // GA4 Analytics expect(analyticsProviderMock.setGACurrentPage) .toHaveBeenCalledWith(`${GoogleAnalyticsEventPrefix.PRACTICE_MODE}_${screenName}`); @@ -135,18 +123,6 @@ describe('BackToOfficeAnalyticsEffects', () => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_ID, '1'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.APPLICATION_REFERENCE, '123456789'); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.BACK_TO_OFFICE, - AnalyticsEvents.DEFER_WRITE_UP, - 'pass', - ); - // GA4 Analytics expect(analyticsProviderMock.addGACustomDimension) .toHaveBeenCalledWith(GoogleAnalyticsCustomDimension.CANDIDATE_ID, '1'); @@ -174,18 +150,6 @@ describe('BackToOfficeAnalyticsEffects', () => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_ID, '1'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.APPLICATION_REFERENCE, '123456789'); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.BACK_TO_OFFICE, - AnalyticsEvents.DEFER_WRITE_UP, - 'fail', - ); - // GA4 Analytics expect(analyticsProviderMock.addGACustomDimension) .toHaveBeenCalledWith(GoogleAnalyticsCustomDimension.CANDIDATE_ID, '1'); @@ -213,18 +177,6 @@ describe('BackToOfficeAnalyticsEffects', () => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_ID, '1'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.APPLICATION_REFERENCE, '123456789'); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsEventCategories.BACK_TO_OFFICE}`, - `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsEvents.DEFER_WRITE_UP}`, - 'pass', - ); - // GA4 Analytics expect(analyticsProviderMock.addGACustomDimension) .toHaveBeenCalledWith(GoogleAnalyticsCustomDimension.CANDIDATE_ID, '1'); @@ -239,6 +191,7 @@ describe('BackToOfficeAnalyticsEffects', () => { done(); }); }); + it('should call logEvent with fail page, practice mode prefix and addCustomDimension', (done) => { // ARRANGE store$.dispatch(fakeJournalActions.StartE2EPracticeTest(end2endPracticeSlotId)); @@ -252,18 +205,6 @@ describe('BackToOfficeAnalyticsEffects', () => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_ID, '1'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.APPLICATION_REFERENCE, '123456789'); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsEventCategories.BACK_TO_OFFICE}`, - `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsEvents.DEFER_WRITE_UP}`, - 'fail', - ); - // GA4 Analytics expect(analyticsProviderMock.addGACustomDimension) .toHaveBeenCalledWith(GoogleAnalyticsCustomDimension.CANDIDATE_ID, '1'); diff --git a/src/app/pages/back-to-office/back-to-office.analytics.effects.ts b/src/app/pages/back-to-office/back-to-office.analytics.effects.ts index 8f6ddb2f5..a70200bf3 100644 --- a/src/app/pages/back-to-office/back-to-office.analytics.effects.ts +++ b/src/app/pages/back-to-office/back-to-office.analytics.effects.ts @@ -6,9 +6,6 @@ import { } from 'rxjs/operators'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { - AnalyticsDimensionIndices, - AnalyticsEventCategories, - AnalyticsEvents, AnalyticsScreenNames, GoogleAnalyticsCustomDimension, GoogleAnalyticsEvents, @@ -21,7 +18,7 @@ import { getCurrentTest, getJournalData, isPassed, isPracticeMode, } from '@store/tests/tests.selector'; import { getTests } from '@store/tests/tests.reducer'; -import { analyticsEventTypePrefix, formatAnalyticsText } from '@shared/helpers/format-analytics-text'; +import { analyticsEventTypePrefix } from '@shared/helpers/format-analytics-text'; import { TestsModel } from '@store/tests/tests.model'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; import { getCandidate } from '@store/tests/journal-data/common/candidate/candidate.reducer'; @@ -64,10 +61,6 @@ export class BackToOfficeAnalyticsEffects { : this.appConfigProvider.getAppConfig()?.journal?.enablePracticeModeAnalytics), switchMap(([, tests]: [ReturnType, TestsModel, boolean]) => { - // TODO - MES-9495 - remove old analytics - const screenName = formatAnalyticsText(AnalyticsScreenNames.BACK_TO_OFFICE, tests); - this.analytics.setCurrentPage(screenName); - // GA4 analytics this.analytics.setGACurrentPage(analyticsEventTypePrefix(AnalyticsScreenNames.BACK_TO_OFFICE, tests)); return of(AnalyticRecorded()); @@ -113,16 +106,6 @@ export class BackToOfficeAnalyticsEffects { switchMap(([, tests, isTestPassed, candidateId, applicationReference]: [ReturnType, TestsModel, boolean, number, string, boolean]) => { - // TODO - MES-9495 - remove old analytics - this.analytics.addCustomDimension(AnalyticsDimensionIndices.CANDIDATE_ID, `${candidateId}`); - this.analytics.addCustomDimension(AnalyticsDimensionIndices.APPLICATION_REFERENCE, applicationReference); - - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.BACK_TO_OFFICE, tests), - formatAnalyticsText(AnalyticsEvents.DEFER_WRITE_UP, tests), - isTestPassed ? 'pass' : 'fail', - ); - //GA4 Analytics this.analytics.addGACustomDimension(GoogleAnalyticsCustomDimension.CANDIDATE_ID, `${candidateId}`); this.analytics.addGACustomDimension( @@ -157,13 +140,6 @@ export class BackToOfficeAnalyticsEffects { : this.appConfigProvider.getAppConfig()?.journal?.enablePracticeModeAnalytics), switchMap(([, tests]: [ReturnType, TestsModel, boolean]) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.ERROR, tests), - formatAnalyticsText(AnalyticsEvents.ASAM, tests), - 'Modal Triggered', - ); - //GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.ASAM, tests), diff --git a/src/app/pages/candidate-details/__tests__/candidate-details.analytics.effects.spec.ts b/src/app/pages/candidate-details/__tests__/candidate-details.analytics.effects.spec.ts index 461284a5b..bca1df4f2 100644 --- a/src/app/pages/candidate-details/__tests__/candidate-details.analytics.effects.spec.ts +++ b/src/app/pages/candidate-details/__tests__/candidate-details.analytics.effects.spec.ts @@ -5,10 +5,10 @@ import { provideMockActions } from '@ngrx/effects/testing'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { - AnalyticsDimensionIndices, - AnalyticsEventCategories, - AnalyticsEvents, - AnalyticsScreenNames, GoogleAnalyticsCustomDimension, GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, + AnalyticsScreenNames, + GoogleAnalyticsCustomDimension, + GoogleAnalyticsEvents, + GoogleAnalyticsEventsTitles, } from '@providers/analytics/analytics.model'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; import { StoreModel } from '@shared/models/store.model'; @@ -71,7 +71,6 @@ describe('CandidateDetailsAnalyticsEffects', () => { effects = TestBed.inject(CandidateDetailsAnalyticsEffects); analyticsProviderMock = TestBed.inject(AnalyticsProvider); store$ = TestBed.inject(Store); - spyOn(analyticsProviderMock, 'logEvent'); })); describe('candidateView$', () => { @@ -86,16 +85,6 @@ describe('CandidateDetailsAnalyticsEffects', () => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_ID, '123'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_WITH_SPECIAL_NEEDS, '1'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_WITH_CHECK, '1'); - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(screenName); - // GA4 Analytics expect(analyticsProviderMock.setGACurrentPage) .toHaveBeenCalledWith(screenName); @@ -120,15 +109,6 @@ describe('CandidateDetailsAnalyticsEffects', () => { effects.candidateModalDismiss$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_ID, null); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_WITH_SPECIAL_NEEDS, null); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_WITH_CHECK, null); - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(AnalyticsScreenNames.JOURNAL); // GA4 Analytics expect(analyticsProviderMock.setGACurrentPage) @@ -155,14 +135,6 @@ describe('CandidateDetailsAnalyticsEffects', () => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.JOURNAL, - AnalyticsEvents.SLOT_CHANGE_VIEWED, - '123', - ); - // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( diff --git a/src/app/pages/candidate-details/candidate-details.analytics.effects.ts b/src/app/pages/candidate-details/candidate-details.analytics.effects.ts index d78bb74f8..e66711f00 100644 --- a/src/app/pages/candidate-details/candidate-details.analytics.effects.ts +++ b/src/app/pages/candidate-details/candidate-details.analytics.effects.ts @@ -6,10 +6,8 @@ import { } from 'rxjs/operators'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { - AnalyticsDimensionIndices, - AnalyticsEventCategories, - AnalyticsEvents, - AnalyticsScreenNames, GoogleAnalyticsCustomDimension, + AnalyticsScreenNames, + GoogleAnalyticsCustomDimension, GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, } from '@providers/analytics/analytics.model'; @@ -60,13 +58,6 @@ export class CandidateDetailsAnalyticsEffects { const candidateCheck = isCandidateCheckNeeded(slot); const candidateId = getCandidateId(slot); - // TODO - MES-9495 - remove old analytics - this.analytics.addCustomDimension(AnalyticsDimensionIndices.CANDIDATE_ID, candidateId?.toString()); - this.analytics.addCustomDimension(AnalyticsDimensionIndices.CANDIDATE_WITH_SPECIAL_NEEDS, - specNeeds ? '1' : '0'); - this.analytics.addCustomDimension(AnalyticsDimensionIndices.CANDIDATE_WITH_CHECK, candidateCheck ? '1' : '0'); - this.analytics.setCurrentPage(AnalyticsScreenNames.CANDIDATE_DETAILS); - // GA4 Analytics this.analytics.setGACurrentPage(AnalyticsScreenNames.CANDIDATE_DETAILS); this.analytics.addGACustomDimension(GoogleAnalyticsCustomDimension.CANDIDATE_ID, candidateId?.toString()); @@ -97,12 +88,6 @@ export class CandidateDetailsAnalyticsEffects { : this.appConfigProvider.getAppConfig()?.journal?.enablePracticeModeAnalytics), switchMap(([{ sourcePage }]: [ReturnType, boolean]) => { - // TODO - MES-9495 - remove old analytics - this.analytics.addCustomDimension(AnalyticsDimensionIndices.CANDIDATE_ID, null); - this.analytics.addCustomDimension(AnalyticsDimensionIndices.CANDIDATE_WITH_SPECIAL_NEEDS, null); - this.analytics.addCustomDimension(AnalyticsDimensionIndices.CANDIDATE_WITH_CHECK, null); - this.analytics.setCurrentPage(mapAnalyticsScreenName(sourcePage)); - // GA4 Analytics this.analytics.setGACurrentPage(mapAnalyticsScreenName(sourcePage)); this.analytics.addGACustomDimension(GoogleAnalyticsCustomDimension.CANDIDATE_ID, null); @@ -129,13 +114,6 @@ export class CandidateDetailsAnalyticsEffects { : this.appConfigProvider.getAppConfig()?.journal?.enablePracticeModeAnalytics), switchMap(([action]: [ReturnType, boolean]) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.JOURNAL, - AnalyticsEvents.SLOT_CHANGE_VIEWED, - action.slotId.toString(), - ); - // GA4 Analytics this.analytics.logGAEvent( GoogleAnalyticsEvents.JOURNAL, diff --git a/src/app/pages/candidate-licence/candidate-licence.analytics.effects.ts b/src/app/pages/candidate-licence/candidate-licence.analytics.effects.ts index 8b15e7ab9..5d822d498 100644 --- a/src/app/pages/candidate-licence/candidate-licence.analytics.effects.ts +++ b/src/app/pages/candidate-licence/candidate-licence.analytics.effects.ts @@ -8,7 +8,7 @@ import { of } from 'rxjs'; import { select, Store } from '@ngrx/store'; import { getTests } from '@store/tests/tests.reducer'; import { TestsModel } from '@store/tests/tests.model'; -import { analyticsEventTypePrefix, formatAnalyticsText } from '@shared/helpers/format-analytics-text'; +import { analyticsEventTypePrefix } from '@shared/helpers/format-analytics-text'; import { AnalyticsScreenNames } from '@providers/analytics/analytics.model'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; import { CandidateLicenceViewDidEnter } from '@pages/candidate-licence/candidate-licence.actions'; @@ -45,10 +45,6 @@ export class CandidateLicenceAnalyticsEffects { : this.appConfigProvider.getAppConfig()?.journal?.enablePracticeModeAnalytics), switchMap(([, tests]: [ReturnType, TestsModel, boolean]) => { - // TODO - MES-9495 - remove old analytics - const screenName = formatAnalyticsText(AnalyticsScreenNames.CANDIDATE_LICENCE_INFO, tests); - this.analytics.setCurrentPage(screenName); - // GA4 Analytics this.analytics.setGACurrentPage(analyticsEventTypePrefix(AnalyticsScreenNames.CANDIDATE_LICENCE_INFO, tests)); return of(AnalyticRecorded()); diff --git a/src/app/pages/communication/__tests__/communication.analytics.effects.spec.ts b/src/app/pages/communication/__tests__/communication.analytics.effects.spec.ts index 85e03704c..083bf43a0 100644 --- a/src/app/pages/communication/__tests__/communication.analytics.effects.spec.ts +++ b/src/app/pages/communication/__tests__/communication.analytics.effects.spec.ts @@ -17,10 +17,6 @@ import { candidateMock } from '@store/tests/__mocks__/tests.mock'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { PopulateTestCategory } from '@store/tests/category/category.actions'; import { - AnalyticsDimensionIndices, - AnalyticsErrorTypes, - AnalyticsEventCategories, - AnalyticsEvents, AnalyticsScreenNames, GoogleAnalyticsCustomDimension, GoogleAnalyticsEventPrefix, GoogleAnalyticsEvents, @@ -46,8 +42,6 @@ describe('CommunicationAnalyticsEffects', () => { let actions$: ReplaySubject; let store$: Store; const screenName = AnalyticsScreenNames.COMMUNICATION; - // TODO - MES-9495 - remove old analytics - const screenNamePracticeMode = `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsScreenNames.COMMUNICATION}`; const screenNamePM = `${GoogleAnalyticsEventPrefix.PRACTICE_MODE}_${AnalyticsScreenNames.COMMUNICATION}`; const mockApplication: Application = { applicationId: 123456, @@ -85,7 +79,6 @@ describe('CommunicationAnalyticsEffects', () => { effects = TestBed.inject(CommunicationAnalyticsEffects); analyticsProviderMock = TestBed.inject(AnalyticsProvider); store$ = TestBed.inject(Store); - spyOn(analyticsProviderMock, 'logEvent'); })); describe('communicationViewDidEnter', () => { @@ -101,15 +94,6 @@ describe('CommunicationAnalyticsEffects', () => { effects.communicationViewDidEnter$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.TEST_CATEGORY, 'B'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_ID, '1'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.APPLICATION_REFERENCE, '123456789'); - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(screenName); // GA4 Analytics expect(analyticsProviderMock.setGACurrentPage) .toHaveBeenCalledWith(screenName); @@ -134,15 +118,6 @@ describe('CommunicationAnalyticsEffects', () => { effects.communicationViewDidEnter$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.TEST_CATEGORY, 'B'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_ID, '1'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.APPLICATION_REFERENCE, '123456789'); - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(screenNamePracticeMode); // GA4 Analytics expect(analyticsProviderMock.setGACurrentPage) .toHaveBeenCalledWith(screenNamePM); @@ -169,11 +144,6 @@ describe('CommunicationAnalyticsEffects', () => { effects.communicationValidationError$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.TEST_CATEGORY, 'B'); - expect(analyticsProviderMock.logError) - .toHaveBeenCalledWith(`${AnalyticsErrorTypes.VALIDATION_ERROR} (${screenName})`, 'formControl1'); // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -193,10 +163,6 @@ describe('CommunicationAnalyticsEffects', () => { effects.communicationValidationError$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logError) - .toHaveBeenCalledWith(`${AnalyticsErrorTypes.VALIDATION_ERROR} (${screenNamePracticeMode})`, - 'formControl1'); // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -220,13 +186,6 @@ describe('CommunicationAnalyticsEffects', () => { effects.vrnModalOpened$.subscribe((result: ReturnType) => { expect(result.type) .toBe(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.COMMUNICATION, - AnalyticsEvents.VRN_CAPTURE, - AnalyticsEvents.VRN_CAPTURE_SELECTED, - ); // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -250,13 +209,6 @@ describe('CommunicationAnalyticsEffects', () => { effects.vrnModalCancelled$.subscribe((result: ReturnType) => { expect(result.type) .toBe(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.COMMUNICATION, - AnalyticsEvents.VRN_CAPTURE, - AnalyticsEvents.VRN_CAPTURE_CANCELLED, - ); // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -280,13 +232,6 @@ describe('CommunicationAnalyticsEffects', () => { effects.vrnModalSaved$.subscribe((result: ReturnType) => { expect(result.type) .toBe(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.COMMUNICATION, - AnalyticsEvents.VRN_CAPTURE, - AnalyticsEvents.VRN_CAPTURE_SAVED, - ); // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -304,13 +249,6 @@ describe('CommunicationAnalyticsEffects', () => { effects.bookingEmailSelected$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.COMMUNICATION, - AnalyticsEvents.CANDIDATE_RECEIVE_TEST_RESULTS, - 'Booking Email', - ); // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -329,13 +267,6 @@ describe('CommunicationAnalyticsEffects', () => { effects.newEmailSelected$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.COMMUNICATION, - AnalyticsEvents.CANDIDATE_RECEIVE_TEST_RESULTS, - 'New Email', - ); // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -354,13 +285,6 @@ describe('CommunicationAnalyticsEffects', () => { effects.postalSelected$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.COMMUNICATION, - AnalyticsEvents.CANDIDATE_RECEIVE_TEST_RESULTS, - 'By Post', - ); // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( diff --git a/src/app/pages/communication/communication.analytics.effects.ts b/src/app/pages/communication/communication.analytics.effects.ts index e27bcb2f3..8f24fd195 100644 --- a/src/app/pages/communication/communication.analytics.effects.ts +++ b/src/app/pages/communication/communication.analytics.effects.ts @@ -6,10 +6,6 @@ import { } from 'rxjs/operators'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { - AnalyticsDimensionIndices, - AnalyticsErrorTypes, - AnalyticsEventCategories, - AnalyticsEvents, AnalyticsScreenNames, GoogleAnalyticsCustomDimension, GoogleAnalyticsEvents, @@ -17,7 +13,7 @@ import { GoogleAnalyticsEventsValues, } from '@providers/analytics/analytics.model'; import { TestsModel } from '@store/tests/tests.model'; -import { analyticsEventTypePrefix, formatAnalyticsText } from '@shared/helpers/format-analytics-text'; +import { analyticsEventTypePrefix } from '@shared/helpers/format-analytics-text'; import { AnalyticNotRecorded, AnalyticRecorded } from '@providers/analytics/analytics.actions'; import { StoreModel } from '@shared/models/store.model'; import { select, Store } from '@ngrx/store'; @@ -102,13 +98,6 @@ export class CommunicationAnalyticsEffects { [, tests, applicationReference, candidateId, category]: [ReturnType, TestsModel, string, number, CategoryCode, boolean], ) => { - - // TODO - MES-9495 - remove old analytics - this.analytics.addCustomDimension(AnalyticsDimensionIndices.TEST_CATEGORY, category); - this.analytics.addCustomDimension(AnalyticsDimensionIndices.CANDIDATE_ID, `${candidateId}`); - this.analytics.addCustomDimension(AnalyticsDimensionIndices.APPLICATION_REFERENCE, applicationReference); - this.analytics.setCurrentPage(formatAnalyticsText(AnalyticsScreenNames.COMMUNICATION, tests)); - //GA4 Analytics this.analytics.setGACurrentPage(analyticsEventTypePrefix(AnalyticsScreenNames.COMMUNICATION, tests)); @@ -143,14 +132,9 @@ export class CommunicationAnalyticsEffects { filter(([, , , practiceMode]) => !practiceMode ? true : this.appConfigProvider.getAppConfig()?.journal?.enablePracticeModeAnalytics), - switchMap(([action, tests, category]: + switchMap(([action, tests, ]: [ReturnType, TestsModel, CategoryCode, boolean]) => { - // TODO - MES-9495 - remove old analytics - const screenName = formatAnalyticsText(AnalyticsScreenNames.COMMUNICATION, tests); - this.analytics.addCustomDimension(AnalyticsDimensionIndices.TEST_CATEGORY, category); - this.analytics.logError(`${AnalyticsErrorTypes.VALIDATION_ERROR} (${screenName})`, action.errorMessage); - // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.VALIDATION_ERROR, tests), @@ -181,13 +165,6 @@ export class CommunicationAnalyticsEffects { concatMap(([, tests]: [ReturnType, TestsModel, boolean]) => { if (this.router.url?.startsWith(this.className)) { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.COMMUNICATION, tests), - AnalyticsEvents.VRN_CAPTURE, - AnalyticsEvents.VRN_CAPTURE_SELECTED, - ); - // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.VRN_CAPTURE, tests), @@ -221,13 +198,6 @@ export class CommunicationAnalyticsEffects { concatMap(([, tests]: [ReturnType, TestsModel, boolean]) => { if (this.router.url?.startsWith(this.className)) { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.COMMUNICATION, tests), - AnalyticsEvents.VRN_CAPTURE, - AnalyticsEvents.VRN_CAPTURE_CANCELLED, - ); - // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.VRN_CAPTURE, tests), @@ -260,13 +230,6 @@ export class CommunicationAnalyticsEffects { concatMap(([, tests]: [ReturnType, TestsModel, boolean]) => { if (this.router.url?.startsWith(this.className)) { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.COMMUNICATION, tests), - AnalyticsEvents.VRN_CAPTURE, - AnalyticsEvents.VRN_CAPTURE_SAVED, - ); - // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.VRN_CAPTURE, tests), @@ -299,13 +262,6 @@ export class CommunicationAnalyticsEffects { concatMap(([, tests]: [ReturnType, TestsModel, boolean]) => { if (this.router.url?.startsWith(this.className)) { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.COMMUNICATION, - AnalyticsEvents.CANDIDATE_RECEIVE_TEST_RESULTS, - 'Booking Email', - ); - // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.CANDIDATE_RECEIVE_TEST_RESULTS, tests), @@ -345,13 +301,6 @@ export class CommunicationAnalyticsEffects { GoogleAnalyticsEventsTitles.COMMS_CHANNEL, GoogleAnalyticsEventsValues.COMMS_METHOD_NEW_EMAIL, ); - - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.COMMUNICATION, - AnalyticsEvents.CANDIDATE_RECEIVE_TEST_RESULTS, - 'New Email', - ); return of(AnalyticRecorded()); } return of(AnalyticNotRecorded()); @@ -378,13 +327,6 @@ export class CommunicationAnalyticsEffects { concatMap(([, tests]: [ReturnType, TestsModel, boolean]) => { if (this.router.url?.startsWith(this.className)) { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.COMMUNICATION, - AnalyticsEvents.CANDIDATE_RECEIVE_TEST_RESULTS, - 'By Post', - ); - // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.CANDIDATE_RECEIVE_TEST_RESULTS, tests), diff --git a/src/app/pages/confirm-test-details/__tests__/confirm-test-details.analytics.effects.spec.ts b/src/app/pages/confirm-test-details/__tests__/confirm-test-details.analytics.effects.spec.ts index e4f5eea90..a4a888740 100644 --- a/src/app/pages/confirm-test-details/__tests__/confirm-test-details.analytics.effects.spec.ts +++ b/src/app/pages/confirm-test-details/__tests__/confirm-test-details.analytics.effects.spec.ts @@ -7,8 +7,6 @@ import { Store, StoreModule } from '@ngrx/store'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { - AnalyticsEventCategories, - AnalyticsEvents, AnalyticsScreenNames, GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, GoogleAnalyticsEventsValues, } from '@providers/analytics/analytics.model'; @@ -55,7 +53,6 @@ describe('ConfirmTestDetailsAnalyticsEffects', () => { effects = TestBed.inject(ConfirmTestDetailsAnalyticsEffects); store$ = TestBed.inject(Store); analyticsProviderMock = TestBed.inject(AnalyticsProvider); - spyOn(analyticsProviderMock, 'logEvent'); })); describe('confirmTestDetailsView$', () => { @@ -64,8 +61,6 @@ describe('ConfirmTestDetailsAnalyticsEffects', () => { effects.confirmTestDetailsView$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(screenName); expect(analyticsProviderMock.setGACurrentPage) .toHaveBeenCalledWith(screenName); done(); @@ -78,12 +73,6 @@ describe('ConfirmTestDetailsAnalyticsEffects', () => { actions$.next(confirmTestDetailsActions.BackToDebrief()); effects.backToDebriefClicked$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsEventCategories.NAVIGATION}`, - `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsEvents.BACK}`, - 'Back to debrief', - ); expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( GoogleAnalyticsEvents.NAVIGATION, @@ -100,12 +89,6 @@ describe('ConfirmTestDetailsAnalyticsEffects', () => { actions$.next(confirmTestDetailsActions.BackButtonClick()); effects.backButtonClicked$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsEventCategories.NAVIGATION}`, - `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsEvents.BACK}`, - 'Back to finalise outcome', - ); expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( GoogleAnalyticsEvents.NAVIGATION, diff --git a/src/app/pages/confirm-test-details/confirm-test-details.analytics.effects.ts b/src/app/pages/confirm-test-details/confirm-test-details.analytics.effects.ts index 41b81bc34..ad4f527bb 100644 --- a/src/app/pages/confirm-test-details/confirm-test-details.analytics.effects.ts +++ b/src/app/pages/confirm-test-details/confirm-test-details.analytics.effects.ts @@ -6,8 +6,6 @@ import { } from 'rxjs/operators'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { - AnalyticsEventCategories, - AnalyticsEvents, AnalyticsScreenNames, GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, @@ -19,7 +17,7 @@ import { BackToDebrief, ConfirmTestDetailsViewDidEnter, } from '@pages/confirm-test-details/confirm-test-details.actions'; -import { analyticsEventTypePrefix, formatAnalyticsText } from '@shared/helpers/format-analytics-text'; +import { analyticsEventTypePrefix } from '@shared/helpers/format-analytics-text'; import { select, Store } from '@ngrx/store'; import { getTests } from '@store/tests/tests.reducer'; import { StoreModel } from '@shared/models/store.model'; @@ -58,8 +56,6 @@ export class ConfirmTestDetailsAnalyticsEffects { switchMap(( [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.setCurrentPage(AnalyticsScreenNames.CONFIRM_TEST_DETAILS); // GA4 Analytics this.analytics.setGACurrentPage(analyticsEventTypePrefix(AnalyticsScreenNames.CONFIRM_TEST_DETAILS, tests)); return of(AnalyticRecorded()); @@ -83,13 +79,7 @@ export class ConfirmTestDetailsAnalyticsEffects { filter(([, , practiceMode]) => !practiceMode ? true : this.appConfigProvider.getAppConfig()?.journal?.enablePracticeModeAnalytics), - concatMap(([, tests]: [ReturnType, TestsModel, boolean]) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.NAVIGATION, tests), - formatAnalyticsText(AnalyticsEvents.BACK, tests), - 'Back to debrief', - ); + concatMap(([, ]: [ReturnType, TestsModel, boolean]) => { // GA4 Analytics this.analytics.logGAEvent( GoogleAnalyticsEvents.NAVIGATION, @@ -117,13 +107,8 @@ export class ConfirmTestDetailsAnalyticsEffects { filter(([, , practiceMode]) => !practiceMode ? true : this.appConfigProvider.getAppConfig()?.journal?.enablePracticeModeAnalytics), - concatMap(([, tests]: [ReturnType, TestsModel, boolean]) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.NAVIGATION, tests), - formatAnalyticsText(AnalyticsEvents.BACK, tests), - 'Back to finalise outcome', - ); + concatMap(([,]: [ReturnType, TestsModel, boolean]) => { + // GA4 Analytics this.analytics.logGAEvent( GoogleAnalyticsEvents.NAVIGATION, diff --git a/src/app/pages/dashboard/__tests__/dashboard.analytics.effects.spec.ts b/src/app/pages/dashboard/__tests__/dashboard.analytics.effects.spec.ts index df8231b35..6ececaf0f 100644 --- a/src/app/pages/dashboard/__tests__/dashboard.analytics.effects.spec.ts +++ b/src/app/pages/dashboard/__tests__/dashboard.analytics.effects.spec.ts @@ -5,8 +5,6 @@ import { provideMockActions } from '@ngrx/effects/testing'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { - AnalyticsEventCategories, - AnalyticsEvents, AnalyticsScreenNames, GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, GoogleAnalyticsEventsValues, } from '@providers/analytics/analytics.model'; @@ -60,7 +58,6 @@ describe('DashboardAnalyticsEffects', () => { actions$ = new ReplaySubject(1); effects = TestBed.inject(DashboardAnalyticsEffects); analyticsProviderMock = TestBed.inject(AnalyticsProvider); - spyOn(analyticsProviderMock, 'logEvent'); })); describe('dashboardViewDidEnter', () => { @@ -69,9 +66,6 @@ describe('DashboardAnalyticsEffects', () => { effects.dashboardViewDidEnter$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(screenName); // GA4 analytics expect(analyticsProviderMock.setGACurrentPage) .toHaveBeenCalledWith(screenName); @@ -85,12 +79,6 @@ describe('DashboardAnalyticsEffects', () => { effects.practiceTestReportSelected$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.DASHBOARD, - AnalyticsEvents.PRACTICE_TEST_SELECTED, - ); // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -108,13 +96,6 @@ describe('DashboardAnalyticsEffects', () => { effects.sideMenuOpen$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.DASHBOARD, - AnalyticsEvents.SIDE_MENU, - 'Menu Opened', - ); // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -132,13 +113,6 @@ describe('DashboardAnalyticsEffects', () => { effects.sideMenuClosed$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.DASHBOARD, - AnalyticsEvents.SIDE_MENU, - 'Menu Closed', - ); // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -156,13 +130,6 @@ describe('DashboardAnalyticsEffects', () => { effects.sideMenuItemSelected$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.DASHBOARD, - AnalyticsEvents.SIDE_MENU, - 'opt1 Selected', - ); // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -180,16 +147,14 @@ describe('DashboardAnalyticsEffects', () => { effects.updateAvailablePopup$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.APP_UPDATE_BADGE, - 'Modal', - 'New version modal displayed', - ); // GA4 Analytics - // TBC + expect(analyticsProviderMock.logGAEvent) + .toHaveBeenCalledWith( + GoogleAnalyticsEvents.APP_UPDATE, + GoogleAnalyticsEventsTitles.STATUS, + GoogleAnalyticsEventsValues.OPEN, + ); done(); }); }); @@ -201,16 +166,13 @@ describe('DashboardAnalyticsEffects', () => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) + // GA4 Analytics + expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( - AnalyticsEventCategories.APP_UPDATE_BADGE, - 'Modal', - 'Ok button selected', + GoogleAnalyticsEvents.APP_UPDATE, + GoogleAnalyticsEventsTitles.STATUS, + UpdateAvailable.OK, ); - - // GA4 Analytics - // TBC done(); }); }); @@ -222,42 +184,33 @@ describe('DashboardAnalyticsEffects', () => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) + // GA4 Analytics + expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( - AnalyticsEventCategories.APP_UPDATE_BADGE, - 'New version badge selected', + GoogleAnalyticsEvents.APP_UPDATE, + GoogleAnalyticsEventsTitles.STATUS, + GoogleAnalyticsEventsValues.CLICKED, ); - - // GA4 Analytics - // TBC done(); }); }); - describe('detectDeviceTheme$', () => { - it('should log an event', (done) => { - actions$.next(DetectDeviceTheme()); - effects.detectDeviceTheme$.subscribe((result) => { - expect(result.type === AnalyticRecorded.type) - .toBe(true); + }); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.METADATA, - 'Device theme', - 'Light mode', - ); + describe('detectDeviceTheme$', () => { + it('should log an event', (done) => { + actions$.next(DetectDeviceTheme()); + effects.detectDeviceTheme$.subscribe((result) => { + expect(result.type === AnalyticRecorded.type) + .toBe(true); - // GA4 Analytics - expect(analyticsProviderMock.logGAEvent) - .toHaveBeenCalledWith( - GoogleAnalyticsEvents.METADATA, - GoogleAnalyticsEventsTitles.DEVICE_THEME, - GoogleAnalyticsEventsValues.LIGHT_MODE, - ); - done(); - }); + // GA4 Analytics + expect(analyticsProviderMock.logGAEvent) + .toHaveBeenCalledWith( + GoogleAnalyticsEvents.METADATA, + GoogleAnalyticsEventsTitles.DEVICE_THEME, + GoogleAnalyticsEventsValues.LIGHT_MODE, + ); + done(); }); }); }); diff --git a/src/app/pages/dashboard/dashboard.analytics.effects.ts b/src/app/pages/dashboard/dashboard.analytics.effects.ts index af18af07e..51af7e106 100644 --- a/src/app/pages/dashboard/dashboard.analytics.effects.ts +++ b/src/app/pages/dashboard/dashboard.analytics.effects.ts @@ -5,8 +5,6 @@ import { concatMap, mergeMap, switchMap, withLatestFrom } from 'rxjs/operators'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { - AnalyticsEventCategories, - AnalyticsEvents, AnalyticsScreenNames, GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, GoogleAnalyticsEventsValues, } from '@providers/analytics/analytics.model'; @@ -55,9 +53,6 @@ export class DashboardAnalyticsEffects { ), )), switchMap(() => { - // TODO - MES-9495 - remove old analytics - this.analytics.setCurrentPage(AnalyticsScreenNames.DASHBOARD); - // GA4 analytics this.analytics.setGACurrentPage(AnalyticsScreenNames.DASHBOARD); return of(AnalyticRecorded()); @@ -76,13 +71,6 @@ export class DashboardAnalyticsEffects { ), )), switchMap(() => { - - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.DASHBOARD, - AnalyticsEvents.PRACTICE_TEST_SELECTED, - ); - // GA4 Analytics this.analytics.logGAEvent( GoogleAnalyticsEvents.PRACTICE_MODE_NAVIGATION, @@ -105,13 +93,6 @@ export class DashboardAnalyticsEffects { ), )), switchMap(() => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.DASHBOARD, - AnalyticsEvents.SIDE_MENU, - 'Menu Opened', - ); - // GA4 Analytics this.analytics.logGAEvent( GoogleAnalyticsEvents.MENU, @@ -134,14 +115,6 @@ export class DashboardAnalyticsEffects { ), )), switchMap(() => { - - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.DASHBOARD, - AnalyticsEvents.SIDE_MENU, - 'Menu Closed', - ); - // GA4 Analytics this.analytics.logGAEvent( GoogleAnalyticsEvents.MENU, @@ -164,14 +137,6 @@ export class DashboardAnalyticsEffects { ), )), switchMap(([{ item }]) => { - - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.DASHBOARD, - AnalyticsEvents.SIDE_MENU, - `${item} Selected`, - ); - // GA4 Analytics this.analytics.logGAEvent( GoogleAnalyticsEvents.MENU, @@ -195,13 +160,6 @@ export class DashboardAnalyticsEffects { )), mergeMap(() => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.APP_UPDATE_BADGE, - 'Modal', - 'New version modal displayed', - ); - // GA4 Analytics this.analytics.logGAEvent( GoogleAnalyticsEvents.APP_UPDATE, @@ -224,19 +182,11 @@ export class DashboardAnalyticsEffects { ), )), mergeMap(([{ selected }]: [ReturnType, boolean]) => { - - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.APP_UPDATE_BADGE, - 'Modal', - `${selected} button selected`, - ); - // GA4 Analytics this.analytics.logGAEvent( GoogleAnalyticsEvents.APP_UPDATE, GoogleAnalyticsEventsTitles.STATUS, - '${selected}' + `${selected}` ); return of(AnalyticRecorded()); }), @@ -255,12 +205,6 @@ export class DashboardAnalyticsEffects { )), mergeMap(() => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.APP_UPDATE_BADGE, - 'New version badge selected', - ); - // GA4 Analytics this.analytics.logGAEvent( GoogleAnalyticsEvents.APP_UPDATE, @@ -275,13 +219,6 @@ export class DashboardAnalyticsEffects { ofType(DetectDeviceTheme), switchMap(() => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.METADATA, - 'Device theme', - isDeviceThemeDarkMode() ? 'Dark mode' : 'Light mode', - ); - this.analytics.logGAEvent( GoogleAnalyticsEvents.METADATA, GoogleAnalyticsEventsTitles.DEVICE_THEME, diff --git a/src/app/pages/debrief/__tests__/debrief.analytics.effects.spec.ts b/src/app/pages/debrief/__tests__/debrief.analytics.effects.spec.ts index cadc6a1a6..58da42033 100644 --- a/src/app/pages/debrief/__tests__/debrief.analytics.effects.spec.ts +++ b/src/app/pages/debrief/__tests__/debrief.analytics.effects.spec.ts @@ -5,7 +5,6 @@ import { provideMockActions } from '@ngrx/effects/testing'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { - AnalyticsEventCategories, AnalyticsScreenNames, GoogleAnalyticsEventPrefix, } from '@providers/analytics/analytics.model'; @@ -30,8 +29,6 @@ describe('DebriefAnalyticsEffects', () => { let store$: Store; const screenNamePass = AnalyticsScreenNames.PASS_DEBRIEF; const screenNameFail = AnalyticsScreenNames.FAIL_DEBRIEF; - const screenNamePracticeModePass = `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsScreenNames.PASS_DEBRIEF}`; - const screenNamePracticeModeFail = `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsScreenNames.FAIL_DEBRIEF}`; beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ @@ -72,9 +69,6 @@ describe('DebriefAnalyticsEffects', () => { effects.debriefViewDidEnter$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(screenNamePass); // GA4 Analytics expect(analyticsProviderMock.setGACurrentPage) .toHaveBeenCalledWith(screenNamePass); @@ -91,9 +85,6 @@ describe('DebriefAnalyticsEffects', () => { effects.debriefViewDidEnter$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(screenNameFail); // GA4 Analytics expect(analyticsProviderMock.setGACurrentPage) .toHaveBeenCalledWith(screenNameFail); @@ -110,9 +101,6 @@ describe('DebriefAnalyticsEffects', () => { effects.debriefViewDidEnter$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(screenNamePracticeModePass); // GA4 Analytics expect(analyticsProviderMock.setGACurrentPage) .toHaveBeenCalledWith(`${GoogleAnalyticsEventPrefix.PRACTICE_MODE}_${screenNamePass}`); @@ -129,9 +117,6 @@ describe('DebriefAnalyticsEffects', () => { effects.debriefViewDidEnter$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(screenNamePracticeModeFail); // GA4 Analytics expect(analyticsProviderMock.setGACurrentPage) .toHaveBeenCalledWith(`${GoogleAnalyticsEventPrefix.PRACTICE_MODE}_${screenNameFail}`); diff --git a/src/app/pages/debrief/debrief.analytics.effects.ts b/src/app/pages/debrief/debrief.analytics.effects.ts index fb29a6fde..e03ae06aa 100644 --- a/src/app/pages/debrief/debrief.analytics.effects.ts +++ b/src/app/pages/debrief/debrief.analytics.effects.ts @@ -10,7 +10,7 @@ import { DebriefViewDidEnter } from '@pages/debrief/debrief.actions'; import { StoreModel } from '@shared/models/store.model'; import { select, Store } from '@ngrx/store'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; -import { analyticsEventTypePrefix, formatAnalyticsText } from '@shared/helpers/format-analytics-text'; +import { analyticsEventTypePrefix } from '@shared/helpers/format-analytics-text'; import { getTests } from '@store/tests/tests.reducer'; import { getCurrentTest, isPassed, isPracticeMode } from '@store/tests/tests.selector'; import { TestsModel } from '@store/tests/tests.model'; @@ -50,16 +50,10 @@ export class DebriefAnalyticsEffects { ? true : this.appConfigProvider.getAppConfig()?.journal?.enablePracticeModeAnalytics), switchMap(([, tests, isTestPassed]: [ReturnType, TestsModel, boolean, boolean]) => { - // TODO - MES-9495 - remove old analytics - let screenName = isTestPassed - ? formatAnalyticsText(AnalyticsScreenNames.PASS_DEBRIEF, tests) - : formatAnalyticsText(AnalyticsScreenNames.FAIL_DEBRIEF, tests); - this.analytics.setCurrentPage(screenName); // GA4 Analytics - screenName = isTestPassed + const screenName = isTestPassed ? analyticsEventTypePrefix(AnalyticsScreenNames.PASS_DEBRIEF, tests) : analyticsEventTypePrefix(AnalyticsScreenNames.FAIL_DEBRIEF, tests); - this.analytics.setCurrentPage(screenName); this.analytics.setGACurrentPage(screenName); return of(AnalyticRecorded()); }), diff --git a/src/app/pages/fake-journal/__tests__/fake-journal.analytics.effects.spec.ts b/src/app/pages/fake-journal/__tests__/fake-journal.analytics.effects.spec.ts index d8535ed59..1421df40f 100644 --- a/src/app/pages/fake-journal/__tests__/fake-journal.analytics.effects.spec.ts +++ b/src/app/pages/fake-journal/__tests__/fake-journal.analytics.effects.spec.ts @@ -6,8 +6,6 @@ import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/ import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { - AnalyticsEventCategories, - AnalyticsEvents, AnalyticsScreenNames, GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, } from '@providers/analytics/analytics.model'; @@ -34,7 +32,6 @@ describe('FakeJournalAnalyticsEffects', () => { actions$ = new ReplaySubject(1); effects = TestBed.inject(FakeJournalAnalyticsEffects); analyticsProviderMock = TestBed.inject(AnalyticsProvider); - spyOn(analyticsProviderMock, 'logEvent'); })); describe('fakeJournalViewDidEnter', () => { @@ -43,9 +40,6 @@ describe('FakeJournalAnalyticsEffects', () => { effects.fakeJournalViewDidEnter$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.setCurrentPage).toHaveBeenCalledWith(screenName); - // GA4 Analytics expect(analyticsProviderMock.setGACurrentPage).toHaveBeenCalledWith(screenName); done(); @@ -59,13 +53,6 @@ describe('FakeJournalAnalyticsEffects', () => { effects.practiceStartFullTestAnalyticsEffect$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.FAKE_JOURNAL, - AnalyticsEvents.PRACTICE_FULL_TEST_SELECTED, - 'B', - ); - // GA4 Analytics expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( GoogleAnalyticsEvents.PRACTICE_MODE_NAVIGATION, diff --git a/src/app/pages/fake-journal/fake-journal.analytics.effects.ts b/src/app/pages/fake-journal/fake-journal.analytics.effects.ts index ac9b42d80..a60c465d3 100644 --- a/src/app/pages/fake-journal/fake-journal.analytics.effects.ts +++ b/src/app/pages/fake-journal/fake-journal.analytics.effects.ts @@ -5,7 +5,6 @@ import { switchMap } from 'rxjs/operators'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { - AnalyticsEventCategories, AnalyticsEvents, AnalyticsScreenNames, GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, } from '@providers/analytics/analytics.model'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; @@ -23,8 +22,6 @@ export class FakeJournalAnalyticsEffects { fakeJournalViewDidEnter$ = createEffect(() => this.actions$.pipe( ofType(FakeJournalDidEnter), switchMap(() => { - // TODO - MES-9495 - remove old analytics - this.analytics.setCurrentPage(AnalyticsScreenNames.FAKE_JOURNAL); // GA4 Analytics this.analytics.setGACurrentPage(AnalyticsScreenNames.FAKE_JOURNAL); @@ -35,12 +32,6 @@ export class FakeJournalAnalyticsEffects { practiceStartFullTestAnalyticsEffect$ = createEffect(() => this.actions$.pipe( ofType(StartE2EPracticeTest), switchMap(({ category }: ReturnType) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.FAKE_JOURNAL, - AnalyticsEvents.PRACTICE_FULL_TEST_SELECTED, - category, - ); // GA4 Analytics this.analytics.logGAEvent( diff --git a/src/app/pages/health-declaration/__tests__/health-declaration.analytics.effects.spec.ts b/src/app/pages/health-declaration/__tests__/health-declaration.analytics.effects.spec.ts index ae8f9bb1a..96e55410b 100644 --- a/src/app/pages/health-declaration/__tests__/health-declaration.analytics.effects.spec.ts +++ b/src/app/pages/health-declaration/__tests__/health-declaration.analytics.effects.spec.ts @@ -5,9 +5,10 @@ import { provideMockActions } from '@ngrx/effects/testing'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { - AnalyticsErrorTypes, - AnalyticsEventCategories, - AnalyticsScreenNames, GoogleAnalyticsEventPrefix, GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, + AnalyticsScreenNames, + GoogleAnalyticsEventPrefix, + GoogleAnalyticsEvents, + GoogleAnalyticsEventsTitles, } from '@providers/analytics/analytics.model'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; import { StoreModel } from '@shared/models/store.model'; @@ -29,8 +30,6 @@ describe('HealthDeclarationAnalyticsEffects', () => { let actions$: ReplaySubject; let store$: Store; const screenName = AnalyticsScreenNames.HEALTH_DECLARATION; - // eslint-disable-next-line max-len - const screenNamePracticeMode = `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsScreenNames.HEALTH_DECLARATION}`; beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ @@ -72,10 +71,6 @@ describe('HealthDeclarationAnalyticsEffects', () => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(screenName); - expect(analyticsProviderMock.setGACurrentPage) .toHaveBeenCalledWith(screenName); done(); @@ -93,10 +88,6 @@ describe('HealthDeclarationAnalyticsEffects', () => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(screenNamePracticeMode); - expect(analyticsProviderMock.setGACurrentPage) .toHaveBeenCalledWith(`${GoogleAnalyticsEventPrefix.PRACTICE_MODE}_${screenName}`); done(); @@ -116,11 +107,6 @@ describe('HealthDeclarationAnalyticsEffects', () => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logError) - .toHaveBeenCalledWith(`${AnalyticsErrorTypes.VALIDATION_ERROR} (${AnalyticsScreenNames.HEALTH_DECLARATION})`, - 'error message'); - expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( GoogleAnalyticsEvents.VALIDATION_ERROR, @@ -129,25 +115,6 @@ describe('HealthDeclarationAnalyticsEffects', () => { done(); }); }); - - // TODO - MES-9495 - remove old analytics - it('should call logError with pass, prefixed with practice mode', (done) => { - // ARRANGE - store$.dispatch(fakeJournalActions.StartE2EPracticeTest(end2endPracticeSlotId)); - // eslint-disable-next-line max-len - const practiceScreenName = `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsScreenNames.HEALTH_DECLARATION}`; - // ACT - actions$.next(healthDeclarationActions.HealthDeclarationValidationError('error message')); - // ASSERT - effects.validationErrorEffect$.subscribe((result) => { - expect(result.type) - .toEqual(AnalyticRecorded.type); - expect(analyticsProviderMock.logError) - .toHaveBeenCalledWith(`${AnalyticsErrorTypes.VALIDATION_ERROR} (${practiceScreenName})`, - 'error message'); - done(); - }); - }); }); }); diff --git a/src/app/pages/health-declaration/health-declaration.analytics.effects.ts b/src/app/pages/health-declaration/health-declaration.analytics.effects.ts index 30028faa9..a77d65fa3 100644 --- a/src/app/pages/health-declaration/health-declaration.analytics.effects.ts +++ b/src/app/pages/health-declaration/health-declaration.analytics.effects.ts @@ -6,7 +6,6 @@ import { } from 'rxjs/operators'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { - AnalyticsErrorTypes, AnalyticsScreenNames, GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, @@ -14,7 +13,7 @@ import { import { StoreModel } from '@shared/models/store.model'; import { select, Store } from '@ngrx/store'; import { getTests } from '@store/tests/tests.reducer'; -import { analyticsEventTypePrefix, formatAnalyticsText } from '@shared/helpers/format-analytics-text'; +import { analyticsEventTypePrefix } from '@shared/helpers/format-analytics-text'; import { TestsModel } from '@store/tests/tests.model'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; import { isPracticeMode } from '@store/tests/tests.selector'; @@ -55,10 +54,6 @@ export class HealthDeclarationAnalyticsEffects { switchMap(( [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO - MES-9495 - remove old analytics - const screenName = formatAnalyticsText(AnalyticsScreenNames.HEALTH_DECLARATION, tests); - this.analytics.setCurrentPage(screenName); - //GA4 Analytics this.analytics.setGACurrentPage(analyticsEventTypePrefix(AnalyticsScreenNames.HEALTH_DECLARATION, tests)); return of(AnalyticRecorded()); @@ -86,13 +81,6 @@ export class HealthDeclarationAnalyticsEffects { [action, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO - MES-9495 - remove old analytics - const formattedScreenName = formatAnalyticsText(AnalyticsScreenNames.HEALTH_DECLARATION, tests); - this.analytics.logError( - `${AnalyticsErrorTypes.VALIDATION_ERROR} (${formattedScreenName})`, - action.errorMessage, - ); - // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.VALIDATION_ERROR, tests), diff --git a/src/app/pages/journal/__tests__/journal.analytics.effects.spec.ts b/src/app/pages/journal/__tests__/journal.analytics.effects.spec.ts index 84f2cecc8..4d2be0f03 100644 --- a/src/app/pages/journal/__tests__/journal.analytics.effects.spec.ts +++ b/src/app/pages/journal/__tests__/journal.analytics.effects.spec.ts @@ -6,9 +6,6 @@ import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { AnalyticsScreenNames, - AnalyticsEventCategories, - AnalyticsEvents, - AnalyticsDimensionIndices, JournalRefreshModes, GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, @@ -75,7 +72,6 @@ describe('JournalAnalyticsEffects', () => { actions$ = new ReplaySubject(1); effects = TestBed.inject(JournalAnalyticsEffects); analyticsProviderMock = TestBed.inject(AnalyticsProvider); - spyOn(analyticsProviderMock, 'logEvent'); })); describe('journalView', () => { @@ -83,12 +79,6 @@ describe('JournalAnalyticsEffects', () => { actions$.next(journalActions.JournalViewDidEnter()); effects.journalView$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(screenName); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_ID, ''); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.APPLICATION_REFERENCE, ''); expect(analyticsProviderMock.setGACurrentPage) .toHaveBeenCalledWith(screenName); @@ -107,14 +97,6 @@ describe('JournalAnalyticsEffects', () => { actions$.next(journalActions.JournalNavigateDay('1')); effects.journalNavigation$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.JOURNAL, - AnalyticsEvents.NAVIGATION, - 'Tomorrow', - ); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.JOURNAL_DAYS_FROM_TODAY, '4'); expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -134,12 +116,6 @@ describe('JournalAnalyticsEffects', () => { actions$.next(journalActions.JournalRefresh(JournalRefreshModes.AUTOMATIC)); effects.journalRefresh$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.JOURNAL, - AnalyticsEvents.REFRESH_JOURNAL, - JournalRefreshModes.AUTOMATIC, - ); expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( GoogleAnalyticsEvents.JOURNAL, @@ -155,10 +131,6 @@ describe('JournalAnalyticsEffects', () => { actions$.next(journalActions.EarlyStartModalDidEnter()); effects.earlyStartModalDidEnter$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.JOURNAL, - AnalyticsEvents.DISPLAY_EARLY_START_MODAL, - ); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( GoogleAnalyticsEvents.JOURNAL, GoogleAnalyticsEventsTitles.EARLY_START_MODAL, @@ -173,10 +145,6 @@ describe('JournalAnalyticsEffects', () => { actions$.next(journalActions.EarlyStartDidContinue()); effects.earlyStartModalContinue$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.JOURNAL, - AnalyticsEvents.EXIT_EARLY_START_MODAL_CONTINUE, - ); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( GoogleAnalyticsEvents.JOURNAL, GoogleAnalyticsEventsTitles.EARLY_START_MODAL, @@ -191,10 +159,6 @@ describe('JournalAnalyticsEffects', () => { actions$.next(journalActions.EarlyStartDidReturn()); effects.earlyStartModalReturn$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.JOURNAL, - AnalyticsEvents.EXIT_EARLY_START_MODAL_RETURN, - ); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( GoogleAnalyticsEvents.JOURNAL, GoogleAnalyticsEventsTitles.EARLY_START_MODAL, @@ -209,11 +173,6 @@ describe('JournalAnalyticsEffects', () => { actions$.next(journalActions.JournalRefreshError('error-description', 'error-message')); effects.journalRefreshError$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logError) - .toHaveBeenCalledWith( - 'error-description', - 'error-message', - ); expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( GoogleAnalyticsEvents.JOURNAL, @@ -229,11 +188,6 @@ describe('JournalAnalyticsEffects', () => { actions$.next(journalActions.JournalRefreshError('AutomaticJournalRefresh', 'error-message')); effects.journalRefreshError$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logError) - .toHaveBeenCalledWith( - 'AutomaticJournalRefresh', - 'error-message', - ); expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( GoogleAnalyticsEvents.JOURNAL, @@ -249,11 +203,6 @@ describe('JournalAnalyticsEffects', () => { actions$.next(journalActions.JournalRefreshError('ManualJournalRefresh', 'error-message')); effects.journalRefreshError$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logError) - .toHaveBeenCalledWith( - 'ManualJournalRefresh', - 'error-message', - ); expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( GoogleAnalyticsEvents.JOURNAL, @@ -271,12 +220,6 @@ describe('JournalAnalyticsEffects', () => { actions$.next(slotActions.SlotHasChanged(12345)); effects.slotChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.JOURNAL, - AnalyticsEvents.SLOT_CHANGED, - '12345', - ); expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( GoogleAnalyticsEvents.JOURNAL, @@ -293,18 +236,6 @@ describe('JournalAnalyticsEffects', () => { actions$.next(journalActions.ResumingWriteUp('123')); effects.resumingWriteUpEffect$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.POST_TEST, - AnalyticsEvents.RESUME_WRITE_UP, - 'pass', - ); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith( - AnalyticsDimensionIndices.APPLICATION_REFERENCE, - '1011',); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_ID, '1'); expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( diff --git a/src/app/pages/journal/journal.analytics.effects.ts b/src/app/pages/journal/journal.analytics.effects.ts index 6404f1cbd..7b098eece 100644 --- a/src/app/pages/journal/journal.analytics.effects.ts +++ b/src/app/pages/journal/journal.analytics.effects.ts @@ -25,9 +25,6 @@ import { ResumingWriteUp, } from '@store/journal/journal.actions'; import { - AnalyticsDimensionIndices, - AnalyticsEventCategories, - AnalyticsEvents, AnalyticsScreenNames, GoogleAnalyticsCustomDimension, GoogleAnalyticsEvents, @@ -50,11 +47,6 @@ export class JournalAnalyticsEffects { ofType(JournalViewDidEnter), switchMap(() => { - // TODO - MES-9495 - remove old analytics - this.analytics.setCurrentPage(AnalyticsScreenNames.JOURNAL); - this.analytics.addCustomDimension(AnalyticsDimensionIndices.CANDIDATE_ID, ''); - this.analytics.addCustomDimension(AnalyticsDimensionIndices.APPLICATION_REFERENCE, ''); - // GA4 Analytics this.analytics.setGACurrentPage(AnalyticsScreenNames.JOURNAL); // reset values for custom dimensions @@ -68,17 +60,6 @@ export class JournalAnalyticsEffects { journalNavigation$ = createEffect(() => this.actions$.pipe( ofType(JournalNavigateDay), switchMap((action: ReturnType) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.JOURNAL, - AnalyticsEvents.NAVIGATION, - this.analytics.getDescriptiveDate(action.day), - ); - - this.analytics.addCustomDimension( - AnalyticsDimensionIndices.JOURNAL_DAYS_FROM_TODAY, - this.analytics.getDiffDays(action.day).toString(), - ); // GA4 Analytics this.analytics.logGAEvent( @@ -99,8 +80,6 @@ export class JournalAnalyticsEffects { journalRefresh$ = createEffect(() => this.actions$.pipe( ofType(JournalRefresh), switchMap((action: ReturnType) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent(AnalyticsEventCategories.JOURNAL, AnalyticsEvents.REFRESH_JOURNAL, action.mode); // GA4 Analytics this.analytics.logGAEvent(GoogleAnalyticsEvents.JOURNAL, GoogleAnalyticsEventsTitles.REFRESH, action.mode); return of(AnalyticRecorded()); @@ -163,8 +142,6 @@ export class JournalAnalyticsEffects { earlyStartModalDidEnter$ = createEffect(() => this.actions$.pipe( ofType(EarlyStartModalDidEnter), switchMap(() => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent(AnalyticsEventCategories.JOURNAL, AnalyticsEvents.DISPLAY_EARLY_START_MODAL); // GA4 Analytics this.analytics.logGAEvent(GoogleAnalyticsEvents.JOURNAL, GoogleAnalyticsEventsTitles.EARLY_START_MODAL, @@ -176,8 +153,6 @@ export class JournalAnalyticsEffects { earlyStartModalContinue$ = createEffect(() => this.actions$.pipe( ofType(EarlyStartDidContinue), switchMap(() => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent(AnalyticsEventCategories.JOURNAL, AnalyticsEvents.EXIT_EARLY_START_MODAL_CONTINUE); // GA4 Analytics this.analytics.logGAEvent(GoogleAnalyticsEvents.JOURNAL, GoogleAnalyticsEventsTitles.EARLY_START_MODAL, @@ -189,8 +164,6 @@ export class JournalAnalyticsEffects { earlyStartModalReturn$ = createEffect(() => this.actions$.pipe( ofType(EarlyStartDidReturn), switchMap(() => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent(AnalyticsEventCategories.JOURNAL, AnalyticsEvents.EXIT_EARLY_START_MODAL_RETURN); // GA4 Analytics this.analytics.logGAEvent(GoogleAnalyticsEvents.JOURNAL, GoogleAnalyticsEventsTitles.EARLY_START_MODAL, @@ -202,8 +175,6 @@ export class JournalAnalyticsEffects { journalRefreshError$ = createEffect(() => this.actions$.pipe( ofType(JournalRefreshError), switchMap((action: ReturnType) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logError(action.errorDescription, action.errorMessage); // GA4 Analytics let refreshType = 'unknownJournalRefresh'; switch (action.errorDescription) { @@ -229,12 +200,6 @@ export class JournalAnalyticsEffects { slotChanged$ = createEffect(() => this.actions$.pipe( ofType(SlotHasChanged), switchMap((action: ReturnType) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.JOURNAL, - AnalyticsEvents.SLOT_CHANGED, - action.slotId.toString(), - ); // GA4 Analytics this.analytics.logGAEvent(GoogleAnalyticsEvents.JOURNAL, GoogleAnalyticsEventsTitles.SLOT_CHANGED, @@ -258,21 +223,6 @@ export class JournalAnalyticsEffects { const isTestPassed = isPassed(test); const journalDataOfTest = test.journalData; - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.POST_TEST, - AnalyticsEvents.RESUME_WRITE_UP, - isTestPassed ? 'pass' : 'fail', - ); - - this.analytics.addCustomDimension( - AnalyticsDimensionIndices.APPLICATION_REFERENCE, - formatApplicationReference(journalDataOfTest.applicationReference), - ); - this.analytics.addCustomDimension( - AnalyticsDimensionIndices.CANDIDATE_ID, journalDataOfTest.candidate.candidateId.toString(), - ); - // GA4 Analytics this.analytics.logGAEvent(GoogleAnalyticsEvents.RESUME_WRITE_UP, GoogleAnalyticsEventsTitles.RESULT, diff --git a/src/app/pages/login/__tests__/login.page.spec.ts b/src/app/pages/login/__tests__/login.page.spec.ts index 1c0507230..4637d10f9 100644 --- a/src/app/pages/login/__tests__/login.page.spec.ts +++ b/src/app/pages/login/__tests__/login.page.spec.ts @@ -228,9 +228,6 @@ describe('LoginPage', () => { spyOn(store$, 'dispatch'); spyOn(component, 'appInitializedLog'); spyOn(component, 'dispatchLog'); - spyOn(analytics, 'initialiseAnalytics') - .and - .returnValue(Promise.resolve()); spyOn(analytics, 'logException'); }); describe('Successful login flow', () => { @@ -254,8 +251,6 @@ describe('LoginPage', () => { .toHaveBeenCalled(); expect(component.handleLoadingUI) .toHaveBeenCalled(); - expect(analytics.initialiseAnalytics) - .toHaveBeenCalled(); expect(component.validateDeviceType) .toHaveBeenCalled(); expect(store$.dispatch) diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts index fec75a5c2..e0aeab59b 100644 --- a/src/app/pages/login/login.page.ts +++ b/src/app/pages/login/login.page.ts @@ -133,9 +133,6 @@ export class LoginPage extends LogoutBasePageComponent implements OnInit { this.store$.dispatch(LoadAppConfig({ appConfig: this.appConfigProvider.getAppConfig() })); - // TODO - MES-9495 - remove old analytics - await this.analytics.initialiseAnalytics(); - await this.analytics.initialiseGoogleAnalytics(); this.store$.dispatch(StartSendingCompletedTests()); diff --git a/src/app/pages/non-pass-finalisation/__tests__/non-pass-finalisation.analytics.effects.spec.ts b/src/app/pages/non-pass-finalisation/__tests__/non-pass-finalisation.analytics.effects.spec.ts index a69883ff8..86a52fea0 100644 --- a/src/app/pages/non-pass-finalisation/__tests__/non-pass-finalisation.analytics.effects.spec.ts +++ b/src/app/pages/non-pass-finalisation/__tests__/non-pass-finalisation.analytics.effects.spec.ts @@ -5,9 +5,6 @@ import { provideMockActions } from '@ngrx/effects/testing'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { - AnalyticsErrorTypes, - AnalyticsEventCategories, - AnalyticsEvents, AnalyticsScreenNames, GoogleAnalyticsEventPrefix, GoogleAnalyticsEvents, @@ -65,7 +62,6 @@ describe('NonPassFinalisationAnalyticsEffects', () => { effects = TestBed.inject(NonPassFinalisationAnalyticsEffects); analyticsProviderMock = TestBed.inject(AnalyticsProvider); store$ = TestBed.inject(Store); - spyOn(analyticsProviderMock, 'logEvent'); })); describe('nonPassFinalisationViewDidEnter', () => { @@ -79,9 +75,6 @@ describe('NonPassFinalisationAnalyticsEffects', () => { effects.nonPassFinalisationViewDidEnterEffect$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(screenName); //GA4 Analytics expect(analyticsProviderMock.setGACurrentPage) .toHaveBeenCalledWith(screenName); @@ -89,8 +82,6 @@ describe('NonPassFinalisationAnalyticsEffects', () => { }); }); it('should call setCurrentPage with practice mode prefix', (done) => { - // eslint-disable-next-line max-len - const practiceScreenName = `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsScreenNames.NON_PASS_FINALISATION}`; // ARRANGE store$.dispatch(fakeJournalActions.StartE2EPracticeTest(end2endPracticeSlotId)); store$.dispatch(PopulateCandidateDetails(candidateMock)); @@ -100,9 +91,6 @@ describe('NonPassFinalisationAnalyticsEffects', () => { effects.nonPassFinalisationViewDidEnterEffect$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(practiceScreenName); //GA4 Analytics expect(analyticsProviderMock.setGACurrentPage) .toHaveBeenCalledWith(`${GoogleAnalyticsEventPrefix.PRACTICE_MODE}_${screenName}`); @@ -121,12 +109,6 @@ describe('NonPassFinalisationAnalyticsEffects', () => { effects.validationErrorEffect$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logError) - .toHaveBeenCalledWith( - `${AnalyticsErrorTypes.VALIDATION_ERROR} (${AnalyticsScreenNames.NON_PASS_FINALISATION})`, - 'error is blank', - ); //GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -141,18 +123,12 @@ describe('NonPassFinalisationAnalyticsEffects', () => { it('should call logError with pass, prefixed with practice mode', (done) => { // ARRANGE store$.dispatch(fakeJournalActions.StartE2EPracticeTest(end2endPracticeSlotId)); - // eslint-disable-next-line max-len - const practiceScreenName = `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsScreenNames.NON_PASS_FINALISATION}`; // ACT actions$.next(nonPassFinalisationActions.NonPassFinalisationValidationError('error message')); // ASSERT effects.validationErrorEffect$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logError) - .toHaveBeenCalledWith(`${AnalyticsErrorTypes.VALIDATION_ERROR} (${practiceScreenName})`, - 'error message'); //GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -175,13 +151,6 @@ describe('NonPassFinalisationAnalyticsEffects', () => { effects.d255Yes$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.POST_TEST, - AnalyticsEvents.D255, - 'Yes', - ); //GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -203,13 +172,6 @@ describe('NonPassFinalisationAnalyticsEffects', () => { effects.d255Yes$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `practice mode - ${AnalyticsEventCategories.POST_TEST}`, - `practice mode - ${AnalyticsEvents.D255}`, - 'Yes', - ); //GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -232,13 +194,6 @@ describe('NonPassFinalisationAnalyticsEffects', () => { effects.d255No$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.POST_TEST, - AnalyticsEvents.D255, - 'No', - ); //GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -260,13 +215,6 @@ describe('NonPassFinalisationAnalyticsEffects', () => { effects.d255No$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `practice mode - ${AnalyticsEventCategories.POST_TEST}`, - `practice mode - ${AnalyticsEvents.D255}`, - 'No', - ); //GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -290,13 +238,6 @@ describe('NonPassFinalisationAnalyticsEffects', () => { effects.candidateChoseToProceedWithTestInEnglish$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.POST_TEST, - AnalyticsEvents.LANGUAGE_CHANGED, - Language.ENGLISH, - ); //GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -318,10 +259,6 @@ describe('NonPassFinalisationAnalyticsEffects', () => { effects.candidateChoseToProceedWithTestInEnglish$.subscribe((result) => { expect(result.type === AnalyticNotRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .not - .toHaveBeenCalled(); //GA4 Analytics expect(analyticsProviderMock.logGAEvent) .not @@ -341,10 +278,6 @@ describe('NonPassFinalisationAnalyticsEffects', () => { effects.candidateChoseToProceedWithTestInWelsh$.subscribe((result) => { expect(result.type === AnalyticNotRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .not - .toHaveBeenCalled(); //GA4 Analytics expect(analyticsProviderMock.logGAEvent) .not @@ -363,13 +296,6 @@ describe('NonPassFinalisationAnalyticsEffects', () => { effects.candidateChoseToProceedWithTestInWelsh$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.POST_TEST, - AnalyticsEvents.LANGUAGE_CHANGED, - Language.CYMRAEG, - ); //GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -392,15 +318,6 @@ describe('NonPassFinalisationAnalyticsEffects', () => { effects.nonPassFinalisationReportActivityCode$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.POST_TEST, - AnalyticsEvents.SET_ACTIVITY_CODE, - '4 - FAIL_PUBLIC_SAFETY', - ); //GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -423,15 +340,6 @@ describe('NonPassFinalisationAnalyticsEffects', () => { effects.nonPassFinalisationReportActivityCode$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `practice mode - ${AnalyticsEventCategories.POST_TEST}`, - `practice mode - ${AnalyticsEvents.SET_ACTIVITY_CODE}`, - '4 - FAIL_PUBLIC_SAFETY', - ); //GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); diff --git a/src/app/pages/non-pass-finalisation/non-pass-finalisation.analytics.effects.ts b/src/app/pages/non-pass-finalisation/non-pass-finalisation.analytics.effects.ts index 16adaf76c..f7441186f 100644 --- a/src/app/pages/non-pass-finalisation/non-pass-finalisation.analytics.effects.ts +++ b/src/app/pages/non-pass-finalisation/non-pass-finalisation.analytics.effects.ts @@ -8,13 +8,13 @@ import { import { AnalyticsProvider } from '@providers/analytics/analytics'; import { StoreModel } from '@shared/models/store.model'; import { - AnalyticsErrorTypes, - AnalyticsEventCategories, - AnalyticsEvents, - AnalyticsScreenNames, GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, GoogleAnalyticsEventsValues, + AnalyticsScreenNames, + GoogleAnalyticsEvents, + GoogleAnalyticsEventsTitles, + GoogleAnalyticsEventsValues, } from '@providers/analytics/analytics.model'; import { AnalyticNotRecorded, AnalyticRecorded } from '@providers/analytics/analytics.actions'; -import { analyticsEventTypePrefix, formatAnalyticsText } from '@shared/helpers/format-analytics-text'; +import { analyticsEventTypePrefix } from '@shared/helpers/format-analytics-text'; import { getTests } from '@store/tests/tests.reducer'; import { getActivityCode } from '@store/tests/activity-code/activity-code.reducer'; import { TestsModel } from '@store/tests/tests.model'; @@ -64,10 +64,6 @@ export class NonPassFinalisationAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO - MES-9495 - remove old analytics - const screenName = formatAnalyticsText(AnalyticsScreenNames.NON_PASS_FINALISATION, tests); - this.analytics.setCurrentPage(screenName); - //GA4 Analytics this.analytics.setGACurrentPage(analyticsEventTypePrefix(AnalyticsScreenNames.NON_PASS_FINALISATION, tests)); return of(AnalyticRecorded()); @@ -94,12 +90,6 @@ export class NonPassFinalisationAnalyticsEffects { switchMap(( [action, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO - MES-9495 - remove old analytics - const formattedScreenName = formatAnalyticsText(AnalyticsScreenNames.NON_PASS_FINALISATION, tests); - this.analytics.logError( - `${AnalyticsErrorTypes.VALIDATION_ERROR} (${formattedScreenName})`, - action.errorMessage, - ); //GA4 Analytics const valueName = action.errorMessage.split(' ')[0]; @@ -140,13 +130,6 @@ export class NonPassFinalisationAnalyticsEffects { // D255Yes used in pass & non-pass flows, this guard stops the appearance of duplicated events. if (activityCode !== ActivityCodes.PASS) { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.POST_TEST, tests), - formatAnalyticsText(AnalyticsEvents.D255, tests), - 'Yes', - ); - //GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.SET_D255, tests), @@ -187,13 +170,6 @@ export class NonPassFinalisationAnalyticsEffects { // D255No used in pass & non-pass flows, this guard stops the appearance of duplicated events. if (activityCode !== ActivityCodes.PASS) { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.POST_TEST, tests), - formatAnalyticsText(AnalyticsEvents.D255, tests), - 'No', - ); - //GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.SET_D255, tests), @@ -233,13 +209,6 @@ export class NonPassFinalisationAnalyticsEffects { [ReturnType, TestsModel, ActivityCode, boolean], ) => { if (activityCode) { - - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.POST_TEST, tests), - formatAnalyticsText(AnalyticsEvents.LANGUAGE_CHANGED, tests), - Language.ENGLISH, - ); //GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.LANGUAGE_CHANGED, tests), @@ -279,12 +248,6 @@ export class NonPassFinalisationAnalyticsEffects { [ReturnType, TestsModel, ActivityCode, boolean], ) => { if (activityCode) { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.POST_TEST, tests), - formatAnalyticsText(AnalyticsEvents.LANGUAGE_CHANGED, tests), - Language.CYMRAEG, - ); //GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.LANGUAGE_CHANGED, tests), @@ -319,12 +282,6 @@ export class NonPassFinalisationAnalyticsEffects { [ReturnType, TestsModel, boolean], ) => { const [description, code] = getEnumKeyByValue(ActivityCodes, activityCode); - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.POST_TEST, tests), - formatAnalyticsText(AnalyticsEvents.SET_ACTIVITY_CODE, tests), - `${code} - ${description}`, - ); //GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.SET_ACTIVITY_CODE, tests), diff --git a/src/app/pages/office/__tests__/office.analytics.effects.spec.ts b/src/app/pages/office/__tests__/office.analytics.effects.spec.ts index 02e3ef3d5..4d45d29c9 100644 --- a/src/app/pages/office/__tests__/office.analytics.effects.spec.ts +++ b/src/app/pages/office/__tests__/office.analytics.effects.spec.ts @@ -22,10 +22,8 @@ import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; import { StoreModel } from '@shared/models/store.model'; import { AnalyticsDimensionIndices, - AnalyticsErrorTypes, - AnalyticsEventCategories, - AnalyticsEvents, - AnalyticsScreenNames, GoogleAnalyticsCustomDimension, + AnalyticsScreenNames, + GoogleAnalyticsCustomDimension, GoogleAnalyticsEventPrefix, GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, @@ -47,10 +45,6 @@ describe('OfficeAnalyticsEffects', () => { let store$: Store; const screenNamePass = AnalyticsScreenNames.PASS_TEST_SUMMARY; const screenNameFail = AnalyticsScreenNames.FAIL_TEST_SUMMARY; - const screenNamePracticeModePass = - `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsScreenNames.PASS_TEST_SUMMARY}`; - const screenNamePracticeModeFail = - `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsScreenNames.FAIL_TEST_SUMMARY}`; const mockApplication: Application = { applicationId: 123456, bookingSequence: 78, @@ -99,13 +93,6 @@ describe('OfficeAnalyticsEffects', () => { effects.officeViewDidEnter$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_ID, '1'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.APPLICATION_REFERENCE, '123456789'); - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(screenNamePass); // GA4 Analytics expect(analyticsProviderMock.addGACustomDimension) @@ -130,14 +117,6 @@ describe('OfficeAnalyticsEffects', () => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_ID, '1'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.APPLICATION_REFERENCE, '123456789'); - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(screenNameFail); - // GA4 Analytics expect(analyticsProviderMock.addGACustomDimension) .toHaveBeenCalledWith(GoogleAnalyticsCustomDimension.CANDIDATE_ID, '1'); @@ -161,14 +140,6 @@ describe('OfficeAnalyticsEffects', () => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_ID, '1'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.APPLICATION_REFERENCE, '123456789'); - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(screenNamePracticeModePass); - // GA4 Analytics expect(analyticsProviderMock.addGACustomDimension) .toHaveBeenCalledWith(GoogleAnalyticsCustomDimension.CANDIDATE_ID, '1'); @@ -192,14 +163,6 @@ describe('OfficeAnalyticsEffects', () => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_ID, '1'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.APPLICATION_REFERENCE, '123456789'); - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(screenNamePracticeModeFail); - // GA4 Analytics expect(analyticsProviderMock.addCustomDimension) .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_ID, '1'); @@ -230,19 +193,6 @@ describe('OfficeAnalyticsEffects', () => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_ID, '1'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.APPLICATION_REFERENCE, '123456789'); - - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.OFFICE, - AnalyticsEvents.DATE_OF_TEST_CHANGED, - 'previous date: 2020-12-25T08:10:00; new date: 2021-01-19T08:10:00', - ); - // GA4 Analytics expect(analyticsProviderMock.addGACustomDimension) .toHaveBeenCalledWith(GoogleAnalyticsCustomDimension.CANDIDATE_ID, '1'); @@ -276,18 +226,6 @@ describe('OfficeAnalyticsEffects', () => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_ID, '1'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.APPLICATION_REFERENCE, '123456789'); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.POST_TEST, - AnalyticsEvents.SAVE_WRITE_UP, - 'Pass', - ); - // GA4 Analytics expect(analyticsProviderMock.addGACustomDimension) .toHaveBeenCalledWith(GoogleAnalyticsCustomDimension.CANDIDATE_ID, '1'); @@ -315,18 +253,6 @@ describe('OfficeAnalyticsEffects', () => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_ID, '1'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.APPLICATION_REFERENCE, '123456789'); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.POST_TEST, - AnalyticsEvents.SAVE_WRITE_UP, - 'Fail', - ); - // GA4 Analytics expect(analyticsProviderMock.addGACustomDimension) .toHaveBeenCalledWith(GoogleAnalyticsCustomDimension.CANDIDATE_ID, '1'); @@ -353,17 +279,6 @@ describe('OfficeAnalyticsEffects', () => { effects.savingWriteUpForLaterEffect$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_ID, '1'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.APPLICATION_REFERENCE, '123456789'); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsEventCategories.POST_TEST}`, - `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsEvents.SAVE_WRITE_UP}`, - 'Pass', - ); // GA4 Analytics expect(analyticsProviderMock.addGACustomDimension) @@ -391,17 +306,7 @@ describe('OfficeAnalyticsEffects', () => { effects.savingWriteUpForLaterEffect$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_ID, '1'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.APPLICATION_REFERENCE, '123456789'); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsEventCategories.POST_TEST}`, - `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsEvents.SAVE_WRITE_UP}`, - 'Fail', - ); + // GA4 Analytics expect(analyticsProviderMock.addGACustomDimension) .toHaveBeenCalledWith(GoogleAnalyticsCustomDimension.CANDIDATE_ID, '1'); @@ -430,10 +335,7 @@ describe('OfficeAnalyticsEffects', () => { effects.validationErrorEffect$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logError) - .toHaveBeenCalledWith(`${AnalyticsErrorTypes.VALIDATION_ERROR} (${screenNamePass})`, - 'faultComment-simple-dangerous-useOfMirrorsSignalling'); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -456,10 +358,7 @@ describe('OfficeAnalyticsEffects', () => { effects.validationErrorEffect$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logError) - .toHaveBeenCalledWith(`${AnalyticsErrorTypes.VALIDATION_ERROR} (${screenNameFail})`, - 'faultComment-simple-dangerous-useOfMirrorsSignalling'); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -482,10 +381,7 @@ describe('OfficeAnalyticsEffects', () => { effects.validationErrorEffect$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logError) - .toHaveBeenCalledWith(`${AnalyticsErrorTypes.VALIDATION_ERROR} (${screenNamePass})`, - 'useOfMirrorsSignalling'); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -506,10 +402,7 @@ describe('OfficeAnalyticsEffects', () => { effects.validationErrorEffect$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logError) - .toHaveBeenCalledWith(`${AnalyticsErrorTypes.VALIDATION_ERROR} (${screenNameFail})`, - 'useOfMirrorsSignalling'); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -531,10 +424,7 @@ describe('OfficeAnalyticsEffects', () => { effects.validationErrorEffect$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logError) - .toHaveBeenCalledWith(`${AnalyticsErrorTypes.VALIDATION_ERROR} (${screenNamePass})`, - 'faultComment-simple-useOfMirrorsSignalling'); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -558,10 +448,7 @@ describe('OfficeAnalyticsEffects', () => { effects.validationErrorEffect$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logError) - .toHaveBeenCalledWith(`${AnalyticsErrorTypes.VALIDATION_ERROR} (${screenNamePass})`, - ''); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -582,10 +469,7 @@ describe('OfficeAnalyticsEffects', () => { effects.validationErrorEffect$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logError) - .toHaveBeenCalledWith(`${AnalyticsErrorTypes.VALIDATION_ERROR} (${screenNamePracticeModePass})`, - 'faultComment-simple-dangerous-useOfMirrorsSignalling'); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -608,10 +492,7 @@ describe('OfficeAnalyticsEffects', () => { effects.validationErrorEffect$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logError) - .toHaveBeenCalledWith(`${AnalyticsErrorTypes.VALIDATION_ERROR} (${screenNamePracticeModeFail})`, - 'faultComment-simple-dangerous-useOfMirrorsSignalling'); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -638,13 +519,7 @@ describe('OfficeAnalyticsEffects', () => { effects.completeTest$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.POST_TEST, - AnalyticsEvents.CONFIRM_UPLOAD, - 'Upload confirmed - Pass', - ); + expect(analyticsProviderMock.addCustomDimension) .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_ID, '1'); expect(analyticsProviderMock.addCustomDimension) @@ -677,13 +552,7 @@ describe('OfficeAnalyticsEffects', () => { effects.completeTest$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.POST_TEST, - AnalyticsEvents.CONFIRM_UPLOAD, - 'practice mode - Upload confirmed - Pass', - ); + expect(analyticsProviderMock.addCustomDimension) .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_ID, '1'); expect(analyticsProviderMock.addCustomDimension) @@ -719,13 +588,7 @@ describe('OfficeAnalyticsEffects', () => { effects.setCircuit$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.OFFICE, - AnalyticsEvents.CIRCUIT_CHANGED, - `Circuit type ${CircuitType.Left} selected`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -753,13 +616,7 @@ describe('OfficeAnalyticsEffects', () => { effects.setIndependentDrivingType$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.OFFICE, - AnalyticsEvents.INDEPENDENT_DRIVING_TYPE_CHANGED, - 'Sat nav selected', - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -786,13 +643,7 @@ describe('OfficeAnalyticsEffects', () => { effects.setModeOfTransport$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.OFFICE, - AnalyticsEvents.MODE_OF_TRANSPORT_CHANGED, - 'Car to bike selected', - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( diff --git a/src/app/pages/office/office.analytics.effects.ts b/src/app/pages/office/office.analytics.effects.ts index 8d095ad88..905a87a89 100644 --- a/src/app/pages/office/office.analytics.effects.ts +++ b/src/app/pages/office/office.analytics.effects.ts @@ -5,10 +5,6 @@ import { } from 'rxjs/operators'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { - AnalyticsDimensionIndices, - AnalyticsErrorTypes, - AnalyticsEventCategories, - AnalyticsEvents, AnalyticsScreenNames, GoogleAnalyticsCustomDimension, GoogleAnalyticsEvents, @@ -32,7 +28,7 @@ import { getCurrentTest, getJournalData, isPassed, isPracticeMode, } from '@store/tests/tests.selector'; import { of } from 'rxjs'; -import { analyticsEventTypePrefix, formatAnalyticsText } from '@shared/helpers/format-analytics-text'; +import { analyticsEventTypePrefix } from '@shared/helpers/format-analytics-text'; import { TestsModel } from '@store/tests/tests.model'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; import { getCandidate } from '@store/tests/journal-data/common/candidate/candidate.reducer'; @@ -161,17 +157,9 @@ export class OfficeAnalyticsEffects { [, tests, isTestPassed, candidateId, applicationReference]: [ReturnType, TestsModel, boolean, number, string, boolean], ) => { - let screenName = isTestPassed - ? formatAnalyticsText(AnalyticsScreenNames.PASS_TEST_SUMMARY, tests) - : formatAnalyticsText(AnalyticsScreenNames.FAIL_TEST_SUMMARY, tests); - - // TODO - MES-9495 - remove old analytics - this.analytics.addCustomDimension(AnalyticsDimensionIndices.CANDIDATE_ID, `${candidateId}`); - this.analytics.addCustomDimension(AnalyticsDimensionIndices.APPLICATION_REFERENCE, applicationReference); - this.analytics.setCurrentPage(screenName); // GA4 Analytics - screenName = isTestPassed + const screenName = isTestPassed ? analyticsEventTypePrefix(AnalyticsScreenNames.PASS_TEST_SUMMARY, tests) : analyticsEventTypePrefix(AnalyticsScreenNames.FAIL_TEST_SUMMARY, tests); this.analytics.addGACustomDimension(GoogleAnalyticsCustomDimension.CANDIDATE_ID, `${candidateId}`); @@ -215,18 +203,9 @@ export class OfficeAnalyticsEffects { ? true : this.appConfigProvider.getAppConfig()?.journal?.enablePracticeModeAnalytics), switchMap(( - [action, tests, candidateId, applicationReference]: + [action, , candidateId, applicationReference]: [ReturnType, TestsModel, number, string, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.addCustomDimension(AnalyticsDimensionIndices.CANDIDATE_ID, `${candidateId}`); - this.analytics.addCustomDimension(AnalyticsDimensionIndices.APPLICATION_REFERENCE, applicationReference); - - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.OFFICE, tests), - formatAnalyticsText(AnalyticsEvents.DATE_OF_TEST_CHANGED, tests), - `previous date: ${action.previousStartDate}; new date: ${action.customStartDate}`, - ); // GA4 Analytics this.analytics.addGACustomDimension(GoogleAnalyticsCustomDimension.CANDIDATE_ID, `${candidateId}`); @@ -283,19 +262,9 @@ export class OfficeAnalyticsEffects { ? true : this.appConfigProvider.getAppConfig()?.journal?.enablePracticeModeAnalytics), switchMap(( - [, tests, testOutcome, candidateId, applicationReference]: + [, , testOutcome, candidateId, applicationReference]: [ReturnType, TestsModel, string, number, string, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.addCustomDimension(AnalyticsDimensionIndices.CANDIDATE_ID, `${candidateId}`); - this.analytics.addCustomDimension(AnalyticsDimensionIndices.APPLICATION_REFERENCE, applicationReference); - - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.POST_TEST, tests), - formatAnalyticsText(AnalyticsEvents.SAVE_WRITE_UP, tests), - testOutcome, - ); - // GA4 Analytics let eventValue = this.getEventValue(testOutcome); @@ -336,12 +305,8 @@ export class OfficeAnalyticsEffects { ? true : this.appConfigProvider.getAppConfig()?.journal?.enablePracticeModeAnalytics), switchMap(( - [action, tests, isTestPassed]: [ReturnType, TestsModel, boolean, boolean], + [action, tests, ]: [ReturnType, TestsModel, boolean, boolean], ) => { - const screenName = isTestPassed ? AnalyticsScreenNames.PASS_TEST_SUMMARY : AnalyticsScreenNames.FAIL_TEST_SUMMARY; - // TODO - MES-9495 - remove old analytics - const formattedScreenName = formatAnalyticsText(screenName, tests); - this.analytics.logError(`${AnalyticsErrorTypes.VALIDATION_ERROR} (${formattedScreenName})`, action.errorMessage); // GA4 Analytics let controlName = null; @@ -416,15 +381,6 @@ export class OfficeAnalyticsEffects { [, candidateId, applicationReference, testOutcome, tests]: [ReturnType, number, string, string, TestsModel, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.addCustomDimension(AnalyticsDimensionIndices.CANDIDATE_ID, `${candidateId}`); - this.analytics.addCustomDimension(AnalyticsDimensionIndices.APPLICATION_REFERENCE, applicationReference); - - this.analytics.logEvent( - AnalyticsEventCategories.POST_TEST, - AnalyticsEvents.CONFIRM_UPLOAD, - formatAnalyticsText(`Upload confirmed - ${testOutcome}`, tests), - ); //GA4 Analytics this.analytics.addGACustomDimension(GoogleAnalyticsCustomDimension.CANDIDATE_ID, `${candidateId}`); @@ -467,15 +423,9 @@ export class OfficeAnalyticsEffects { ? true : this.appConfigProvider.getAppConfig()?.journal?.enablePracticeModeAnalytics), concatMap(( - [action, tests, category]: [ReturnType, TestsModel, CategoryCode, boolean], + [action, , category]: [ReturnType, TestsModel, CategoryCode, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.addCustomDimension(AnalyticsDimensionIndices.TEST_CATEGORY, category); - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.OFFICE, tests), - formatAnalyticsText(AnalyticsEvents.CIRCUIT_CHANGED, tests), - `Circuit type ${action.circuitType} selected`, - ); + //GA4 Analytics let eventValue = this.getEventValue(action.circuitType); @@ -514,13 +464,6 @@ export class OfficeAnalyticsEffects { concatMap(( [action, tests, category]: [ReturnType, TestsModel, CategoryCode, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.addCustomDimension(AnalyticsDimensionIndices.TEST_CATEGORY, category); - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.OFFICE, tests), - formatAnalyticsText(AnalyticsEvents.INDEPENDENT_DRIVING_TYPE_CHANGED, tests), - `${action.independentDriving} selected`, - ); //GA4 Analytics let eventValue = this.getEventValue(action.independentDriving); @@ -558,15 +501,9 @@ export class OfficeAnalyticsEffects { ? true : this.appConfigProvider.getAppConfig()?.journal?.enablePracticeModeAnalytics), concatMap(( - [action, tests, category]: [ReturnType, TestsModel, CategoryCode, boolean], + [action, , category]: [ReturnType, TestsModel, CategoryCode, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.addCustomDimension(AnalyticsDimensionIndices.TEST_CATEGORY, category); - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.OFFICE, tests), - formatAnalyticsText(AnalyticsEvents.MODE_OF_TRANSPORT_CHANGED, tests), - `${action.modeOfTransport} selected`, - ); + //GA4 Analytics this.analytics.addGACustomDimension(GoogleAnalyticsCustomDimension.TEST_CATEGORY, category); @@ -608,18 +545,14 @@ export class OfficeAnalyticsEffects { concatMap(( [, tests, fuelEfficientDriving]: [ReturnType, TestsModel, boolean, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.OFFICE, tests), - formatAnalyticsText(AnalyticsEvents.TOGGLE_FUEL_EFFICIENT_DRIVING, tests), - `${fuelEfficientDriving ? 'Yes' : 'No'}`, - ); + //GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.FUEL_EFFICIENT_DRIVING, tests), GoogleAnalyticsEventsTitles.SELECTION, `${fuelEfficientDriving ? GoogleAnalyticsEventsValues.YES : GoogleAnalyticsEventsValues.NO}`, ); + return of(AnalyticRecorded()); }), )); @@ -651,12 +584,7 @@ export class OfficeAnalyticsEffects { concatMap(( [, tests, ecoRelatedFault]: [ReturnType, TestsModel, string, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.OFFICE, tests), - formatAnalyticsText(AnalyticsEvents.ECO_RELATED_FAULT_CHANGED, tests), - ecoRelatedFault, - ); + //GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -694,12 +622,7 @@ export class OfficeAnalyticsEffects { concatMap(( [, tests]: [ReturnType, TestsModel, string, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.OFFICE, tests), - formatAnalyticsText(AnalyticsEvents.ECO_CAPTURE_REASON_CHANGED, tests), - 'Free text entered', - ); + //GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.FEEDBACK, tests), @@ -708,6 +631,7 @@ export class OfficeAnalyticsEffects { GoogleAnalyticsEventsTitles.REASON, GoogleAnalyticsEventsValues.FREE_TEXT_ENTERED, ); + return of(AnalyticRecorded()); }), )); diff --git a/src/app/pages/pass-certificates/__tests__/pass-certificates.analytics.effects.spec.ts b/src/app/pages/pass-certificates/__tests__/pass-certificates.analytics.effects.spec.ts index 1dec9c93a..ef2c9efc4 100644 --- a/src/app/pages/pass-certificates/__tests__/pass-certificates.analytics.effects.spec.ts +++ b/src/app/pages/pass-certificates/__tests__/pass-certificates.analytics.effects.spec.ts @@ -36,9 +36,6 @@ describe('PassCertificatesAnalyticsEffects', () => { effects.passCertificatesView$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProvider.setCurrentPage) - .toHaveBeenCalledWith(AnalyticsScreenNames.PASS_CERTIFICATES); // GA4 Analytics expect(analyticsProvider.setGACurrentPage) diff --git a/src/app/pages/pass-certificates/pass-certificates.analytics.effects.ts b/src/app/pages/pass-certificates/pass-certificates.analytics.effects.ts index c60fa22ee..72a19c217 100644 --- a/src/app/pages/pass-certificates/pass-certificates.analytics.effects.ts +++ b/src/app/pages/pass-certificates/pass-certificates.analytics.effects.ts @@ -19,8 +19,6 @@ export class PassCertificatesAnalyticsEffects { passCertificatesView$ = createEffect(() => this.actions$.pipe( ofType(PassCertificatedViewDidEnter), switchMap(() => { - // TODO - MES-9495 - remove old analytics - this.analytics.setCurrentPage(AnalyticsScreenNames.PASS_CERTIFICATES); // GA4 Analytics this.analytics.setGACurrentPage(AnalyticsScreenNames.PASS_CERTIFICATES); diff --git a/src/app/pages/pass-finalisation/__tests__/pass-finalisation.analytics.effects.spec.ts b/src/app/pages/pass-finalisation/__tests__/pass-finalisation.analytics.effects.spec.ts index d7f9a609e..54756e009 100644 --- a/src/app/pages/pass-finalisation/__tests__/pass-finalisation.analytics.effects.spec.ts +++ b/src/app/pages/pass-finalisation/__tests__/pass-finalisation.analytics.effects.spec.ts @@ -8,9 +8,6 @@ import * as testSummaryActions from '@store/tests/test-summary/test-summary.acti import * as vehicleDetailsActions from '@store/tests/vehicle-details/vehicle-details.actions'; import * as commsActions from '@store/tests/communication-preferences/communication-preferences.actions'; import { - AnalyticsErrorTypes, - AnalyticsEventCategories, - AnalyticsEvents, AnalyticsScreenNames, GoogleAnalyticsEventPrefix, GoogleAnalyticsEvents, @@ -44,8 +41,6 @@ describe('PassFinalisationAnalyticsEffects', () => { let actions$: ReplaySubject; let store$: Store; const screenName = AnalyticsScreenNames.PASS_FINALISATION; - // eslint-disable-next-line max-len - const screenNamePracticeMode = `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsScreenNames.PASS_FINALISATION}`; beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ @@ -77,8 +72,6 @@ describe('PassFinalisationAnalyticsEffects', () => { effects = TestBed.inject(PassFinalisationAnalyticsEffects); analyticsProviderMock = TestBed.inject(AnalyticsProvider); store$ = TestBed.inject(Store); - - spyOn(analyticsProviderMock, 'logEvent'); })); describe('passFinalisationViewDidEnter', () => { @@ -92,9 +85,6 @@ describe('PassFinalisationAnalyticsEffects', () => { effects.passFinalisationViewDidEnter$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(screenName); //GA4 Analytics expect(analyticsProviderMock.setGACurrentPage) .toHaveBeenCalledWith(screenName); @@ -111,9 +101,6 @@ describe('PassFinalisationAnalyticsEffects', () => { effects.passFinalisationViewDidEnter$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(screenNamePracticeMode); //GA4 Analytics expect(analyticsProviderMock.setGACurrentPage) .toHaveBeenCalledWith(`${GoogleAnalyticsEventPrefix.PRACTICE_MODE}_${screenName}`); @@ -131,12 +118,7 @@ describe('PassFinalisationAnalyticsEffects', () => { actions$.next(passFinalisationActions.PassFinalisationValidationError('error is blank')); // ASSERT effects.validationErrorEffect$.subscribe((result) => { - expect(result.type === AnalyticRecorded.type) - .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logError) - .toHaveBeenCalledWith(`${AnalyticsErrorTypes.VALIDATION_ERROR} (${AnalyticsScreenNames.PASS_FINALISATION})`, - 'error is blank'); + expect(result.type === AnalyticRecorded.type); //GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -151,18 +133,12 @@ describe('PassFinalisationAnalyticsEffects', () => { it('should call logError with pass, prefixed with practice mode', (done) => { // ARRANGE store$.dispatch(fakeJournalActions.StartE2EPracticeTest(end2endPracticeSlotId)); - // eslint-disable-next-line max-len - const practiceScreenName = `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsScreenNames.PASS_FINALISATION}`; // ACT actions$.next(passFinalisationActions.PassFinalisationValidationError('error message')); // ASSERT effects.validationErrorEffect$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logError) - .toHaveBeenCalledWith(`${AnalyticsErrorTypes.VALIDATION_ERROR} (${practiceScreenName})`, - 'error message'); //GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -185,13 +161,6 @@ describe('PassFinalisationAnalyticsEffects', () => { effects.code78PresentEffect$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.POST_TEST, - AnalyticsEvents.TOGGLE_CODE_78, - 'Yes', - ); //GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -214,13 +183,6 @@ describe('PassFinalisationAnalyticsEffects', () => { effects.code78NotPresentEffect$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.POST_TEST, - AnalyticsEvents.TOGGLE_CODE_78, - 'No', - ); //GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -243,13 +205,6 @@ describe('PassFinalisationAnalyticsEffects', () => { effects.provisionalLicenseNotReceived$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.POST_TEST, - AnalyticsEvents.TOGGLE_LICENSE_RECEIVED, - 'No', - ); //GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -271,13 +226,6 @@ describe('PassFinalisationAnalyticsEffects', () => { effects.provisionalLicenseNotReceived$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `practice mode - ${AnalyticsEventCategories.POST_TEST}`, - `practice mode - ${AnalyticsEvents.TOGGLE_LICENSE_RECEIVED}`, - 'No', - ); //GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -300,13 +248,6 @@ describe('PassFinalisationAnalyticsEffects', () => { effects.provisionalLicenseReceived$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.POST_TEST, - AnalyticsEvents.TOGGLE_LICENSE_RECEIVED, - 'Yes', - ); //GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -328,13 +269,6 @@ describe('PassFinalisationAnalyticsEffects', () => { effects.provisionalLicenseReceived$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `practice mode - ${AnalyticsEventCategories.POST_TEST}`, - `practice mode - ${AnalyticsEvents.TOGGLE_LICENSE_RECEIVED}`, - 'Yes', - ); //GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -358,13 +292,6 @@ describe('PassFinalisationAnalyticsEffects', () => { effects.transmissionChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.POST_TEST, - AnalyticsEvents.GEARBOX_CATEGORY_CHANGED, - TransmissionType.Manual, - ); //GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -387,13 +314,6 @@ describe('PassFinalisationAnalyticsEffects', () => { effects.transmissionChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `practice mode - ${AnalyticsEventCategories.POST_TEST}`, - `practice mode - ${AnalyticsEvents.GEARBOX_CATEGORY_CHANGED}`, - TransmissionType.Manual, - ); //GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -415,13 +335,6 @@ describe('PassFinalisationAnalyticsEffects', () => { effects.transmissionChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.POST_TEST, - AnalyticsEvents.GEARBOX_CATEGORY_CHANGED, - TransmissionType.Automatic, - ); //GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -443,10 +356,6 @@ describe('PassFinalisationAnalyticsEffects', () => { effects.transmissionChanged$.subscribe((result) => { expect(result.type === AnalyticNotRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .not - .toHaveBeenCalled(); //GA4 Analytics expect(analyticsProviderMock.logGAEvent) .not @@ -467,13 +376,6 @@ describe('PassFinalisationAnalyticsEffects', () => { effects.d255Yes$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.POST_TEST, - AnalyticsEvents.D255, - 'Yes', - ); //GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -496,13 +398,6 @@ describe('PassFinalisationAnalyticsEffects', () => { effects.d255Yes$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `practice mode - ${AnalyticsEventCategories.POST_TEST}`, - `practice mode - ${AnalyticsEvents.D255}`, - 'Yes', - ); //GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -526,13 +421,6 @@ describe('PassFinalisationAnalyticsEffects', () => { effects.d255No$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.POST_TEST, - AnalyticsEvents.D255, - 'No', - ); //GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -555,13 +443,6 @@ describe('PassFinalisationAnalyticsEffects', () => { effects.d255No$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `practice mode - ${AnalyticsEventCategories.POST_TEST}`, - `practice mode - ${AnalyticsEvents.D255}`, - 'No', - ); //GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -585,13 +466,6 @@ describe('PassFinalisationAnalyticsEffects', () => { effects.candidateChoseToProceedWithTestInEnglish$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.POST_TEST, - AnalyticsEvents.LANGUAGE_CHANGED, - Language.ENGLISH, - ); //GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -613,10 +487,6 @@ describe('PassFinalisationAnalyticsEffects', () => { effects.candidateChoseToProceedWithTestInEnglish$.subscribe((result) => { expect(result.type === AnalyticNotRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .not - .toHaveBeenCalled(); //GA4 Analytics expect(analyticsProviderMock.logGAEvent) .not @@ -637,13 +507,6 @@ describe('PassFinalisationAnalyticsEffects', () => { effects.candidateChoseToProceedWithTestInWelsh$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.POST_TEST, - AnalyticsEvents.LANGUAGE_CHANGED, - Language.CYMRAEG, - ); //GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -665,10 +528,6 @@ describe('PassFinalisationAnalyticsEffects', () => { effects.candidateChoseToProceedWithTestInWelsh$.subscribe((result) => { expect(result.type === AnalyticNotRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .not - .toHaveBeenCalled(); //GA4 Analytics expect(analyticsProviderMock.logGAEvent) .not diff --git a/src/app/pages/pass-finalisation/pass-finalisation.analytics.effects.ts b/src/app/pages/pass-finalisation/pass-finalisation.analytics.effects.ts index 4c74f9ff9..f5e0319ba 100644 --- a/src/app/pages/pass-finalisation/pass-finalisation.analytics.effects.ts +++ b/src/app/pages/pass-finalisation/pass-finalisation.analytics.effects.ts @@ -7,15 +7,15 @@ import { } from 'rxjs/operators'; import { ActivityCode } from '@dvsa/mes-test-schema/categories/common'; import { - AnalyticsErrorTypes, - AnalyticsEventCategories, - AnalyticsEvents, - AnalyticsScreenNames, GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, GoogleAnalyticsEventsValues, + AnalyticsScreenNames, + GoogleAnalyticsEvents, + GoogleAnalyticsEventsTitles, + GoogleAnalyticsEventsValues, } from '@providers/analytics/analytics.model'; import { StoreModel } from '@shared/models/store.model'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { getTests } from '@store/tests/tests.reducer'; -import { analyticsEventTypePrefix, formatAnalyticsText } from '@shared/helpers/format-analytics-text'; +import { analyticsEventTypePrefix } from '@shared/helpers/format-analytics-text'; import { AnalyticNotRecorded, AnalyticRecorded } from '@providers/analytics/analytics.actions'; import * as passCompletionActions from '@store/tests/pass-completion/pass-completion.actions'; import * as testSummaryActions from '@store/tests/test-summary/test-summary.actions'; @@ -78,10 +78,6 @@ export class PassFinalisationAnalyticsEffects { [ReturnType, TestsModel, boolean], ) => { - // TODO - MES-9495 - remove old analytics - const screenName = formatAnalyticsText(AnalyticsScreenNames.PASS_FINALISATION, tests); - this.analytics.setCurrentPage(screenName); - //GA4 Analytics this.analytics.setGACurrentPage(analyticsEventTypePrefix(AnalyticsScreenNames.PASS_FINALISATION, tests)); return of(AnalyticRecorded()); @@ -106,15 +102,9 @@ export class PassFinalisationAnalyticsEffects { ? true : this.appConfigProvider.getAppConfig()?.journal?.enablePracticeModeAnalytics), switchMap(( - [action, tests]: + [action]: [ReturnType, TestsModel, boolean], ) => { - // TODO - MES-9495 - remove old analytics - const formattedScreenName = formatAnalyticsText(AnalyticsScreenNames.PASS_FINALISATION, tests); - this.analytics.logError( - `${AnalyticsErrorTypes.VALIDATION_ERROR} (${formattedScreenName})`, - action.errorMessage, - ); //GA4 Analytics const valueName = action.errorMessage.split(' ')[0]; @@ -145,15 +135,9 @@ export class PassFinalisationAnalyticsEffects { ? true : this.appConfigProvider.getAppConfig()?.journal?.enablePracticeModeAnalytics), concatMap(( - [, tests]: + [, ]: [ReturnType, TestsModel, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.POST_TEST, tests), - formatAnalyticsText(AnalyticsEvents.TOGGLE_CODE_78, tests), - 'Yes', - ); //GA4 Analytics this.analytics.logGAEvent( GoogleAnalyticsEvents.CODE78, @@ -182,15 +166,9 @@ export class PassFinalisationAnalyticsEffects { ? true : this.appConfigProvider.getAppConfig()?.journal?.enablePracticeModeAnalytics), concatMap(( - [, tests]: + [,]: [ReturnType, TestsModel, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.POST_TEST, tests), - formatAnalyticsText(AnalyticsEvents.TOGGLE_CODE_78, tests), - 'No', - ); //GA4 Analytics this.analytics.logGAEvent( GoogleAnalyticsEvents.CODE78, @@ -222,13 +200,6 @@ export class PassFinalisationAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.POST_TEST, tests), - formatAnalyticsText(AnalyticsEvents.TOGGLE_LICENSE_RECEIVED, tests), - 'No', - ); - //GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.LICENCE_RECEIVED, tests), @@ -260,13 +231,6 @@ export class PassFinalisationAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.POST_TEST, tests), - formatAnalyticsText(AnalyticsEvents.TOGGLE_LICENSE_RECEIVED, tests), - 'Yes', - ); - //GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.LICENCE_RECEIVED, tests), @@ -305,13 +269,6 @@ export class PassFinalisationAnalyticsEffects { ) => { // Check current URL begins with PassFin prefix before recording analytic to stop duplicated events. if (activityCode != null && this.router.url?.startsWith(this.classPrefix)) { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.POST_TEST, tests), - formatAnalyticsText(AnalyticsEvents.GEARBOX_CATEGORY_CHANGED, tests), - action.gearboxCategory, - ); - //GA4 Analytics let gearboxCategory = null; switch (action.gearboxCategory) { @@ -365,14 +322,6 @@ export class PassFinalisationAnalyticsEffects { ) => { // D255Yes used in pass & non-pass flows, this guard stops the appearance of duplicated events. if (activityCode === ActivityCodes.PASS) { - - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.POST_TEST, tests), - formatAnalyticsText(AnalyticsEvents.D255, tests), - 'Yes', - ); - //GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.SET_D255, tests), @@ -414,13 +363,6 @@ export class PassFinalisationAnalyticsEffects { // D255No used in pass & non-pass flows, this guard stops the appearance of duplicated events. if (activityCode === ActivityCodes.PASS) { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.POST_TEST, tests), - formatAnalyticsText(AnalyticsEvents.D255, tests), - 'No', - ); - //GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.SET_D255, tests), @@ -460,12 +402,6 @@ export class PassFinalisationAnalyticsEffects { [ReturnType, TestsModel, ActivityCode, boolean], ) => { if (activityCode !== null) { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.POST_TEST, tests), - formatAnalyticsText(AnalyticsEvents.LANGUAGE_CHANGED, tests), - Language.ENGLISH, - ); //GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.LANGUAGE_CHANGED, tests), @@ -505,12 +441,6 @@ export class PassFinalisationAnalyticsEffects { [ReturnType, TestsModel, ActivityCode, boolean], ) => { if (activityCode !== null) { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.POST_TEST, tests), - formatAnalyticsText(AnalyticsEvents.LANGUAGE_CHANGED, tests), - Language.CYMRAEG, - ); //GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.LANGUAGE_CHANGED, tests), @@ -545,12 +475,6 @@ export class PassFinalisationAnalyticsEffects { [ReturnType, TestsModel, boolean], ) => { const [description, code] = getEnumKeyByValue(ActivityCodes, activityCode); - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.POST_TEST, tests), - formatAnalyticsText(AnalyticsEvents.SET_ACTIVITY_CODE, tests), - `${code} - ${description}`, - ); //GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.SET_ACTIVITY_CODE, tests), @@ -589,12 +513,6 @@ export class PassFinalisationAnalyticsEffects { [, tests, furtherDevelopment]: [ReturnType, TestsModel, boolean, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.POST_TEST, tests), - formatAnalyticsText(AnalyticsEvents.FURTHER_DEVELOPMENT_CHANGED, tests), - `further development changed to ${furtherDevelopment ? 'Yes' : 'No'}`, - ); //GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.FURTHER_DEVELOPMENT, tests), @@ -633,12 +551,6 @@ export class PassFinalisationAnalyticsEffects { [, tests]: [ReturnType, TestsModel, string, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.POST_TEST, tests), - formatAnalyticsText(AnalyticsEvents.REASON_FOR_NO_ADVICE_CHANGED, tests), - 'Free text entered', - ); //GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.FEEDBACK, tests), diff --git a/src/app/pages/post-debrief-holding/__tests__/post-debrief-holding.analytics.spec.ts b/src/app/pages/post-debrief-holding/__tests__/post-debrief-holding.analytics.spec.ts index a09192323..f3b57e8f3 100644 --- a/src/app/pages/post-debrief-holding/__tests__/post-debrief-holding.analytics.spec.ts +++ b/src/app/pages/post-debrief-holding/__tests__/post-debrief-holding.analytics.spec.ts @@ -11,7 +11,6 @@ import { candidateMock } from '@store/tests/__mocks__/tests.mock'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; import { - AnalyticsEventCategories, AnalyticsScreenNames, GoogleAnalyticsEventPrefix, } from '@providers/analytics/analytics.model'; @@ -29,7 +28,6 @@ describe('PostDebriefHoldingAnalyticsEffects', () => { let actions$: ReplaySubject; let store$: Store; const screenName = AnalyticsScreenNames.POST_DEBRIEF_HOLDING; - const practiceScreenName = `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsScreenNames.POST_DEBRIEF_HOLDING}`; beforeEach(() => { TestBed.configureTestingModule({ @@ -70,11 +68,6 @@ describe('PostDebriefHoldingAnalyticsEffects', () => { effects.postDebriefHoldingViewDidEnterEffect$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(screenName); - // GA4 Analytics expect(analyticsProviderMock.setGACurrentPage) .toHaveBeenCalledWith(screenName); @@ -92,10 +85,6 @@ describe('PostDebriefHoldingAnalyticsEffects', () => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(practiceScreenName); - // GA4 Analytics expect(analyticsProviderMock.setGACurrentPage) .toHaveBeenCalledWith(`${GoogleAnalyticsEventPrefix.PRACTICE_MODE}_${screenName}`); diff --git a/src/app/pages/post-debrief-holding/post-debrief-holding.analytics.effects.ts b/src/app/pages/post-debrief-holding/post-debrief-holding.analytics.effects.ts index 2c62eeb40..73f6eb165 100644 --- a/src/app/pages/post-debrief-holding/post-debrief-holding.analytics.effects.ts +++ b/src/app/pages/post-debrief-holding/post-debrief-holding.analytics.effects.ts @@ -8,7 +8,7 @@ import { of } from 'rxjs'; import { getTests } from '@store/tests/tests.reducer'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; import { TestsModel } from '@store/tests/tests.model'; -import { analyticsEventTypePrefix, formatAnalyticsText } from '@shared/helpers/format-analytics-text'; +import { analyticsEventTypePrefix } from '@shared/helpers/format-analytics-text'; import { AnalyticsScreenNames } from '@providers/analytics/analytics.model'; import { PostDebriefHoldingViewDidEnter } from '@pages/post-debrief-holding/post-debrief-holding.actions'; import { isPracticeMode } from '@store/tests/tests.selector'; @@ -42,11 +42,6 @@ export class PostDebriefHoldingAnalyticsEffects { ? true : this.appConfigProvider.getAppConfig()?.journal?.enablePracticeModeAnalytics), concatMap(([, tests]: [ReturnType, TestsModel, boolean]) => { - - // TODO - MES-9495 - remove old analytics - const screenName = formatAnalyticsText(AnalyticsScreenNames.POST_DEBRIEF_HOLDING, tests); - this.analytics.setCurrentPage(screenName); - // GA4 Analytics this.analytics.setGACurrentPage(analyticsEventTypePrefix(AnalyticsScreenNames.POST_DEBRIEF_HOLDING, tests)); return of(AnalyticRecorded()); diff --git a/src/app/pages/rekey-reason/__tests__/rekey-reason.analytics.effects.spec.ts b/src/app/pages/rekey-reason/__tests__/rekey-reason.analytics.effects.spec.ts index a33bd81e2..38df9ad85 100644 --- a/src/app/pages/rekey-reason/__tests__/rekey-reason.analytics.effects.spec.ts +++ b/src/app/pages/rekey-reason/__tests__/rekey-reason.analytics.effects.spec.ts @@ -54,7 +54,6 @@ describe('RekeyReasonAnalyticsEffects', () => { analyticsProviderMock = TestBed.inject(AnalyticsProvider); store$ = TestBed.inject(Store); - spyOn(analyticsProviderMock, 'logEvent'); }); describe('rekeyReasonViewDidEnter', () => { @@ -68,11 +67,6 @@ describe('RekeyReasonAnalyticsEffects', () => { effects.rekeyReasonViewDidEnter$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(screenName); - // GA4 Analytics expect(analyticsProviderMock.setGACurrentPage) .toHaveBeenCalledWith(screenName); @@ -112,10 +106,6 @@ describe('RekeyReasonAnalyticsEffects', () => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalled(); - // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalled(); diff --git a/src/app/pages/rekey-reason/rekey-reason.analytics.effects.ts b/src/app/pages/rekey-reason/rekey-reason.analytics.effects.ts index 46a89952f..cf5b40057 100644 --- a/src/app/pages/rekey-reason/rekey-reason.analytics.effects.ts +++ b/src/app/pages/rekey-reason/rekey-reason.analytics.effects.ts @@ -5,9 +5,6 @@ import { } from 'rxjs/operators'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { - AnalyticsDimensionIndices, - AnalyticsEventCategories, - AnalyticsEvents, AnalyticsScreenNames, GoogleAnalyticsCustomDimension, GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, } from '@providers/analytics/analytics.model'; import { select, Store } from '@ngrx/store'; @@ -17,7 +14,7 @@ import { getCurrentTest, getJournalData, isPracticeMode, } from '@store/tests/tests.selector'; import { of } from 'rxjs'; -import { analyticsEventTypePrefix, formatAnalyticsText } from '@shared/helpers/format-analytics-text'; +import { analyticsEventTypePrefix } from '@shared/helpers/format-analytics-text'; import { TestsModel } from '@store/tests/tests.model'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; import { getCandidate } from '@store/tests/journal-data/common/candidate/candidate.reducer'; @@ -79,12 +76,6 @@ export class RekeyReasonAnalyticsEffects { [ReturnType, TestsModel, number, string, boolean], ) => { - // TODO - MES-9495 - remove old analytics - const screenName = formatAnalyticsText(AnalyticsScreenNames.REKEY_REASON, tests); - this.analytics.addCustomDimension(AnalyticsDimensionIndices.CANDIDATE_ID, `${candidateId}`); - this.analytics.addCustomDimension(AnalyticsDimensionIndices.APPLICATION_REFERENCE, applicationReference); - this.analytics.setCurrentPage(screenName); - // GA4 Analytics this.analytics.setGACurrentPage(analyticsEventTypePrefix(AnalyticsScreenNames.REKEY_REASON, tests)); this.analytics.addGACustomDimension(GoogleAnalyticsCustomDimension.CANDIDATE_ID, `${candidateId}`); @@ -123,13 +114,6 @@ export class RekeyReasonAnalyticsEffects { [ReturnType, string, TestsModel, boolean], ) => { - - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.POST_TEST, tests), - formatAnalyticsText(AnalyticsEvents.CONFIRM_UPLOAD, tests), - formatAnalyticsText(`Upload confirmed - ${testOutcome}`, tests), - ); - // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.SUBMIT_TEST, tests), diff --git a/src/app/pages/rekey-search/__tests__/rekey-search.analytics.effects.spec.ts b/src/app/pages/rekey-search/__tests__/rekey-search.analytics.effects.spec.ts index fc8dc6b89..9b4e2d9b4 100644 --- a/src/app/pages/rekey-search/__tests__/rekey-search.analytics.effects.spec.ts +++ b/src/app/pages/rekey-search/__tests__/rekey-search.analytics.effects.spec.ts @@ -4,7 +4,8 @@ import { provideMockActions } from '@ngrx/effects/testing'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { - AnalyticsScreenNames, AnalyticsEventCategories, AnalyticsEvents, GoogleAnalyticsEvents, + AnalyticsScreenNames, + GoogleAnalyticsEvents, } from '@providers/analytics/analytics.model'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; import { RekeySearchAnalyticsEffects } from '../rekey-search.analytics.effects'; @@ -28,7 +29,6 @@ describe('RekeySearchAnalyticsEffects', () => { actions$ = new ReplaySubject(1); effects = TestBed.inject(RekeySearchAnalyticsEffects); analyticsProviderMock = TestBed.inject(AnalyticsProvider); - spyOn(analyticsProviderMock, 'logEvent'); })); describe('rekeySearchViewDidEnter', () => { @@ -39,9 +39,6 @@ describe('RekeySearchAnalyticsEffects', () => { effects.rekeySearchViewDidEnter$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.setCurrentPage).toHaveBeenCalledWith(screenName); - // GA4 Analytics expect(analyticsProviderMock.setGACurrentPage).toHaveBeenCalledWith(screenName); done(); @@ -56,12 +53,6 @@ describe('RekeySearchAnalyticsEffects', () => { effects.rekeySearchPerformed$.subscribe((result) => { expect(result?.type === AnalyticRecorded.type).toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.REKEY_SEARCH, - AnalyticsEvents.TEST_BOOKING_SEARCH, - ); - // GA4 Analytics expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( GoogleAnalyticsEvents.TEST_BOOKING_SEARCH, diff --git a/src/app/pages/rekey-search/rekey-search.analytics.effects.ts b/src/app/pages/rekey-search/rekey-search.analytics.effects.ts index d31f660c8..09776b330 100644 --- a/src/app/pages/rekey-search/rekey-search.analytics.effects.ts +++ b/src/app/pages/rekey-search/rekey-search.analytics.effects.ts @@ -5,8 +5,6 @@ import { switchMap } from 'rxjs/operators'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; import { - AnalyticsEventCategories, - AnalyticsEvents, AnalyticsScreenNames, GoogleAnalyticsEvents, } from '@providers/analytics/analytics.model'; @@ -25,9 +23,6 @@ export class RekeySearchAnalyticsEffects { ofType(RekeySearchViewDidEnter), switchMap(() => { - // TODO - MES-9495 - remove old analytics - this.analytics.setCurrentPage(AnalyticsScreenNames.REKEY_SEARCH); - // GA4 Analytics this.analytics.setGACurrentPage(AnalyticsScreenNames.REKEY_SEARCH); return of(AnalyticRecorded()); @@ -38,12 +33,6 @@ export class RekeySearchAnalyticsEffects { ofType(SearchBookedTest), switchMap(() => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.REKEY_SEARCH, - AnalyticsEvents.TEST_BOOKING_SEARCH, - ); - // GA4 Analytics this.analytics.logGAEvent( GoogleAnalyticsEvents.TEST_BOOKING_SEARCH, diff --git a/src/app/pages/rekey-upload-outcome/__tests__/rekey-upload-outcome.analytics.effects.spec.ts b/src/app/pages/rekey-upload-outcome/__tests__/rekey-upload-outcome.analytics.effects.spec.ts index bc89a70d3..9674bf03e 100644 --- a/src/app/pages/rekey-upload-outcome/__tests__/rekey-upload-outcome.analytics.effects.spec.ts +++ b/src/app/pages/rekey-upload-outcome/__tests__/rekey-upload-outcome.analytics.effects.spec.ts @@ -24,7 +24,6 @@ describe('RekeyUploadOutcomeAnalyticsEffects', () => { let analyticsProviderMock: AnalyticsProvider; let actions$: ReplaySubject; let store$: Store; - const screenName = AnalyticsScreenNames.REKEY_UPLOADED; beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ @@ -66,10 +65,6 @@ describe('RekeyUploadOutcomeAnalyticsEffects', () => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(screenName); - // GA4 analytics expect(analyticsProviderMock.setGACurrentPage) .toHaveBeenCalledWith(AnalyticsScreenNames.REKEY_UPLOADED); diff --git a/src/app/pages/rekey-upload-outcome/rekey-upload-outcome.analytics.effects.ts b/src/app/pages/rekey-upload-outcome/rekey-upload-outcome.analytics.effects.ts index 73cf51f5b..1354f5dc1 100644 --- a/src/app/pages/rekey-upload-outcome/rekey-upload-outcome.analytics.effects.ts +++ b/src/app/pages/rekey-upload-outcome/rekey-upload-outcome.analytics.effects.ts @@ -10,7 +10,7 @@ import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticsScreenNames } from '@providers/analytics/analytics.model'; import { StoreModel } from '@shared/models/store.model'; import { getTests } from '@store/tests/tests.reducer'; -import { analyticsEventTypePrefix, formatAnalyticsText } from '@shared/helpers/format-analytics-text'; +import { analyticsEventTypePrefix } from '@shared/helpers/format-analytics-text'; import { TestsModel } from '@store/tests/tests.model'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; import { AppConfigProvider } from '@providers/app-config/app-config'; @@ -46,10 +46,6 @@ export class RekeyUploadOutcomeAnalyticsEffects { : this.appConfigProvider.getAppConfig()?.journal?.enablePracticeModeAnalytics), switchMap(([, tests]: [ReturnType, TestsModel, boolean]) => { - // TODO - MES-9495 - remove old analytics - const screenName = formatAnalyticsText(AnalyticsScreenNames.REKEY_UPLOADED, tests); - this.analytics.setCurrentPage(screenName); - // GA4 analytics this.analytics.setGACurrentPage(analyticsEventTypePrefix(AnalyticsScreenNames.REKEY_UPLOADED, tests)); return of(AnalyticRecorded()); diff --git a/src/app/pages/test-centre-journal/__tests__/test-centre-journal.analytics.effects.spec.ts b/src/app/pages/test-centre-journal/__tests__/test-centre-journal.analytics.effects.spec.ts index 3cb209130..c40261134 100644 --- a/src/app/pages/test-centre-journal/__tests__/test-centre-journal.analytics.effects.spec.ts +++ b/src/app/pages/test-centre-journal/__tests__/test-centre-journal.analytics.effects.spec.ts @@ -5,8 +5,6 @@ import { provideMockActions } from '@ngrx/effects/testing'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { - AnalyticsEventCategories, - AnalyticsEvents, AnalyticsScreenNames, GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, @@ -36,7 +34,6 @@ describe('TestCentreJournalAnalyticsEffects', () => { actions$ = new ReplaySubject(1); effects = TestBed.inject(TestCentreJournalAnalyticsEffects); analyticsProviderMock = TestBed.inject(AnalyticsProvider); - spyOn(analyticsProviderMock, 'logEvent'); }); describe('testCentreJournalView$', () => { @@ -44,7 +41,6 @@ describe('TestCentreJournalAnalyticsEffects', () => { actions$.next(testCentreJournalActions.TestCentreJournalViewDidEnter()); effects.testCentreJournalView$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.setCurrentPage).toHaveBeenCalledWith(screenName); // GA4 Analytics expect(analyticsProviderMock.setGACurrentPage).toHaveBeenCalledWith(screenName); done(); @@ -57,12 +53,6 @@ describe('TestCentreJournalAnalyticsEffects', () => { actions$.next(testCentreJournalActions.TestCentreJournalGetData(false)); effects.testCentreJournalRefresh$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_CENTRE_JOURNAL, - AnalyticsEvents.REFRESH_TC_JOURNAL, - JournalRefreshModes.AUTOMATIC, - ); // GA4 Analytics expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( GoogleAnalyticsEvents.TEST_CENTRE_JOURNAL, @@ -79,11 +69,6 @@ describe('TestCentreJournalAnalyticsEffects', () => { actions$.next(testCentreJournalActions.TestCentreJournalSelectTestCentre()); effects.testCentreJournalSelectTestCentre$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_CENTRE_JOURNAL, - AnalyticsEvents.CHANGE_LOCATION, - ); // GA4 Analytics expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( GoogleAnalyticsEvents.TEST_CENTRE_JOURNAL, @@ -100,12 +85,6 @@ describe('TestCentreJournalAnalyticsEffects', () => { actions$.next(testCentreJournalActions.TestCentreJournalTabChanged('tab1')); effects.testCentreJournalTabChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_CENTRE_JOURNAL, - AnalyticsEvents.TAB_SELECTION, - 'tab1', - ); // GA4 Analytics expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( GoogleAnalyticsEvents.TEST_CENTRE_JOURNAL, @@ -119,12 +98,6 @@ describe('TestCentreJournalAnalyticsEffects', () => { actions$.next(testCentreJournalActions.TestCentreJournalTabChanged('View Journals')); effects.testCentreJournalTabChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_CENTRE_JOURNAL, - AnalyticsEvents.TAB_SELECTION, - 'View Journals', - ); // GA4 Analytics expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( GoogleAnalyticsEvents.TEST_CENTRE_JOURNAL, @@ -141,11 +114,6 @@ describe('TestCentreJournalAnalyticsEffects', () => { actions$.next(testCentreJournalActions.TestCentreJournalSelectCandidate()); effects.testCentreJournalSelectCandidate$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_CENTRE_JOURNAL, - AnalyticsEvents.CANDIDATE_SELECTION, - ); // GA4 Analytics expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( GoogleAnalyticsEvents.TEST_CENTRE_JOURNAL, @@ -162,12 +130,6 @@ describe('TestCentreJournalAnalyticsEffects', () => { actions$.next(testCentreJournalActions.TestCentreJournalShowBookings()); effects.testCentreJournalShowBookings$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_CENTRE_JOURNAL, - AnalyticsEvents.BUTTON_SELECTION, - 'Show booking', - ); // GA4 Analytics expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( GoogleAnalyticsEvents.TEST_CENTRE_JOURNAL, @@ -184,11 +146,6 @@ describe('TestCentreJournalAnalyticsEffects', () => { actions$.next(testCentreJournalActions.TestCentreJournalSelectExaminer()); effects.testCentreJournalSelectExaminer$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_CENTRE_JOURNAL, - AnalyticsEvents.EXAMINER_SELECTION, - ); // GA4 Analytics expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( GoogleAnalyticsEvents.TEST_CENTRE_JOURNAL, @@ -205,12 +162,6 @@ describe('TestCentreJournalAnalyticsEffects', () => { actions$.next(testCentreJournalActions.TestCentreJournalShowJournals()); effects.testCentreJournalShowJournals$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_CENTRE_JOURNAL, - AnalyticsEvents.BUTTON_SELECTION, - 'Show journals', - ); // GA4 Analytics expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( GoogleAnalyticsEvents.TEST_CENTRE_JOURNAL, @@ -227,12 +178,6 @@ describe('TestCentreJournalAnalyticsEffects', () => { actions$.next(testCentreJournalActions.TestCentreJournalDateNavigation('some day')); effects.testCentreJournalDateNavigation$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_CENTRE_JOURNAL, - AnalyticsEvents.NAVIGATION, - 'some day', - ); // GA4 Analytics expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( GoogleAnalyticsEvents.TEST_CENTRE_JOURNAL, @@ -246,12 +191,6 @@ describe('TestCentreJournalAnalyticsEffects', () => { actions$.next(testCentreJournalActions.TestCentreJournalDateNavigation('today')); effects.testCentreJournalDateNavigation$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_CENTRE_JOURNAL, - AnalyticsEvents.NAVIGATION, - 'today', - ); // GA4 Analytics expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( GoogleAnalyticsEvents.TEST_CENTRE_JOURNAL, diff --git a/src/app/pages/test-centre-journal/test-centre-journal.analytics.effects.ts b/src/app/pages/test-centre-journal/test-centre-journal.analytics.effects.ts index 71a21d480..4532f350e 100644 --- a/src/app/pages/test-centre-journal/test-centre-journal.analytics.effects.ts +++ b/src/app/pages/test-centre-journal/test-centre-journal.analytics.effects.ts @@ -5,8 +5,6 @@ import { switchMap } from 'rxjs/operators'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticsScreenNames, - AnalyticsEventCategories, - AnalyticsEvents, JournalRefreshModes, GoogleAnalyticsEventsTitles, GoogleAnalyticsEvents, @@ -37,8 +35,6 @@ export class TestCentreJournalAnalyticsEffects { testCentreJournalView$ = createEffect(() => this.actions$.pipe( ofType(TestCentreJournalViewDidEnter), switchMap(() => { - // TODO - MES-9495 - remove old analytics - this.analytics.setCurrentPage(AnalyticsScreenNames.TEST_CENTRE_JOURNAL); // GA4 Analytics this.analytics.setGACurrentPage(AnalyticsScreenNames.TEST_CENTRE_JOURNAL); return of(AnalyticRecorded()); @@ -48,12 +44,6 @@ export class TestCentreJournalAnalyticsEffects { testCentreJournalRefresh$ = createEffect(() => this.actions$.pipe( ofType(TestCentreJournalGetData), switchMap((action: ReturnType) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.TEST_CENTRE_JOURNAL, - AnalyticsEvents.REFRESH_TC_JOURNAL, - action.manualRefresh ? JournalRefreshModes.MANUAL : JournalRefreshModes.AUTOMATIC, - ); // GA4 Analytics this.analytics.logGAEvent( GoogleAnalyticsEvents.TEST_CENTRE_JOURNAL, @@ -67,11 +57,6 @@ export class TestCentreJournalAnalyticsEffects { testCentreJournalSelectTestCentre$ = createEffect(() => this.actions$.pipe( ofType(TestCentreJournalSelectTestCentre), switchMap(() => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.TEST_CENTRE_JOURNAL, - AnalyticsEvents.CHANGE_LOCATION, - ); // GA4 Analytics this.analytics.logGAEvent( GoogleAnalyticsEvents.TEST_CENTRE_JOURNAL, @@ -85,12 +70,6 @@ export class TestCentreJournalAnalyticsEffects { testCentreJournalTabChanged$ = createEffect(() => this.actions$.pipe( ofType(TestCentreJournalTabChanged), switchMap(({ tab }: ReturnType) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.TEST_CENTRE_JOURNAL, - AnalyticsEvents.TAB_SELECTION, - tab, - ); // GA4 Analytics let eventValue = null; switch (tab) { @@ -115,11 +94,6 @@ export class TestCentreJournalAnalyticsEffects { testCentreJournalSelectCandidate$ = createEffect(() => this.actions$.pipe( ofType(TestCentreJournalSelectCandidate), switchMap(() => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.TEST_CENTRE_JOURNAL, - AnalyticsEvents.CANDIDATE_SELECTION, - ); // GA4 Analytics this.analytics.logGAEvent( GoogleAnalyticsEvents.TEST_CENTRE_JOURNAL, @@ -133,12 +107,6 @@ export class TestCentreJournalAnalyticsEffects { testCentreJournalShowBookings$ = createEffect(() => this.actions$.pipe( ofType(TestCentreJournalShowBookings), switchMap(() => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.TEST_CENTRE_JOURNAL, - AnalyticsEvents.BUTTON_SELECTION, - 'Show booking', - ); // GA4 Analytics this.analytics.logGAEvent( GoogleAnalyticsEvents.TEST_CENTRE_JOURNAL, @@ -152,11 +120,6 @@ export class TestCentreJournalAnalyticsEffects { testCentreJournalSelectExaminer$ = createEffect(() => this.actions$.pipe( ofType(TestCentreJournalSelectExaminer), switchMap(() => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.TEST_CENTRE_JOURNAL, - AnalyticsEvents.EXAMINER_SELECTION, - ); // GA4 Analytics this.analytics.logGAEvent( GoogleAnalyticsEvents.TEST_CENTRE_JOURNAL, @@ -170,12 +133,6 @@ export class TestCentreJournalAnalyticsEffects { testCentreJournalShowJournals$ = createEffect(() => this.actions$.pipe( ofType(TestCentreJournalShowJournals), switchMap(() => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.TEST_CENTRE_JOURNAL, - AnalyticsEvents.BUTTON_SELECTION, - 'Show journals', - ); // GA4 Analytics this.analytics.logGAEvent( GoogleAnalyticsEvents.TEST_CENTRE_JOURNAL, @@ -189,12 +146,6 @@ export class TestCentreJournalAnalyticsEffects { testCentreJournalDateNavigation$ = createEffect(() => this.actions$.pipe( ofType(TestCentreJournalDateNavigation), switchMap(({ day }) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.TEST_CENTRE_JOURNAL, - AnalyticsEvents.NAVIGATION, - day, - ); // GA4 Analytics let eventValue = null; switch (day) { diff --git a/src/app/pages/test-report-dashboard/__tests__/test-report-dashboard.analytics.effects.spec.ts b/src/app/pages/test-report-dashboard/__tests__/test-report-dashboard.analytics.effects.spec.ts index 0d2829a81..2dd109319 100644 --- a/src/app/pages/test-report-dashboard/__tests__/test-report-dashboard.analytics.effects.spec.ts +++ b/src/app/pages/test-report-dashboard/__tests__/test-report-dashboard.analytics.effects.spec.ts @@ -38,7 +38,6 @@ describe('TestReportDashboardAnalyticsEffects', () => { let analyticsProviderMock: AnalyticsProvider; let actions$: ReplaySubject; let store$: Store; - const screenName = AnalyticsScreenNames.TEST_REPORT_DASHBOARD; beforeEach(() => { TestBed.configureTestingModule({ @@ -66,7 +65,6 @@ describe('TestReportDashboardAnalyticsEffects', () => { effects = TestBed.inject(TestReportDashboardAnalyticsEffects); analyticsProviderMock = TestBed.inject(AnalyticsProvider); store$ = TestBed.inject(Store); - spyOn(analyticsProviderMock, 'logEvent'); }); describe('testReportDashboardViewDidEnter$', () => { @@ -81,10 +79,6 @@ describe('TestReportDashboardAnalyticsEffects', () => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(screenName); - // GA4 Analytics expect(analyticsProviderMock.setGACurrentPage) .toHaveBeenCalledWith(AnalyticsScreenNames.TEST_REPORT_DASHBOARD); @@ -104,10 +98,6 @@ describe('TestReportDashboardAnalyticsEffects', () => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(`practice mode - ${screenName}`); - // GA4 Analytics expect(analyticsProviderMock.setGACurrentPage) .toHaveBeenCalledWith( diff --git a/src/app/pages/test-report-dashboard/test-report-dashboard.analytics.effects.ts b/src/app/pages/test-report-dashboard/test-report-dashboard.analytics.effects.ts index 7a86c53af..ce3124b8b 100644 --- a/src/app/pages/test-report-dashboard/test-report-dashboard.analytics.effects.ts +++ b/src/app/pages/test-report-dashboard/test-report-dashboard.analytics.effects.ts @@ -8,12 +8,12 @@ import { of } from 'rxjs'; import { getTests } from '@store/tests/tests.reducer'; import { getCurrentTest, isPracticeMode } from '@store/tests/tests.selector'; import { TestsModel } from '@store/tests/tests.model'; -import { analyticsEventTypePrefix, formatAnalyticsText } from '@shared/helpers/format-analytics-text'; +import { analyticsEventTypePrefix } from '@shared/helpers/format-analytics-text'; import { - AnalyticsEventCategories, - AnalyticsEvents, AnalyticsScreenNames, - GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, GoogleAnalyticsEventsValues, + GoogleAnalyticsEvents, + GoogleAnalyticsEventsTitles, + GoogleAnalyticsEventsValues, } from '@providers/analytics/analytics.model'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; import { FeedbackChanged } from '@store/tests/test-data/cat-adi-part3/review/review.actions'; @@ -60,9 +60,6 @@ export class TestReportDashboardAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.setCurrentPage(formatAnalyticsText(AnalyticsScreenNames.TEST_REPORT_DASHBOARD, tests)); - // GA4 Analytics this.analytics.setGACurrentPage(analyticsEventTypePrefix(AnalyticsScreenNames.TEST_REPORT_DASHBOARD, tests)); return of(AnalyticRecorded()); @@ -90,12 +87,6 @@ export class TestReportDashboardAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT_DASHBOARD, tests), - formatAnalyticsText(AnalyticsEvents.ASSESSMENT_MODAL_OPENED, tests), - ); - // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.NAVIGATION, tests), @@ -127,12 +118,6 @@ export class TestReportDashboardAnalyticsEffects { [{ page }, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT_DASHBOARD, tests), - formatAnalyticsText(AnalyticsEvents.NAVIGATION, tests), - `clicked option to enter ${page}`, - ); // GA4 Analytics this.analytics.logGAEvent( @@ -178,13 +163,6 @@ export class TestReportDashboardAnalyticsEffects { [ReturnType, TestsModel, string, CategoryCode, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT_DASHBOARD, tests), - formatAnalyticsText(AnalyticsEvents.FEEDBACK_CHANGED, tests), - 'Free text entered', - ); - // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.FEEDBACK, tests), diff --git a/src/app/pages/test-report/__tests__/test-report.analytics.effects.spec.ts b/src/app/pages/test-report/__tests__/test-report.analytics.effects.spec.ts index 75f807bb8..4ac21c13f 100644 --- a/src/app/pages/test-report/__tests__/test-report.analytics.effects.spec.ts +++ b/src/app/pages/test-report/__tests__/test-report.analytics.effects.spec.ts @@ -30,9 +30,6 @@ import { import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { - AnalyticsEventCategories, - AnalyticsEvents, - AnalyticsLabels, AnalyticsScreenNames, GoogleAnalyticsEventPrefix, GoogleAnalyticsEvents, @@ -42,14 +39,12 @@ import { import { competencyLabels, fullAnalyticCompetencyLabels, - fullCompetencyLabels, } from '@shared/constants/competencies/competencies'; import { testsReducer } from '@store/tests/tests.reducer'; import { candidateMock, testReportPracticeModeSlot } from '@store/tests/__mocks__/tests.mock'; import { manoeuvreCompetencyAnalyticLabels, - manoeuvreCompetencyLabels, manoeuvreTypeAnalyticLabels, - manoeuvreTypeLabels, + manoeuvreTypeAnalyticLabels, } from '@shared/constants/competencies/catb-manoeuvres'; import { AnalyticNotRecorded, AnalyticRecorded } from '@providers/analytics/analytics.actions'; import { @@ -59,7 +54,6 @@ import { import * as uncoupleRecoupleActions from '@store/tests/test-data/common/uncouple-recouple/uncouple-recouple.actions'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import * as avoidanceActions from '@store/tests/test-data/cat-a-mod1/avoidance/avoidance.actions'; -import { speedCheckToggleValues } from '@shared/constants/competencies/cata-mod1-speed-checks'; import * as emergencyStopActions from '@store/tests/test-data/cat-a-mod1/emergency-stop/emergency-stop.actions'; import { PopulateTestCategory } from '@store/tests/category/category.actions'; import { PopulateCandidateDetails } from '@store/tests/journal-data/common/candidate/candidate.actions'; @@ -116,7 +110,6 @@ describe('TestReportAnalyticsEffects', () => { analyticsProviderMock = TestBed.inject(AnalyticsProvider); store$ = TestBed.inject(Store); appConfigProvider = TestBed.inject(AppConfigProvider); - spyOn(analyticsProviderMock, 'logEvent'); spyOn(appConfigProvider, 'getAppConfig') .and .returnValue({ @@ -134,12 +127,8 @@ describe('TestReportAnalyticsEffects', () => { effects.testReportViewDidEnter$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledTimes(1); expect(analyticsProviderMock.setGACurrentPage) .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(AnalyticsScreenNames.TEST_REPORT); expect(analyticsProviderMock.setGACurrentPage) .toHaveBeenCalledWith(AnalyticsScreenNames.TEST_REPORT); done(); @@ -158,15 +147,7 @@ describe('TestReportAnalyticsEffects', () => { effects.toggleRemoveFaultMode$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.SELECT_REMOVE_MODE, - AnalyticsEvents.REMOVE_MODE_SELECTED, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -188,15 +169,7 @@ describe('TestReportAnalyticsEffects', () => { effects.toggleRemoveFaultMode$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.EXIT_REMOVE_MODE, - AnalyticsEvents.REMOVE_MODE_EXITED, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -219,15 +192,7 @@ describe('TestReportAnalyticsEffects', () => { effects.toggleRemoveFaultMode$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.SELECT_REMOVE_MODE}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.REMOVE_MODE_SELECTED}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -249,9 +214,8 @@ describe('TestReportAnalyticsEffects', () => { effects.toggleRemoveFaultMode$.subscribe((result) => { expect(result.type) .toEqual(AnalyticNotRecorded.type); - expect(analyticsProviderMock.logEvent) - .not - .toHaveBeenCalled(); + + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .not .toHaveBeenCalled(); @@ -270,14 +234,7 @@ describe('TestReportAnalyticsEffects', () => { effects.toggleSeriousFaultMode$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.SELECT_SERIOUS_MODE, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -299,14 +256,7 @@ describe('TestReportAnalyticsEffects', () => { effects.toggleSeriousFaultMode$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.SELECT_SERIOUS_MODE}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -328,9 +278,8 @@ describe('TestReportAnalyticsEffects', () => { effects.toggleSeriousFaultMode$.subscribe((result) => { expect(result.type) .toEqual(AnalyticNotRecorded.type); - expect(analyticsProviderMock.logEvent) - .not - .toHaveBeenCalled(); + + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .not .toHaveBeenCalled(); @@ -349,14 +298,7 @@ describe('TestReportAnalyticsEffects', () => { effects.toggleDangerousFaultMode$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.SELECT_DANGEROUS_MODE, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -378,14 +320,7 @@ describe('TestReportAnalyticsEffects', () => { effects.toggleDangerousFaultMode$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.SELECT_DANGEROUS_MODE}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -407,9 +342,8 @@ describe('TestReportAnalyticsEffects', () => { effects.toggleDangerousFaultMode$.subscribe((result) => { expect(result.type) .toEqual(AnalyticNotRecorded.type); - expect(analyticsProviderMock.logEvent) - .not - .toHaveBeenCalled(); + + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .not .toHaveBeenCalled(); @@ -432,16 +366,7 @@ describe('TestReportAnalyticsEffects', () => { effects.addDrivingFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.ADD_DRIVING_FAULT, - fullCompetencyLabels[Competencies.controlsGears], - 1, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -466,16 +391,7 @@ describe('TestReportAnalyticsEffects', () => { effects.addDrivingFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.ADD_DRIVING_FAULT}`, - fullCompetencyLabels[Competencies.controlsGears], - 1, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -502,16 +418,7 @@ describe('TestReportAnalyticsEffects', () => { effects.addSeriousFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.ADD_SERIOUS_FAULT, - fullCompetencyLabels[Competencies.controlsGears], - 1, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -533,16 +440,7 @@ describe('TestReportAnalyticsEffects', () => { effects.addSeriousFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.ADD_SERIOUS_FAULT}`, - fullCompetencyLabels[Competencies.controlsGears], - 1, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -569,16 +467,7 @@ describe('TestReportAnalyticsEffects', () => { effects.addDangerousFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.ADD_DANGEROUS_FAULT, - fullCompetencyLabels[Competencies.controlsGears], - 1, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -600,16 +489,7 @@ describe('TestReportAnalyticsEffects', () => { effects.addDangerousFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.ADD_DANGEROUS_FAULT}`, - fullCompetencyLabels[Competencies.controlsGears], - 1, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -639,17 +519,7 @@ describe('TestReportAnalyticsEffects', () => { effects.addManoeuvreDrivingFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.ADD_DRIVING_FAULT, - // eslint-disable-next-line max-len - `${manoeuvreTypeLabels[ManoeuvreTypes.reverseRight]} - ${manoeuvreCompetencyLabels[ManoeuvreCompetencies.controlFault]}`, - 1, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -678,17 +548,7 @@ describe('TestReportAnalyticsEffects', () => { effects.addManoeuvreDrivingFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.ADD_DRIVING_FAULT}`, - // eslint-disable-next-line max-len - `${manoeuvreTypeLabels[ManoeuvreTypes.reverseRight]} - ${manoeuvreCompetencyLabels[ManoeuvreCompetencies.controlFault]}`, - 1, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -722,17 +582,7 @@ describe('TestReportAnalyticsEffects', () => { effects.addManoeuvreDrivingFaultCatADIPart2$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.ADD_DRIVING_FAULT, - `${manoeuvreTypeLabels[ManoeuvreTypes.reverseRight] - } - ${manoeuvreCompetencyLabels[ManoeuvreCompetencies.controlFault]}`, - 1, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -765,17 +615,7 @@ describe('TestReportAnalyticsEffects', () => { effects.addManoeuvreSeriousFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.ADD_SERIOUS_FAULT, - // eslint-disable-next-line max-len - `${manoeuvreTypeLabels[ManoeuvreTypes.reverseRight]} - ${manoeuvreCompetencyLabels[ManoeuvreCompetencies.controlFault]}`, - 1, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -804,17 +644,7 @@ describe('TestReportAnalyticsEffects', () => { effects.addManoeuvreSeriousFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.ADD_SERIOUS_FAULT}`, - // eslint-disable-next-line max-len - `${manoeuvreTypeLabels[ManoeuvreTypes.reverseRight]} - ${manoeuvreCompetencyLabels[ManoeuvreCompetencies.controlFault]}`, - 1, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -848,17 +678,7 @@ describe('TestReportAnalyticsEffects', () => { effects.addManoeuvreSeriousFaultCatADIPart2$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.ADD_SERIOUS_FAULT, - `${manoeuvreTypeLabels[ManoeuvreTypes.reverseRight] - } - ${manoeuvreCompetencyLabels[ManoeuvreCompetencies.controlFault]}`, - 1, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -890,18 +710,7 @@ describe('TestReportAnalyticsEffects', () => { effects.addManoeuvreDangerousFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.ADD_DANGEROUS_FAULT, - // eslint-disable-next-line max-len - `${manoeuvreTypeLabels[ManoeuvreTypes.reverseRight] - } - ${manoeuvreCompetencyLabels[ManoeuvreCompetencies.controlFault]}`, - 1, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -930,17 +739,7 @@ describe('TestReportAnalyticsEffects', () => { effects.addManoeuvreDangerousFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.ADD_DANGEROUS_FAULT}`, - // eslint-disable-next-line max-len - `${manoeuvreTypeLabels[ManoeuvreTypes.reverseRight]} - ${manoeuvreCompetencyLabels[ManoeuvreCompetencies.controlFault]}`, - 1, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -974,17 +773,7 @@ describe('TestReportAnalyticsEffects', () => { effects.addManoeuvreDangerousFaultCatADIPart2$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.ADD_DANGEROUS_FAULT, - `${manoeuvreTypeLabels[ManoeuvreTypes.reverseRight] - } - ${manoeuvreCompetencyLabels[ManoeuvreCompetencies.controlFault]}`, - 1, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -1013,16 +802,7 @@ describe('TestReportAnalyticsEffects', () => { effects.controlledStopAddDrivingFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.ADD_DRIVING_FAULT, - fullCompetencyLabels['outcomeControlledStop'], - 1, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -1044,16 +824,7 @@ describe('TestReportAnalyticsEffects', () => { effects.controlledStopAddDrivingFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.ADD_DRIVING_FAULT}`, - fullCompetencyLabels['outcomeControlledStop'], - 1, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -1079,16 +850,7 @@ describe('TestReportAnalyticsEffects', () => { effects.controlledStopAddSeriousFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.ADD_SERIOUS_FAULT, - fullCompetencyLabels['outcomeControlledStop'], - 1, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -1110,16 +872,7 @@ describe('TestReportAnalyticsEffects', () => { effects.controlledStopAddSeriousFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.ADD_SERIOUS_FAULT}`, - fullCompetencyLabels['outcomeControlledStop'], - 1, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -1145,16 +898,7 @@ describe('TestReportAnalyticsEffects', () => { effects.controlledStopAddDangerousFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.ADD_DANGEROUS_FAULT, - fullCompetencyLabels['outcomeControlledStop'], - 1, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -1176,16 +920,7 @@ describe('TestReportAnalyticsEffects', () => { effects.controlledStopAddDangerousFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.ADD_DANGEROUS_FAULT}`, - fullCompetencyLabels['outcomeControlledStop'], - 1, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -1211,16 +946,7 @@ describe('TestReportAnalyticsEffects', () => { effects.showMeQuestionDrivingFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.ADD_DRIVING_FAULT, - fullCompetencyLabels['showMeQuestion'], - 1, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -1242,16 +968,7 @@ describe('TestReportAnalyticsEffects', () => { effects.showMeQuestionDrivingFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.ADD_DRIVING_FAULT}`, - fullCompetencyLabels['showMeQuestion'], - 1, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -1277,16 +994,7 @@ describe('TestReportAnalyticsEffects', () => { effects.showMeQuestionSeriousFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.ADD_SERIOUS_FAULT, - fullCompetencyLabels['showMeQuestion'], - 1, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -1308,16 +1016,7 @@ describe('TestReportAnalyticsEffects', () => { effects.showMeQuestionSeriousFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.ADD_SERIOUS_FAULT}`, - fullCompetencyLabels['showMeQuestion'], - 1, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -1343,16 +1042,7 @@ describe('TestReportAnalyticsEffects', () => { effects.showMeQuestionDangerousFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.ADD_DANGEROUS_FAULT, - fullCompetencyLabels['showMeQuestion'], - 1, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -1374,16 +1064,7 @@ describe('TestReportAnalyticsEffects', () => { effects.showMeQuestionDangerousFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.ADD_DANGEROUS_FAULT}`, - fullCompetencyLabels['showMeQuestion'], - 1, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -1412,16 +1093,7 @@ describe('TestReportAnalyticsEffects', () => { effects.removeDrivingFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.REMOVE_DRIVING_FAULT, - fullCompetencyLabels[Competencies.controlsGears], - 0, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -1446,16 +1118,7 @@ describe('TestReportAnalyticsEffects', () => { effects.removeDrivingFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.REMOVE_DRIVING_FAULT}`, - fullCompetencyLabels[Competencies.controlsGears], - 0, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -1482,16 +1145,7 @@ describe('TestReportAnalyticsEffects', () => { effects.removeSeriousFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.REMOVE_SERIOUS_FAULT, - fullCompetencyLabels[Competencies.controlsGears], - 0, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -1513,16 +1167,7 @@ describe('TestReportAnalyticsEffects', () => { effects.removeSeriousFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.REMOVE_SERIOUS_FAULT}`, - fullCompetencyLabels[Competencies.controlsGears], - 0, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -1549,16 +1194,7 @@ describe('TestReportAnalyticsEffects', () => { effects.removeDangerousFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.REMOVE_DANGEROUS_FAULT, - fullCompetencyLabels[Competencies.controlsGears], - 0, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -1580,16 +1216,7 @@ describe('TestReportAnalyticsEffects', () => { effects.removeDangerousFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.REMOVE_DANGEROUS_FAULT}`, - fullCompetencyLabels[Competencies.controlsGears], - 0, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -1620,16 +1247,7 @@ describe('TestReportAnalyticsEffects', () => { effects.removeManoeuvreFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.REMOVE_DRIVING_FAULT, - // eslint-disable-next-line max-len - `${manoeuvreTypeLabels[ManoeuvreTypes.reverseRight]} - ${manoeuvreCompetencyLabels[ManoeuvreCompetencies.controlFault]}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -1659,16 +1277,7 @@ describe('TestReportAnalyticsEffects', () => { effects.removeManoeuvreFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.REMOVE_DRIVING_FAULT}`, - // eslint-disable-next-line max-len - `${manoeuvreTypeLabels[ManoeuvreTypes.reverseRight]} - ${manoeuvreCompetencyLabels[ManoeuvreCompetencies.controlFault]}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -1703,16 +1312,7 @@ describe('TestReportAnalyticsEffects', () => { effects.removeManoeuvreFaultCatADIPart2$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.REMOVE_DRIVING_FAULT, - `${manoeuvreTypeLabels[ManoeuvreTypes.reverseRight] - } - ${manoeuvreCompetencyLabels[ManoeuvreCompetencies.controlFault]}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -1741,15 +1341,7 @@ describe('TestReportAnalyticsEffects', () => { effects.controlledStopRemoveFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.REMOVE_DRIVING_FAULT, - fullCompetencyLabels['outcomeControlledStop'], - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -1771,15 +1363,7 @@ describe('TestReportAnalyticsEffects', () => { effects.controlledStopRemoveFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.REMOVE_DRIVING_FAULT}`, - fullCompetencyLabels['outcomeControlledStop'], - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -1806,15 +1390,7 @@ describe('TestReportAnalyticsEffects', () => { effects.showMeQuestionRemoveFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.REMOVE_DRIVING_FAULT, - fullCompetencyLabels['showMeQuestion'], - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -1836,15 +1412,7 @@ describe('TestReportAnalyticsEffects', () => { effects.showMeQuestionRemoveFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.REMOVE_DRIVING_FAULT}`, - fullCompetencyLabels['showMeQuestion'], - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -1870,15 +1438,7 @@ describe('TestReportAnalyticsEffects', () => { effects.testTermination$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_END, - AnalyticsEvents.END_TEST, - AnalyticsLabels.TERMINATE_TEST, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -1898,15 +1458,7 @@ describe('TestReportAnalyticsEffects', () => { effects.testTermination$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_END}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.END_TEST}`, - AnalyticsLabels.TERMINATE_TEST, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -1930,15 +1482,7 @@ describe('TestReportAnalyticsEffects', () => { effects.toggleLegalRequirement$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.TOGGLE_LEGAL_REQUIREMENT, - `${legalRequirementsLabels[LegalRequirements.normalStart1]} - ${legalRequirementToggleValues.completed}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -1960,15 +1504,7 @@ describe('TestReportAnalyticsEffects', () => { effects.toggleLegalRequirement$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.TOGGLE_LEGAL_REQUIREMENT, - `${legalRequirementsLabels[LegalRequirements.normalStart1]} - ${legalRequirementToggleValues.uncompleted}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -1991,15 +1527,7 @@ describe('TestReportAnalyticsEffects', () => { effects.toggleEco$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.TOGGLE_LEGAL_REQUIREMENT, - `${legalRequirementsLabels['eco']} - ${legalRequirementToggleValues.completed}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -2021,15 +1549,7 @@ describe('TestReportAnalyticsEffects', () => { effects.toggleEco$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.TOGGLE_LEGAL_REQUIREMENT, - `${legalRequirementsLabels['eco']} - ${legalRequirementToggleValues.uncompleted}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -2052,15 +1572,7 @@ describe('TestReportAnalyticsEffects', () => { effects.manoeuvreCompletedEffect$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.TOGGLE_LEGAL_REQUIREMENT, - `${legalRequirementsLabels['manoeuvre']} - ${legalRequirementToggleValues.completed}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -2083,15 +1595,7 @@ describe('TestReportAnalyticsEffects', () => { effects.manoeuvreCompletedEffectCatADIPart2$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.TOGGLE_LEGAL_REQUIREMENT, - `${legalRequirementsLabels['manoeuvre']} - ${legalRequirementToggleValues.completed}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -2115,15 +1619,7 @@ describe('TestReportAnalyticsEffects', () => { effects.deselectReverseLeftManoeuvreEffect$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.TOGGLE_LEGAL_REQUIREMENT, - `${legalRequirementsLabels['manoeuvre']} - ${legalRequirementToggleValues.uncompleted}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -2147,15 +1643,7 @@ describe('TestReportAnalyticsEffects', () => { effects.toggleLegalRequirement$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.TOGGLE_LEGAL_REQUIREMENT}`, - `${legalRequirementsLabels[LegalRequirements.normalStart1]} - ${legalRequirementToggleValues.completed}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -2178,15 +1666,7 @@ describe('TestReportAnalyticsEffects', () => { effects.toggleEco$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.TOGGLE_LEGAL_REQUIREMENT}`, - `${legalRequirementsLabels['eco']} - ${legalRequirementToggleValues.completed}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -2211,15 +1691,7 @@ describe('TestReportAnalyticsEffects', () => { effects.showMeQuestionCompletedEffect$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.TOGGLE_LEGAL_REQUIREMENT, - `${legalRequirementsLabels['vehicleChecks']} - ${legalRequirementToggleValues.completed}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -2245,15 +1717,7 @@ describe('TestReportAnalyticsEffects', () => { effects.showMeQuestionUncompletedEffect$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.TOGGLE_LEGAL_REQUIREMENT, - `${legalRequirementsLabels['vehicleChecks']} - ${legalRequirementToggleValues.uncompleted}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -2278,16 +1742,7 @@ describe('TestReportAnalyticsEffects', () => { effects.uncoupleRecoupleAddDrivingFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.ADD_DRIVING_FAULT, - 'Uncouple recouple', - 1, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -2310,16 +1765,7 @@ describe('TestReportAnalyticsEffects', () => { effects.uncoupleRecoupleAddDrivingFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.ADD_DRIVING_FAULT}`, - 'Uncouple recouple', - 1, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -2345,16 +1791,7 @@ describe('TestReportAnalyticsEffects', () => { effects.uncoupleRecoupleAddSeriousFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.ADD_SERIOUS_FAULT, - 'Uncouple recouple', - 1, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -2376,16 +1813,7 @@ describe('TestReportAnalyticsEffects', () => { effects.uncoupleRecoupleAddSeriousFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.ADD_SERIOUS_FAULT}`, - 'Uncouple recouple', - 1, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -2411,16 +1839,7 @@ describe('TestReportAnalyticsEffects', () => { effects.uncoupleRecoupleAddDangerousFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.ADD_DANGEROUS_FAULT, - 'Uncouple recouple', - 1, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -2442,16 +1861,7 @@ describe('TestReportAnalyticsEffects', () => { effects.uncoupleRecoupleAddDangerousFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.ADD_DANGEROUS_FAULT}`, - 'Uncouple recouple', - 1, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -2477,14 +1887,7 @@ describe('TestReportAnalyticsEffects', () => { effects.reverseLeftPopoverOpened$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.REVERSE_LEFT_POPOVER_OPENED}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -2509,14 +1912,7 @@ describe('TestReportAnalyticsEffects', () => { effects.reverseLeftPopoverClosed$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.REVERSE_LEFT_POPOVER_CLOSED}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -2543,15 +1939,7 @@ describe('TestReportAnalyticsEffects', () => { effects.toggleAvoidanceSpeedReq$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.TOGGLE_AVOIDANCE_SPEED_REQUIREMENT, - `${competencyLabels['speedCheckAvoidance']} - ${speedCheckToggleValues.speedNotMet}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -2578,15 +1966,7 @@ describe('TestReportAnalyticsEffects', () => { effects.toggleAvoidanceSpeedReq$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.TOGGLE_AVOIDANCE_SPEED_REQUIREMENT, - `${competencyLabels['speedCheckAvoidance']} - ${speedCheckToggleValues.speedMet}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -2617,15 +1997,7 @@ describe('TestReportAnalyticsEffects', () => { effects.recordAvoidanceFirstAttempt$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.RECORD_AVOIDANCE_FIRST_ATTEMPT, - `${competencyLabels['speedCheckAvoidance']} - ${attemptValue}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -2656,15 +2028,7 @@ describe('TestReportAnalyticsEffects', () => { effects.recordAvoidanceSecondAttempt$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.RECORD_AVOIDANCE_SECOND_ATTEMPT, - `${competencyLabels['speedCheckAvoidance']} - ${attemptValue}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -2693,15 +2057,7 @@ describe('TestReportAnalyticsEffects', () => { effects.speedRequirementNotMetModalOpened$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.SPEED_REQ_NOT_MET_MODAL_OPENED, - ModalReason.SPEED_REQUIREMENTS, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -2729,16 +2085,7 @@ describe('TestReportAnalyticsEffects', () => { // ASSERT effects.emergencyStopDangerousFaultModelOpened$.subscribe((result) => { expect(result.type) - .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.EMERGENCY_STOP_DANGEROUS_FAULT_MODAL_OPENED, - ModalReason.EMERGENCY_STOP_DANGEROUS, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -2767,15 +2114,7 @@ describe('TestReportAnalyticsEffects', () => { effects.emergencyStopSeriousFaultModelOpened$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.EMERGENCY_STOP_SERIOUS_FAULT_MODAL_OPENED, - ModalReason.EMERGENCY_STOP_SERIOUS, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -2803,15 +2142,7 @@ describe('TestReportAnalyticsEffects', () => { effects.toggleEmergencyStopSpeedReq$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.TOGGLE_EMERGENCY_STOP_SPEED_REQ, - `${competencyLabels['speedCheckEmergency']} - ${speedCheckToggleValues.speedNotMet}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -2838,15 +2169,7 @@ describe('TestReportAnalyticsEffects', () => { effects.toggleEmergencyStopSpeedReq$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.TOGGLE_EMERGENCY_STOP_SPEED_REQ, - `${competencyLabels['speedCheckEmergency']} - ${speedCheckToggleValues.speedMet}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -2877,15 +2200,7 @@ describe('TestReportAnalyticsEffects', () => { effects.recordEmergencyStopFirstAttempt$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.RECORD_EMERGENCY_STOP_FIRST_ATTEMPT, - `${competencyLabels['speedCheckEmergency']} - ${attemptValue}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -2916,15 +2231,7 @@ describe('TestReportAnalyticsEffects', () => { effects.recordEmergencyStopSecondAttempt$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.RECORD_EMERGENCY_STOP_SECOND_ATTEMPT, - `${competencyLabels['speedCheckEmergency']} - ${attemptValue}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -2955,15 +2262,7 @@ describe('TestReportAnalyticsEffects', () => { effects.setSingleFaultCompetencyOutcome$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.ADD_SINGLE_FAULT, - fullCompetencyLabels.slalom, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -2992,15 +2291,7 @@ describe('TestReportAnalyticsEffects', () => { effects.setSingleFaultCompetencyOutcome$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.ADD_DANGEROUS_SINGLE_FAULT, - fullCompetencyLabels.slalom, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -3029,15 +2320,7 @@ describe('TestReportAnalyticsEffects', () => { effects.setSingleFaultCompetencyOutcome$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.ADD_SERIOUS_SINGLE_FAULT, - fullCompetencyLabels.slalom, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -3068,15 +2351,7 @@ describe('TestReportAnalyticsEffects', () => { effects.removeSingleFaultCompetencyOutcome$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.REMOVE_SINGLE_FAULT, - fullCompetencyLabels.slalom, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -3107,15 +2382,7 @@ describe('TestReportAnalyticsEffects', () => { effects.removeSingleDangerousFaultCompetencyOutcome$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.REMOVE_DANGEROUS_SINGLE_FAULT, - fullCompetencyLabels.slalom, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -3146,15 +2413,7 @@ describe('TestReportAnalyticsEffects', () => { effects.removeSingleSeriousFaultCompetencyOutcome$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.REMOVE_SERIOUS_SINGLE_FAULT, - fullCompetencyLabels.slalom, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -3179,15 +2438,7 @@ describe('TestReportAnalyticsEffects', () => { effects.pcvDoorExerciseAddDrivingFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.PCV_DOOR_EXERCISE_ADD_DRIVING_FAULT, - fullCompetencyLabels.pcvDoorExercise, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -3209,15 +2460,7 @@ describe('TestReportAnalyticsEffects', () => { effects.pcvDoorExerciseAddDrivingFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.PCV_DOOR_EXERCISE_ADD_DRIVING_FAULT}`, - fullCompetencyLabels.pcvDoorExercise, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -3243,15 +2486,7 @@ describe('TestReportAnalyticsEffects', () => { effects.pcvDoorExerciseAddSeriousFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.PCV_DOOR_EXERCISE_ADD_SERIOUS_FAULT, - fullCompetencyLabels.pcvDoorExercise, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -3273,15 +2508,7 @@ describe('TestReportAnalyticsEffects', () => { effects.pcvDoorExerciseAddSeriousFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.PCV_DOOR_EXERCISE_ADD_SERIOUS_FAULT}`, - fullCompetencyLabels.pcvDoorExercise, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -3307,15 +2534,7 @@ describe('TestReportAnalyticsEffects', () => { effects.pcvDoorExerciseAddDangerousFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.PCV_DOOR_EXERCISE_ADD_DANGEROUS_FAULT, - fullCompetencyLabels.pcvDoorExercise, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -3337,15 +2556,7 @@ describe('TestReportAnalyticsEffects', () => { effects.pcvDoorExerciseAddDangerousFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.PCV_DOOR_EXERCISE_ADD_DANGEROUS_FAULT}`, - fullCompetencyLabels.pcvDoorExercise, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -3371,15 +2582,7 @@ describe('TestReportAnalyticsEffects', () => { effects.pcvDoorExerciseRemoveDrivingFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.PCV_DOOR_EXERCISE_REMOVE_DRIVING_FAULT, - fullCompetencyLabels.pcvDoorExercise, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -3401,15 +2604,7 @@ describe('TestReportAnalyticsEffects', () => { effects.pcvDoorExerciseRemoveDrivingFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.PCV_DOOR_EXERCISE_REMOVE_DRIVING_FAULT}`, - fullCompetencyLabels.pcvDoorExercise, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -3435,15 +2630,7 @@ describe('TestReportAnalyticsEffects', () => { effects.pcvDoorExerciseRemoveSeriousFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.PCV_DOOR_EXERCISE_REMOVE_SERIOUS_FAULT, - fullCompetencyLabels.pcvDoorExercise, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -3465,15 +2652,7 @@ describe('TestReportAnalyticsEffects', () => { effects.pcvDoorExerciseRemoveSeriousFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.PCV_DOOR_EXERCISE_REMOVE_SERIOUS_FAULT}`, - fullCompetencyLabels.pcvDoorExercise, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -3499,15 +2678,7 @@ describe('TestReportAnalyticsEffects', () => { effects.pcvDoorExerciseRemoveDangerousFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.PCV_DOOR_EXERCISE_REMOVE_DANGEROUS_FAULT, - fullCompetencyLabels.pcvDoorExercise, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -3529,15 +2700,7 @@ describe('TestReportAnalyticsEffects', () => { effects.pcvDoorExerciseRemoveDangerousFault$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.PCV_DOOR_EXERCISE_REMOVE_DANGEROUS_FAULT}`, - fullCompetencyLabels.pcvDoorExercise, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -3565,15 +2728,7 @@ describe('TestReportAnalyticsEffects', () => { effects.toggleHighwayCodeSafety$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.TOGGLE_LEGAL_REQUIREMENT, - `${legalRequirementsLabels.highwayCodeSafety} - ${legalRequirementToggleValues.completed}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -3598,15 +2753,7 @@ describe('TestReportAnalyticsEffects', () => { effects.toggleHighwayCodeSafety$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.TOGGLE_LEGAL_REQUIREMENT, - `${legalRequirementsLabels.highwayCodeSafety} - ${legalRequirementToggleValues.uncompleted}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -3633,15 +2780,7 @@ describe('TestReportAnalyticsEffects', () => { effects.toggleEcoControl$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.TOGGLE_ECO_CONTROL, - 'selected', - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -3663,15 +2802,7 @@ describe('TestReportAnalyticsEffects', () => { effects.toggleEcoControl$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.TOGGLE_ECO_CONTROL, - 'unselected', - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -3696,15 +2827,7 @@ describe('TestReportAnalyticsEffects', () => { effects.toggleEcoPlanning$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.TOGGLE_ECO_PLANNING, - 'selected', - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -3726,15 +2849,7 @@ describe('TestReportAnalyticsEffects', () => { effects.toggleEcoPlanning$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.TOGGLE_ECO_PLANNING, - 'unselected', - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -3759,15 +2874,7 @@ describe('TestReportAnalyticsEffects', () => { effects.toggleETA$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.TOGGLE_ETA_PHYSICAL, - 'selected', - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -3791,15 +2898,7 @@ describe('TestReportAnalyticsEffects', () => { effects.toggleETA$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.TOGGLE_ETA_PHYSICAL, - 'unselected', - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -3824,15 +2923,7 @@ describe('TestReportAnalyticsEffects', () => { effects.toggleETA$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.TOGGLE_ETA_VERBAL, - 'selected', - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -3856,15 +2947,7 @@ describe('TestReportAnalyticsEffects', () => { effects.toggleETA$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.TOGGLE_ETA_VERBAL, - 'unselected', - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -3890,14 +2973,7 @@ describe('TestReportAnalyticsEffects', () => { effects.startTimer$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.START_TIMER, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -3920,15 +2996,7 @@ describe('TestReportAnalyticsEffects', () => { effects.toggleControlledStop$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.TOGGLE_CONTROLLED_STOP, - `${legalRequirementToggleValues.completed}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -3950,15 +3018,7 @@ describe('TestReportAnalyticsEffects', () => { effects.toggleControlledStop$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.TOGGLE_CONTROLLED_STOP, - `${legalRequirementToggleValues.uncompleted}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledTimes(1); @@ -3982,13 +3042,7 @@ describe('TestReportAnalyticsEffects', () => { // ASSERT effects.studentLevelChanged$.subscribe((result) => { expect(result.type).toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent).toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.STUDENT_LEVEL_CHANGED, - `student level changed to ${studentLevel}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledTimes(1); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( @@ -4008,13 +3062,7 @@ describe('TestReportAnalyticsEffects', () => { // ASSERT effects.studentLevelChanged$.subscribe((result) => { expect(result.type).toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent).toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.STUDENT_LEVEL_CHANGED}`, - `student level changed to ${studentLevel}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledTimes(1); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( @@ -4036,13 +3084,7 @@ describe('TestReportAnalyticsEffects', () => { // ASSERT effects.studentLevelChanged$.subscribe((result) => { expect(result.type).toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent).toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.LESSON_THEME_ADDED, - lessonThemeValues[lessonTheme], - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledTimes(1); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( @@ -4062,13 +3104,7 @@ describe('TestReportAnalyticsEffects', () => { // ASSERT effects.addLessonTheme$.subscribe((result) => { expect(result.type).toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent).toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.LESSON_THEME_ADDED}`, - lessonThemeValues[lessonTheme], - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledTimes(1); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( @@ -4090,13 +3126,7 @@ describe('TestReportAnalyticsEffects', () => { // ASSERT effects.removeLessonTheme$.subscribe((result) => { expect(result.type).toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent).toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.LESSON_THEME_REMOVED, - lessonThemeValues[lessonTheme], - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledTimes(1); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( @@ -4116,13 +3146,7 @@ describe('TestReportAnalyticsEffects', () => { // ASSERT effects.removeLessonTheme$.subscribe((result) => { expect(result.type).toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent).toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.LESSON_THEME_REMOVED}`, - lessonThemeValues[lessonTheme], - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledTimes(1); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( @@ -4144,13 +3168,7 @@ describe('TestReportAnalyticsEffects', () => { // ASSERT effects.otherReasonChanged$.subscribe((result) => { expect(result.type).toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent).toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.OTHER_REASON_CHANGED, - `other reason changed to - ${otherReason}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledTimes(1); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( @@ -4172,13 +3190,7 @@ describe('TestReportAnalyticsEffects', () => { // ASSERT effects.otherReasonChanged$.subscribe((result) => { expect(result.type).toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent).toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.OTHER_REASON_CHANGED}`, - `other reason changed to - ${otherReason}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledTimes(1); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( @@ -4203,13 +3215,7 @@ describe('TestReportAnalyticsEffects', () => { // ASSERT effects.lessonPlanningQuestionScoreChanged$.subscribe((result) => { expect(result.type).toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent).toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.LESSON_PLANNING_CHANGED, - `lesson planning changed: question ${question}, score ${score}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledTimes(1); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( @@ -4232,13 +3238,7 @@ describe('TestReportAnalyticsEffects', () => { // ASSERT effects.lessonPlanningQuestionScoreChanged$.subscribe((result) => { expect(result.type).toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent).toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.LESSON_PLANNING_CHANGED}`, - `lesson planning changed: question ${question}, score ${score}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledTimes(1); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( @@ -4263,13 +3263,7 @@ describe('TestReportAnalyticsEffects', () => { // ASSERT effects.riskManagementQuestionScoreChanged$.subscribe((result) => { expect(result.type).toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent).toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.RISK_MANAGEMENT_CHANGED, - `risk management changed: question ${question}, score ${score}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledTimes(1); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( @@ -4292,13 +3286,7 @@ describe('TestReportAnalyticsEffects', () => { // ASSERT effects.riskManagementQuestionScoreChanged$.subscribe((result) => { expect(result.type).toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent).toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.RISK_MANAGEMENT_CHANGED}`, - `risk management changed: question ${question}, score ${score}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledTimes(1); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( @@ -4324,13 +3312,7 @@ describe('TestReportAnalyticsEffects', () => { // ASSERT effects.teachingLearningStrategyQuestionScoreChanged$.subscribe((result) => { expect(result.type).toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent).toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.TEACHING_LEARNING_STRATEGY_CHANGED, - `teaching learning strategy changed: question ${question}, score ${score}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledTimes(1); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( @@ -4353,13 +3335,7 @@ describe('TestReportAnalyticsEffects', () => { // ASSERT effects.teachingLearningStrategyQuestionScoreChanged$.subscribe((result) => { expect(result.type).toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent).toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.TEACHING_LEARNING_STRATEGY_CHANGED}`, - `teaching learning strategy changed: question ${question}, score ${score}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledTimes(1); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( @@ -4384,13 +3360,7 @@ describe('TestReportAnalyticsEffects', () => { // ASSERT effects.testReportAssessmentOverallScore$.subscribe((result) => { expect(result.type).toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent).toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.ASSESSMENT_OVERALL_SCORE_CHANGED, - `overall assessment score changed: ${score}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledTimes(1); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( @@ -4410,13 +3380,7 @@ describe('TestReportAnalyticsEffects', () => { // ASSERT effects.teachingLearningStrategyQuestionScoreChanged$.subscribe((result) => { expect(result.type).toEqual(AnalyticRecorded.type); - // TODO MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent).toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.ASSESSMENT_OVERALL_SCORE_CHANGED}`, - `overall assessment score changed: ${score}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledTimes(1); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( diff --git a/src/app/pages/test-report/components/reverse-diagram-modal/__tests__/reverse-diagram-modal.analytics.effects.spec.ts b/src/app/pages/test-report/components/reverse-diagram-modal/__tests__/reverse-diagram-modal.analytics.effects.spec.ts index c49241501..a85f18cf0 100644 --- a/src/app/pages/test-report/components/reverse-diagram-modal/__tests__/reverse-diagram-modal.analytics.effects.spec.ts +++ b/src/app/pages/test-report/components/reverse-diagram-modal/__tests__/reverse-diagram-modal.analytics.effects.spec.ts @@ -7,10 +7,7 @@ import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/ import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { - AnalyticsDimensionIndices, AnalyticsScreenNames, - AnalyticsEventCategories, - AnalyticsEvents, GoogleAnalyticsEventPrefix, GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, @@ -36,7 +33,6 @@ describe('ReverseDiagramModalAnalyticsEffects', () => { let actions$: ReplaySubject; let store$: Store; const screenName = AnalyticsScreenNames.REVERSE_DIAGRAM; - const screenNamePracticeMode = `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsScreenNames.REVERSE_DIAGRAM}`; const mockApplication: Application = { applicationId: 123456, bookingSequence: 78, @@ -77,15 +73,6 @@ describe('ReverseDiagramModalAnalyticsEffects', () => { // ASSERT effects.reverseDiagramViewDidEnter$.subscribe((result) => { expect(result.type).toEqual(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.TEST_CATEGORY, 'B+E'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_ID, '1'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.APPLICATION_REFERENCE, '123456789'); - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(screenName); // GA4 Analytics expect(analyticsProviderMock.addGACustomDimension) @@ -110,15 +97,6 @@ describe('ReverseDiagramModalAnalyticsEffects', () => { // ASSERT effects.reverseDiagramViewDidEnter$.subscribe((result) => { expect(result.type).toEqual(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.TEST_CATEGORY, 'B+E'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_ID, '1'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.APPLICATION_REFERENCE, '123456789'); - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(screenNamePracticeMode); // GA4 Analytics expect(analyticsProviderMock.addGACustomDimension) @@ -143,12 +121,7 @@ describe('ReverseDiagramModalAnalyticsEffects', () => { // ASSERT effects.reverseDiagramOpened$.subscribe((result) => { expect(result.type).toEqual(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent).toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.REVERSE_DIAGRAM_OPENED}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledTimes(1); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( @@ -170,12 +143,7 @@ describe('ReverseDiagramModalAnalyticsEffects', () => { // ASSERT effects.reverseDiagramClosed$.subscribe((result) => { expect(result.type).toEqual(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent).toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.REVERSE_DIAGRAM_CLOSED}`, - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledTimes(1); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( @@ -197,13 +165,7 @@ describe('ReverseDiagramModalAnalyticsEffects', () => { // ASSERT effects.reverseDiagramLengthChanged$.subscribe((result) => { expect(result.type).toEqual(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent).toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.REVERSE_DIAGRAM_LENGTH_CHANGED}`, - 'from 100 to 10', - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledTimes(1); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( @@ -227,13 +189,7 @@ describe('ReverseDiagramModalAnalyticsEffects', () => { // ASSERT effects.reverseDiagramWidthChanged$.subscribe((result) => { expect(result.type).toEqual(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent).toHaveBeenCalledTimes(1); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEventCategories.TEST_REPORT}`, - `${AnalyticsEventCategories.PRACTICE_TEST} - ${AnalyticsEvents.REVERSE_DIAGRAM_WIDTH_CHANGED}`, - 'from 100 to 10', - ); + // GA4 Analytics expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledTimes(1); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( diff --git a/src/app/pages/test-report/components/reverse-diagram-modal/reverse-diagram-modal.analytics.effects.ts b/src/app/pages/test-report/components/reverse-diagram-modal/reverse-diagram-modal.analytics.effects.ts index 606509161..ad530f76c 100644 --- a/src/app/pages/test-report/components/reverse-diagram-modal/reverse-diagram-modal.analytics.effects.ts +++ b/src/app/pages/test-report/components/reverse-diagram-modal/reverse-diagram-modal.analytics.effects.ts @@ -5,9 +5,6 @@ import { switchMap, withLatestFrom, concatMap } from 'rxjs/operators'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticsScreenNames, - AnalyticsDimensionIndices, - AnalyticsEventCategories, - AnalyticsEvents, GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, GoogleAnalyticsEventsValues, @@ -21,7 +18,7 @@ import { getCandidate } from '@store/tests/journal-data/common/candidate/candida import { getCandidateId } from '@store/tests/journal-data/common/candidate/candidate.selector'; import { TestsModel } from '@store/tests/tests.model'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; -import { analyticsEventTypePrefix, formatAnalyticsText } from '@shared/helpers/format-analytics-text'; +import { analyticsEventTypePrefix } from '@shared/helpers/format-analytics-text'; import { getApplicationReference, } from '@store/tests/journal-data/common/application-reference/application-reference.reducer'; @@ -74,13 +71,7 @@ export class ReverseDiagramModalAnalyticsEffects { [, tests, applicationReference, candidateId, category]: [ReturnType , TestsModel, string, number, CategoryCode], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.addCustomDimension(AnalyticsDimensionIndices.TEST_CATEGORY, category); - this.analytics.addCustomDimension(AnalyticsDimensionIndices.CANDIDATE_ID, `${candidateId}`); - this.analytics.addCustomDimension(AnalyticsDimensionIndices.APPLICATION_REFERENCE, applicationReference); - this.analytics.setCurrentPage( - formatAnalyticsText(AnalyticsScreenNames.REVERSE_DIAGRAM, tests), - ); + // GA4 Analytics this.analytics.addGACustomDimension(GoogleAnalyticsCustomDimension.TEST_CATEGORY, category); this.analytics.addGACustomDimension(GoogleAnalyticsCustomDimension.CANDIDATE_ID, `${candidateId}`); @@ -101,12 +92,8 @@ export class ReverseDiagramModalAnalyticsEffects { ), ), )), - concatMap(([, tests]: [ReturnType , TestsModel]) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.REVERSE_DIAGRAM_OPENED, tests), - ); + concatMap(([, ]: [ReturnType , TestsModel]) => { + // GA4 Analytics this.analytics.logGAEvent( GoogleAnalyticsEvents.NAVIGATION, @@ -126,12 +113,8 @@ export class ReverseDiagramModalAnalyticsEffects { ), ), )), - concatMap(([, tests]: [ReturnType , TestsModel]) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.REVERSE_DIAGRAM_CLOSED, tests), - ); + concatMap(([, ]: [ReturnType , TestsModel]) => { + // GA4 Analytics this.analytics.logGAEvent( GoogleAnalyticsEvents.NAVIGATION, @@ -151,14 +134,9 @@ export class ReverseDiagramModalAnalyticsEffects { ), ), )), - concatMap(([action, tests]: + concatMap(([action, ]: [ReturnType, TestsModel]) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.REVERSE_DIAGRAM_LENGTH_CHANGED, tests), - `from ${action.previousLength} to ${action.newLength}`, - ); + // GA4 Analytics this.analytics.logGAEvent( GoogleAnalyticsEvents.VEHICLE_LENGTH, @@ -180,13 +158,8 @@ export class ReverseDiagramModalAnalyticsEffects { ), ), )), - concatMap(([action, tests]: [ReturnType , TestsModel]) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.REVERSE_DIAGRAM_WIDTH_CHANGED, tests), - `from ${action.previousWidth} to ${action.newWidth}`, - ); + concatMap(([action, ]: [ReturnType , TestsModel]) => { + // GA4 Analytics this.analytics.logGAEvent( GoogleAnalyticsEvents.VEHICLE_WIDTH, diff --git a/src/app/pages/test-report/test-report.analytics.effects.ts b/src/app/pages/test-report/test-report.analytics.effects.ts index 0eb44b3cd..cd5d6ddce 100644 --- a/src/app/pages/test-report/test-report.analytics.effects.ts +++ b/src/app/pages/test-report/test-report.analytics.effects.ts @@ -6,9 +6,6 @@ import { select, Store } from '@ngrx/store'; import { StoreModel } from '@shared/models/store.model'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { - AnalyticsEventCategories, - AnalyticsEvents, - AnalyticsLabels, AnalyticsScreenNames, GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, @@ -36,17 +33,15 @@ import { getTests } from '@store/tests/tests.reducer'; import { competencyLabels, fullAnalyticCompetencyLabels, - fullCompetencyLabels, } from '@shared/constants/competencies/competencies'; import { manoeuvreCompetencyAnalyticLabels, - manoeuvreCompetencyLabels, manoeuvreTypeAnalyticLabels, - manoeuvreTypeLabels, + manoeuvreTypeAnalyticLabels, } from '@shared/constants/competencies/catb-manoeuvres'; import { lessonThemeValues } from '@shared/constants/adi3-questions/lesson-theme.constants'; import { AnalyticNotRecorded, AnalyticRecorded } from '@providers/analytics/analytics.actions'; import { TestsModel } from '@store/tests/tests.model'; -import { analyticsEventTypePrefix, formatAnalyticsText } from '@shared/helpers/format-analytics-text'; +import { analyticsEventTypePrefix } from '@shared/helpers/format-analytics-text'; import { legalRequirementsLabels, legalRequirementToggleValues, @@ -59,7 +54,6 @@ import * as uncoupleRecoupleActions from '@store/tests/test-data/common/uncouple import { getTestData as getCatAmod1TestData } from '@store/tests/test-data/cat-a-mod1/test-data.cat-a-mod1.reducer'; import { getAvoidance } from '@store/tests/test-data/cat-a-mod1/avoidance/avoidance.selector'; import { Avoidance, EmergencyStop } from '@dvsa/mes-test-schema/categories/AM1'; -import { speedCheckToggleValues } from '@shared/constants/competencies/cata-mod1-speed-checks'; import { getEmergencyStop } from '@store/tests/test-data/cat-a-mod1/emergency-stop/emergency-stop.selector'; import * as singleFaultCompetencyActions from '@store/tests/test-data/common/single-fault-competencies/single-fault-competencies.actions'; @@ -92,7 +86,6 @@ import { } from '@store/tests/test-data/cat-adi-part3/teaching-learning-strategies/teaching-learning-strategies.actions'; import { AppConfigProvider } from '@providers/app-config/app-config'; import { - CompetencyOutcomeAnalyticEvent, CompetencyOutcomeGA4Event, } from '@shared/helpers/competency-outcome-analytic-event'; import { AssessmentOverallScoreChanged } from '@pages/test-report/cat-adi-part3/test-report.cat-adi-part3.actions'; @@ -133,8 +126,6 @@ export class TestReportAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.setCurrentPage(formatAnalyticsText(AnalyticsScreenNames.TEST_REPORT, tests)); // GA4 Analytics this.analytics.setGACurrentPage(analyticsEventTypePrefix(AnalyticsScreenNames.TEST_REPORT, tests)); @@ -173,12 +164,6 @@ export class TestReportAnalyticsEffects { } if (removeFaultMode) { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.SELECT_REMOVE_MODE, tests), - formatAnalyticsText(AnalyticsEvents.REMOVE_MODE_SELECTED, tests), - ); // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.SELECT_MODE, tests), @@ -187,12 +172,7 @@ export class TestReportAnalyticsEffects { ); return of(AnalyticRecorded()); } - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.EXIT_REMOVE_MODE, tests), - formatAnalyticsText(AnalyticsEvents.REMOVE_MODE_EXITED, tests), - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.EXIT_MODE, tests), @@ -227,11 +207,7 @@ export class TestReportAnalyticsEffects { if (!action.isUserGenerated) { return of(AnalyticNotRecorded()); } - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.SELECT_SERIOUS_MODE, tests), - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.SELECT_MODE, tests), @@ -266,11 +242,7 @@ export class TestReportAnalyticsEffects { if (!action.isUserGenerated) { return of(AnalyticNotRecorded()); } - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.SELECT_DANGEROUS_MODE, tests), - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.SELECT_MODE, tests), @@ -302,13 +274,7 @@ export class TestReportAnalyticsEffects { [action, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.ADD_DRIVING_FAULT, tests), - fullCompetencyLabels[action.faultPayload.competency], - action.faultPayload.newFaultCount, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -342,13 +308,7 @@ export class TestReportAnalyticsEffects { [action, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.ADD_SERIOUS_FAULT, tests), - fullCompetencyLabels[action.competency], - 1, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -382,13 +342,7 @@ export class TestReportAnalyticsEffects { [action, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.ADD_DANGEROUS_FAULT, tests), - fullCompetencyLabels[action.competency], - 1, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -422,14 +376,7 @@ export class TestReportAnalyticsEffects { [action, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.ADD_DRIVING_FAULT, tests), - // eslint-disable-next-line max-len - `${manoeuvreTypeLabels[action.manoeuvrePayload.manoeuvre]} - ${manoeuvreCompetencyLabels[action.manoeuvrePayload.competency]}`, - 1, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -467,13 +414,7 @@ export class TestReportAnalyticsEffects { [action, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.ADD_DRIVING_FAULT, tests), - `${manoeuvreTypeLabels[action.payload.manoeuvre]} - ${manoeuvreCompetencyLabels[action.payload.competency]}`, - 1, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -511,14 +452,7 @@ export class TestReportAnalyticsEffects { [action, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.ADD_SERIOUS_FAULT, tests), - // eslint-disable-next-line max-len - `${manoeuvreTypeLabels[action.manoeuvrePayload.manoeuvre]} - ${manoeuvreCompetencyLabels[action.manoeuvrePayload.competency]}`, - 1, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -556,13 +490,7 @@ export class TestReportAnalyticsEffects { [action, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.ADD_SERIOUS_FAULT, tests), - `${manoeuvreTypeLabels[action.payload.manoeuvre]} - ${manoeuvreCompetencyLabels[action.payload.competency]}`, - 1, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -600,14 +528,7 @@ export class TestReportAnalyticsEffects { [action, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.ADD_DANGEROUS_FAULT, tests), - // eslint-disable-next-line max-len - `${manoeuvreTypeLabels[action.manoeuvrePayload.manoeuvre]} - ${manoeuvreCompetencyLabels[action.manoeuvrePayload.competency]}`, - 1, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -645,13 +566,7 @@ export class TestReportAnalyticsEffects { [action, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.ADD_DANGEROUS_FAULT, tests), - `${manoeuvreTypeLabels[action.payload.manoeuvre]} - ${manoeuvreCompetencyLabels[action.payload.competency]}`, - 1, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -689,13 +604,7 @@ export class TestReportAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.ADD_DRIVING_FAULT, tests), - fullCompetencyLabels['outcomeControlledStop'], - 1, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -729,13 +638,7 @@ export class TestReportAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.ADD_SERIOUS_FAULT, tests), - fullCompetencyLabels['outcomeControlledStop'], - 1, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -769,11 +672,7 @@ export class TestReportAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_END, tests), - formatAnalyticsText(AnalyticsEvents.RETURN_TO_TEST, tests), - 'Test Report - Return To Test', - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.RETURN_TO_TEST, tests), @@ -803,13 +702,7 @@ export class TestReportAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.ADD_DANGEROUS_FAULT, tests), - fullCompetencyLabels['outcomeControlledStop'], - 1, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -843,13 +736,7 @@ export class TestReportAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.ADD_DRIVING_FAULT, tests), - fullCompetencyLabels['outcomeHighwayCodeSafety'], - 1, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -883,13 +770,7 @@ export class TestReportAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.ADD_SERIOUS_FAULT, tests), - fullCompetencyLabels['outcomeHighwayCodeSafety'], - 1, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -923,13 +804,7 @@ export class TestReportAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.ADD_DRIVING_FAULT, tests), - fullCompetencyLabels['showMeQuestion'], - 1, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -963,13 +838,7 @@ export class TestReportAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.ADD_SERIOUS_FAULT, tests), - fullCompetencyLabels['showMeQuestion'], - 1, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -1003,13 +872,8 @@ export class TestReportAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.ADD_DANGEROUS_FAULT, tests), - fullCompetencyLabels['showMeQuestion'], - 1, - ); + + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( GoogleAnalyticsEvents.ADD_FAULT, @@ -1042,13 +906,7 @@ export class TestReportAnalyticsEffects { [action, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.REMOVE_DRIVING_FAULT, tests), - fullCompetencyLabels[action.faultPayload.competency], - action.faultPayload.newFaultCount, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -1082,13 +940,7 @@ export class TestReportAnalyticsEffects { [action, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.REMOVE_SERIOUS_FAULT, tests), - fullCompetencyLabels[action.competency], - 0, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -1122,13 +974,7 @@ export class TestReportAnalyticsEffects { [action, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.REMOVE_DANGEROUS_FAULT, tests), - fullCompetencyLabels[action.competency], - 0, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -1162,12 +1008,7 @@ export class TestReportAnalyticsEffects { [action, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(CompetencyOutcomeAnalyticEvent(action.faultLevel), tests), - `${manoeuvreTypeLabels[action.payload.manoeuvre]} - ${manoeuvreCompetencyLabels[action.payload.competency]}`, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -1205,12 +1046,7 @@ export class TestReportAnalyticsEffects { [action, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(CompetencyOutcomeAnalyticEvent(action.faultLevel), tests), - `${manoeuvreTypeLabels[action.payload.manoeuvre]} - ${manoeuvreCompetencyLabels[action.payload.competency]}`, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -1248,12 +1084,7 @@ export class TestReportAnalyticsEffects { [action, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(CompetencyOutcomeAnalyticEvent(action.faultLevel), tests), - fullCompetencyLabels['outcomeControlledStop'], - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -1286,12 +1117,7 @@ export class TestReportAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.REMOVE_FAULT, tests), - fullCompetencyLabels['outcomeHighwayCodeSafety'], - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -1323,12 +1149,7 @@ export class TestReportAnalyticsEffects { [action, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(CompetencyOutcomeAnalyticEvent(action.faultLevel), tests), - fullCompetencyLabels.showMeQuestion, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -1362,12 +1183,7 @@ export class TestReportAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_END, tests), - formatAnalyticsText(AnalyticsEvents.END_TEST, tests), - AnalyticsLabels.TERMINATE_TEST, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.TEST_TERMINATED, tests), @@ -1397,12 +1213,7 @@ export class TestReportAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_END, tests), - formatAnalyticsText(AnalyticsEvents.END_TEST, tests), - AnalyticsLabels.TEST_ENDED, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.TEST_ENDED, tests), @@ -1442,12 +1253,6 @@ export class TestReportAnalyticsEffects { ? legalRequirementToggleValues.completed : legalRequirementToggleValues.uncompleted; - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.TOGGLE_LEGAL_REQUIREMENT, tests), - `${legalRequirementsLabels[action.legalRequirement]} - ${toggleValue}`, - ); // GA4 Analytics let itemName: string; @@ -1527,12 +1332,6 @@ export class TestReportAnalyticsEffects { const toggleValue = eco.completed ? legalRequirementToggleValues.completed : legalRequirementToggleValues.uncompleted; - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.TOGGLE_LEGAL_REQUIREMENT, tests), - `${legalRequirementsLabels['eco']} - ${toggleValue}`, - ); // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix(GoogleAnalyticsEvents.LEGAL_REQUIREMENT, tests)}_ECO`, @@ -1573,12 +1372,6 @@ export class TestReportAnalyticsEffects { const toggleValue = eco.adviceGivenControl ? 'selected' : 'unselected'; - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.TOGGLE_ECO_CONTROL, tests), - `${toggleValue}`, - ); // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.ECO_CONTROL, tests), @@ -1619,12 +1412,6 @@ export class TestReportAnalyticsEffects { const toggleValue = eco.adviceGivenPlanning ? 'selected' : 'unselected'; - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.TOGGLE_ECO_PLANNING, tests), - `${toggleValue}`, - ); // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.ECO_PLANNING, tests), @@ -1662,10 +1449,6 @@ export class TestReportAnalyticsEffects { [action, tests, eta]: [ReturnType, TestsModel, ETA, boolean], ) => { - // TODO MES-9495 - remove old analytics method - const event: string = (action.examinerAction === ExaminerActions.physical) - ? AnalyticsEvents.TOGGLE_ETA_PHYSICAL - : AnalyticsEvents.TOGGLE_ETA_VERBAL; // GA4 Analytics method const etaName: string = (action.examinerAction === ExaminerActions.physical) ? GoogleAnalyticsEventsValues.ETA_PHYSICAL @@ -1679,12 +1462,6 @@ export class TestReportAnalyticsEffects { ? 'selected' : 'unselected'; - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(event, tests), - `${toggleValue}`, - ); // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.ETA, tests), @@ -1728,12 +1505,6 @@ export class TestReportAnalyticsEffects { ? legalRequirementToggleValues.completed : legalRequirementToggleValues.uncompleted; - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.TOGGLE_CONTROLLED_STOP, tests), - `${toggleValue}`, - ); // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.CONTROLLED_STOP, tests), @@ -1775,12 +1546,7 @@ export class TestReportAnalyticsEffects { const toggleValue = highwayCodeSafety.selected ? legalRequirementToggleValues.completed : legalRequirementToggleValues.uncompleted; - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.TOGGLE_LEGAL_REQUIREMENT, tests), - `${legalRequirementsLabels.highwayCodeSafety} - ${toggleValue}`, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.LEGAL_REQUIREMENT, tests), @@ -1814,12 +1580,7 @@ export class TestReportAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.TOGGLE_LEGAL_REQUIREMENT, tests), - `${legalRequirementsLabels['manoeuvre']} - ${legalRequirementToggleValues.completed}`, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix(GoogleAnalyticsEvents.LEGAL_REQUIREMENT, tests)}_MAN`, @@ -1851,12 +1612,7 @@ export class TestReportAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.TOGGLE_LEGAL_REQUIREMENT, tests), - `${legalRequirementsLabels['manoeuvre']} - ${legalRequirementToggleValues.completed}`, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix(GoogleAnalyticsEvents.LEGAL_REQUIREMENT, tests)}_MAN`, @@ -1888,12 +1644,7 @@ export class TestReportAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.TOGGLE_LEGAL_REQUIREMENT, tests), - `${legalRequirementsLabels['manoeuvre']} - ${legalRequirementToggleValues.uncompleted}`, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix(GoogleAnalyticsEvents.LEGAL_REQUIREMENT, tests)}_MAN`, @@ -1927,12 +1678,7 @@ export class TestReportAnalyticsEffects { ? true : this.appConfigProvider.getAppConfig()?.journal?.enablePracticeModeAnalytics), concatMap(([, tests]: [VehicleChecksTypes, TestsModel, boolean]) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.TOGGLE_LEGAL_REQUIREMENT, tests), - `${legalRequirementsLabels['vehicleChecks']} - ${legalRequirementToggleValues.completed}`, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix(GoogleAnalyticsEvents.LEGAL_REQUIREMENT, tests)}_SM`, @@ -1964,12 +1710,7 @@ export class TestReportAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.TOGGLE_LEGAL_REQUIREMENT, tests), - `${legalRequirementsLabels['vehicleChecks']} - ${legalRequirementToggleValues.uncompleted}`, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix(GoogleAnalyticsEvents.LEGAL_REQUIREMENT, tests)}_SM`, @@ -2001,13 +1742,7 @@ export class TestReportAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.ADD_DRIVING_FAULT, tests), - 'Uncouple recouple', - 1, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -2041,13 +1776,7 @@ export class TestReportAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.ADD_SERIOUS_FAULT, tests), - 'Uncouple recouple', - 1, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -2081,13 +1810,7 @@ export class TestReportAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.ADD_DANGEROUS_FAULT, tests), - 'Uncouple recouple', - 1, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -2121,11 +1844,7 @@ export class TestReportAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.REVERSE_LEFT_POPOVER_OPENED, tests), - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.NAVIGATION, tests), @@ -2157,11 +1876,7 @@ export class TestReportAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.REVERSE_LEFT_POPOVER_CLOSED, tests), - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.NAVIGATION, tests), @@ -2193,18 +1908,10 @@ export class TestReportAnalyticsEffects { ? true : this.appConfigProvider.getAppConfig()?.journal?.enablePracticeModeAnalytics), concatMap(([action, tests]) => { - const toggleValue = (action.type === avoidanceActions.AddAvoidanceSeriousFault.type) - ? speedCheckToggleValues.speedNotMet - : speedCheckToggleValues.speedMet; const toggleGA4Value = (action.type === avoidanceActions.AddAvoidanceSeriousFault.type) ? GoogleAnalyticsEventsValues.NOT_MET : GoogleAnalyticsEventsValues.MET; - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.TOGGLE_AVOIDANCE_SPEED_REQUIREMENT, tests), - `${competencyLabels['speedCheckAvoidance']} - ${toggleValue}`, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.AVOIDANCE_MANOEUVRE, tests), @@ -2243,12 +1950,7 @@ export class TestReportAnalyticsEffects { [ReturnType, TestsModel, Avoidance, boolean], ) => { const attemptValue = avoidance.firstAttempt; - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.RECORD_AVOIDANCE_FIRST_ATTEMPT, tests), - `${competencyLabels['speedCheckAvoidance']} - ${attemptValue}`, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.AVOIDANCE_MANOEUVRE, tests), @@ -2287,12 +1989,7 @@ export class TestReportAnalyticsEffects { [ReturnType, TestsModel, Avoidance, boolean], ) => { const attemptValue = avoidance.secondAttempt; - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.RECORD_AVOIDANCE_SECOND_ATTEMPT, tests), - `${competencyLabels['speedCheckAvoidance']} - ${attemptValue}`, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.AVOIDANCE_MANOEUVRE, tests), @@ -2323,16 +2020,8 @@ export class TestReportAnalyticsEffects { filter(([, , practiceMode]) => !practiceMode ? true : this.appConfigProvider.getAppConfig()?.journal?.enablePracticeModeAnalytics), - concatMap(([action, tests]) => { - // TODO MES-9495 - remove old analytics - const toggleValue = (action.type === emergencyStopActions.AddEmergencyStopSeriousFault.type) - ? speedCheckToggleValues.speedNotMet - : speedCheckToggleValues.speedMet; - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.TOGGLE_EMERGENCY_STOP_SPEED_REQ, tests), - `${competencyLabels['speedCheckEmergency']} - ${toggleValue}`, - ); + concatMap(([action,]) => { + // GA4 Analytics const GA4Toggle = (action.type === emergencyStopActions.AddEmergencyStopSeriousFault.type) ? GoogleAnalyticsEventsValues.NOT_MET @@ -2374,12 +2063,7 @@ export class TestReportAnalyticsEffects { [ReturnType, TestsModel, EmergencyStop, boolean], ) => { const attemptValue = emergencyStop.firstAttempt; - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.RECORD_EMERGENCY_STOP_FIRST_ATTEMPT, tests), - `${competencyLabels['speedCheckEmergency']} - ${attemptValue}`, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.EMERGENCY_STOP, tests), @@ -2418,12 +2102,7 @@ export class TestReportAnalyticsEffects { [ReturnType, TestsModel, EmergencyStop, boolean], ) => { const attemptValue = emergencyStop.secondAttempt; - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.RECORD_EMERGENCY_STOP_SECOND_ATTEMPT, tests), - `${competencyLabels['speedCheckEmergency']} - ${attemptValue}`, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.EMERGENCY_STOP, tests), @@ -2455,12 +2134,7 @@ export class TestReportAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.SPEED_REQ_NOT_MET_MODAL_OPENED, tests), - ModalReason.SPEED_REQUIREMENTS, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.VALIDATION_ERROR, tests), @@ -2492,12 +2166,7 @@ export class TestReportAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.EMERGENCY_STOP_DANGEROUS_FAULT_MODAL_OPENED, tests), - ModalReason.EMERGENCY_STOP_DANGEROUS, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.NAVIGATION, tests), @@ -2529,12 +2198,7 @@ export class TestReportAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.EMERGENCY_STOP_SERIOUS_FAULT_MODAL_OPENED, tests), - ModalReason.EMERGENCY_STOP_SERIOUS, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.NAVIGATION, tests), @@ -2566,50 +2230,24 @@ export class TestReportAnalyticsEffects { [action, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - if (action.outcome === CompetencyOutcome.DF) { - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.ADD_SINGLE_FAULT, tests), - fullCompetencyLabels[action.competencyName], - ); - } else if (action.outcome === CompetencyOutcome.D) { - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.ADD_DANGEROUS_SINGLE_FAULT, tests), - fullCompetencyLabels[action.competencyName], - ); - } else if (action.outcome === CompetencyOutcome.S) { - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.ADD_SERIOUS_SINGLE_FAULT, tests), - fullCompetencyLabels[action.competencyName], - ); - } + // GA4 Analytics - if (action.outcome === CompetencyOutcome.DF) { - this.analytics.logGAEvent( - `${analyticsEventTypePrefix( - GoogleAnalyticsEvents.ADD_FAULT, - tests)}_${fullAnalyticCompetencyLabels[action.competencyName]}`, - GoogleAnalyticsEventsTitles.SEVERITY, - ValidFaultTypes.DRIVING, - ); - } else if (action.outcome === CompetencyOutcome.D) { - this.analytics.logGAEvent( - `${analyticsEventTypePrefix( - GoogleAnalyticsEvents.ADD_FAULT, - tests)}_${fullAnalyticCompetencyLabels[action.competencyName]}`, - GoogleAnalyticsEventsTitles.SEVERITY, - ValidFaultTypes.DANGEROUS, - ); - } else if (action.outcome === CompetencyOutcome.S) { + const faultTypeMap = { + [CompetencyOutcome.DF]: ValidFaultTypes.DRIVING, + [CompetencyOutcome.D]: ValidFaultTypes.DANGEROUS, + [CompetencyOutcome.S]: ValidFaultTypes.SERIOUS, + }; + + const faultType = faultTypeMap[action.outcome]; + if (faultType) { + const eventType = analyticsEventTypePrefix(GoogleAnalyticsEvents.ADD_FAULT, tests); + const competencyLabel = fullAnalyticCompetencyLabels[action.competencyName]; + const eventLabel = `${eventType}_${competencyLabel}`; + this.analytics.logGAEvent( - `${analyticsEventTypePrefix( - GoogleAnalyticsEvents.ADD_FAULT, - tests)}_${fullAnalyticCompetencyLabels[action.competencyName]}`, + eventLabel, GoogleAnalyticsEventsTitles.SEVERITY, - ValidFaultTypes.SERIOUS, + faultType, ); } return of(AnalyticRecorded()); @@ -2637,12 +2275,7 @@ export class TestReportAnalyticsEffects { [action, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.REMOVE_SINGLE_FAULT, tests), - fullCompetencyLabels[action.competencyName], - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -2677,12 +2310,7 @@ export class TestReportAnalyticsEffects { // eslint-disable-next-line max-len [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.REMOVE_DANGEROUS_SINGLE_FAULT, tests), - fullCompetencyLabels[action.competencyName], - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -2716,12 +2344,7 @@ export class TestReportAnalyticsEffects { [action, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.REMOVE_SERIOUS_SINGLE_FAULT, tests), - fullCompetencyLabels[action.competencyName], - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -2755,12 +2378,7 @@ export class TestReportAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.PCV_DOOR_EXERCISE_ADD_DRIVING_FAULT, tests), - fullCompetencyLabels.pcvDoorExercise, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -2794,12 +2412,7 @@ export class TestReportAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.PCV_DOOR_EXERCISE_ADD_SERIOUS_FAULT, tests), - fullCompetencyLabels.pcvDoorExercise, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -2833,12 +2446,6 @@ export class TestReportAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.PCV_DOOR_EXERCISE_ADD_DANGEROUS_FAULT, tests), - fullCompetencyLabels.pcvDoorExercise, - ); // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -2872,12 +2479,7 @@ export class TestReportAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.PCV_DOOR_EXERCISE_REMOVE_DRIVING_FAULT, tests), - fullCompetencyLabels.pcvDoorExercise, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -2911,12 +2513,7 @@ export class TestReportAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.PCV_DOOR_EXERCISE_REMOVE_SERIOUS_FAULT, tests), - fullCompetencyLabels.pcvDoorExercise, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -2950,12 +2547,7 @@ export class TestReportAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.PCV_DOOR_EXERCISE_REMOVE_DANGEROUS_FAULT, tests), - fullCompetencyLabels.pcvDoorExercise, - ); + // GA4 Analytics this.analytics.logGAEvent( `${analyticsEventTypePrefix( @@ -2989,11 +2581,7 @@ export class TestReportAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.START_TIMER, tests), - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.START_TIMER, tests), @@ -3030,12 +2618,7 @@ export class TestReportAnalyticsEffects { [, tests, studentLevel]: [ReturnType, TestsModel, StudentLevel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.STUDENT_LEVEL_CHANGED, tests), - `student level changed to ${studentLevel}`, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.STUDENT_EXPERIENCE, tests), @@ -3067,12 +2650,7 @@ export class TestReportAnalyticsEffects { [action, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.LESSON_THEME_ADDED, tests), - lessonThemeValues[action.lessonTheme], - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.LESSON_THEME, tests), @@ -3104,12 +2682,7 @@ export class TestReportAnalyticsEffects { [action, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.LESSON_THEME_REMOVED, tests), - lessonThemeValues[action.lessonTheme], - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.LESSON_THEME, tests), @@ -3148,12 +2721,7 @@ export class TestReportAnalyticsEffects { [, tests]: [ReturnType, TestsModel, string, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.OTHER_REASON_CHANGED, tests), - 'Free text entered', - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.FEEDBACK, tests), @@ -3190,12 +2758,7 @@ export class TestReportAnalyticsEffects { }, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.LESSON_PLANNING_CHANGED, tests), - `lesson planning changed: question ${question}, score ${score}`, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(`${GoogleAnalyticsEvents.LESSON_PLANNING}_Q${question}`, tests), @@ -3230,12 +2793,7 @@ export class TestReportAnalyticsEffects { }, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.RISK_MANAGEMENT_CHANGED, tests), - `risk management changed: question ${question}, score ${score}`, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(`${GoogleAnalyticsEvents.RISK_MANAGEMENT}_Q${question}`, tests), @@ -3270,12 +2828,7 @@ export class TestReportAnalyticsEffects { }, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.TEACHING_LEARNING_STRATEGY_CHANGED, tests), - `teaching learning strategy changed: question ${question}, score ${score}`, - ); + // GA4 analytics this.analytics.logGAEvent( analyticsEventTypePrefix(`${GoogleAnalyticsEvents.LEARNING_STRATEGY}_Q${question}`, tests), @@ -3309,12 +2862,7 @@ export class TestReportAnalyticsEffects { [action, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.ASSESSMENT_OVERALL_SCORE_CHANGED, tests), - `overall assessment score changed: ${action.score}`, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.OVERALL_ASSESSMENT, tests), diff --git a/src/app/pages/test-results-search/__tests__/test-results-search.analytics.effects.spec.ts b/src/app/pages/test-results-search/__tests__/test-results-search.analytics.effects.spec.ts index 4aad5108e..c2c204f88 100644 --- a/src/app/pages/test-results-search/__tests__/test-results-search.analytics.effects.spec.ts +++ b/src/app/pages/test-results-search/__tests__/test-results-search.analytics.effects.spec.ts @@ -5,10 +5,10 @@ import { provideMockActions } from '@ngrx/effects/testing'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { - AnalyticsEventCategories, - AnalyticsEvents, AnalyticsScreenNames, - GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, GoogleAnalyticsEventsValues, + GoogleAnalyticsEvents, + GoogleAnalyticsEventsTitles, + GoogleAnalyticsEventsValues, } from '@providers/analytics/analytics.model'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; import { AdvancedSearchParams } from '@providers/search/search.models'; @@ -36,7 +36,6 @@ describe('TestResultsSearchAnalyticsEffects', () => { actions$ = new ReplaySubject(1); effects = TestBed.inject(TestResultsSearchAnalyticsEffects); analyticsProviderMock = TestBed.inject(AnalyticsProvider); - spyOn(analyticsProviderMock, 'logEvent'); }); describe('TestResultSearchViewDidEnter', () => { @@ -47,8 +46,6 @@ describe('TestResultsSearchAnalyticsEffects', () => { effects.testResultSearchViewDidEnter$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(screenName); expect(analyticsProviderMock.setGACurrentPage) .toHaveBeenCalledWith(screenName); done(); @@ -64,11 +61,6 @@ describe('TestResultsSearchAnalyticsEffects', () => { effects.performApplicationReferenceSearch$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_RESULTS_SEARCH, - AnalyticsEvents.APPLICATION_REFERENCE_SEARCH, - ); expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( GoogleAnalyticsEvents.COMPLETED_TEST_SEARCH, @@ -88,11 +80,6 @@ describe('TestResultsSearchAnalyticsEffects', () => { effects.performDriverNumberSearch$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_RESULTS_SEARCH, - AnalyticsEvents.DRIVER_NUMBER_SEARCH, - ); expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( GoogleAnalyticsEvents.COMPLETED_TEST_SEARCH, @@ -112,12 +99,6 @@ describe('TestResultsSearchAnalyticsEffects', () => { effects.performLDTMSearch$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_RESULTS_SEARCH, - AnalyticsEvents.LDTM_SEARCH, - '', - ); expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( GoogleAnalyticsEvents.LDTM_SEARCH, @@ -135,12 +116,6 @@ describe('TestResultsSearchAnalyticsEffects', () => { effects.performLDTMSearch$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_RESULTS_SEARCH, - AnalyticsEvents.LDTM_SEARCH, - 'test centre', - ); expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( GoogleAnalyticsEvents.LDTM_SEARCH, @@ -166,12 +141,6 @@ describe('TestResultsSearchAnalyticsEffects', () => { effects.performLDTMSearch$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_RESULTS_SEARCH, - AnalyticsEvents.LDTM_SEARCH, - 'date, staff id, test centre, activity code, test category, pass certificate, rekey', - ); expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( GoogleAnalyticsEvents.LDTM_SEARCH, diff --git a/src/app/pages/test-results-search/test-results-search.analytics.effects.ts b/src/app/pages/test-results-search/test-results-search.analytics.effects.ts index 6e363f685..946fef725 100644 --- a/src/app/pages/test-results-search/test-results-search.analytics.effects.ts +++ b/src/app/pages/test-results-search/test-results-search.analytics.effects.ts @@ -5,8 +5,6 @@ import { switchMap } from 'rxjs/operators'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; import { - AnalyticsEventCategories, - AnalyticsEvents, AnalyticsScreenNames, GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, GoogleAnalyticsEventsValues, } from '@providers/analytics/analytics.model'; @@ -29,8 +27,6 @@ export class TestResultsSearchAnalyticsEffects { testResultSearchViewDidEnter$ = createEffect(() => this.actions$.pipe( ofType(TestResultSearchViewDidEnter), switchMap(() => { - // TODO - MES-9495 - remove old analytics - this.analytics.setCurrentPage(AnalyticsScreenNames.TEST_RESULTS_SEARCH); //GA4 Analytics this.analytics.setGACurrentPage(AnalyticsScreenNames.TEST_RESULTS_SEARCH); return of(AnalyticRecorded()); @@ -40,11 +36,7 @@ export class TestResultsSearchAnalyticsEffects { performApplicationReferenceSearch$ = createEffect(() => this.actions$.pipe( ofType(PerformApplicationReferenceSearch), switchMap(() => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.TEST_RESULTS_SEARCH, - AnalyticsEvents.APPLICATION_REFERENCE_SEARCH, - ); + //GA4 Analytics this.analytics.logGAEvent( GoogleAnalyticsEvents.COMPLETED_TEST_SEARCH, @@ -58,11 +50,7 @@ export class TestResultsSearchAnalyticsEffects { performDriverNumberSearch$ = createEffect(() => this.actions$.pipe( ofType(PerformDriverNumberSearch), switchMap(() => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.TEST_RESULTS_SEARCH, - AnalyticsEvents.DRIVER_NUMBER_SEARCH, - ); + //GA4 Analytics this.analytics.logGAEvent( GoogleAnalyticsEvents.COMPLETED_TEST_SEARCH, @@ -76,7 +64,6 @@ export class TestResultsSearchAnalyticsEffects { performLDTMSearch$ = createEffect(() => this.actions$.pipe( ofType(PerformLDTMSearch), switchMap((action: ReturnType) => { - // TODO - MES-9495 - remove old analytics const searchParametersUsed: string[] = []; let label: string = ''; @@ -116,11 +103,6 @@ export class TestResultsSearchAnalyticsEffects { label = `${label}, ${searchParameter}`; }); - this.analytics.logEvent( - AnalyticsEventCategories.TEST_RESULTS_SEARCH, - AnalyticsEvents.LDTM_SEARCH, - label, - ); //GA4 Analytics this.analytics.logGAEvent( GoogleAnalyticsEvents.LDTM_SEARCH, diff --git a/src/app/pages/unuploaded-tests/__tests__/unuploaded-tests.analytics.effects.spec.ts b/src/app/pages/unuploaded-tests/__tests__/unuploaded-tests.analytics.effects.spec.ts index e4ee93dd2..e5f3d9e36 100644 --- a/src/app/pages/unuploaded-tests/__tests__/unuploaded-tests.analytics.effects.spec.ts +++ b/src/app/pages/unuploaded-tests/__tests__/unuploaded-tests.analytics.effects.spec.ts @@ -3,8 +3,6 @@ import { TestBed, waitForAsync } from '@angular/core/testing'; import { provideMockActions } from '@ngrx/effects/testing'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { - AnalyticsEventCategories, - AnalyticsEvents, AnalyticsScreenNames, GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, } from '@providers/analytics/analytics.model'; @@ -32,7 +30,6 @@ describe('UnuploadedTestsAnalyticsEffects', () => { actions$ = new ReplaySubject(1); effects = TestBed.inject(UnuploadedTestsAnalyticsEffects); analyticsProviderMock = TestBed.inject(AnalyticsProvider); - spyOn(analyticsProviderMock, 'logEvent'); })); describe('UnuploadedTestsViewDidEnter', () => { @@ -41,9 +38,6 @@ describe('UnuploadedTestsAnalyticsEffects', () => { effects.unUploadedTestViewDidEnter$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.setCurrentPage).toHaveBeenCalledWith(screenName); - //GA4 Analytics expect(analyticsProviderMock.setGACurrentPage).toHaveBeenCalledWith(screenName); done(); @@ -57,13 +51,6 @@ describe('UnuploadedTestsAnalyticsEffects', () => { effects.continueUnUploadedTest$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.UN_UPLOADED_TESTS, - AnalyticsEvents.TEST_SELECTED, - TestStatus.WriteUp, - ); - //GA4 Analytics expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( GoogleAnalyticsEvents.INCOMPLETE_TESTS, diff --git a/src/app/pages/unuploaded-tests/unuploaded-tests.analytics.effects.ts b/src/app/pages/unuploaded-tests/unuploaded-tests.analytics.effects.ts index 67d3cd51b..55659e98e 100644 --- a/src/app/pages/unuploaded-tests/unuploaded-tests.analytics.effects.ts +++ b/src/app/pages/unuploaded-tests/unuploaded-tests.analytics.effects.ts @@ -4,8 +4,6 @@ import { Actions, createEffect, ofType } from '@ngrx/effects'; import { ContinueUnuploadedTest, UnuploadedTestsViewDidEnter } from '@pages/unuploaded-tests/unuploaded-tests.actions'; import { switchMap } from 'rxjs/operators'; import { - AnalyticsEventCategories, - AnalyticsEvents, AnalyticsScreenNames, GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, } from '@providers/analytics/analytics.model'; @@ -24,9 +22,6 @@ export class UnuploadedTestsAnalyticsEffects { ofType(UnuploadedTestsViewDidEnter), switchMap(() => { - // TODO - MES-9495 - remove old analytics - this.analytics.setCurrentPage(AnalyticsScreenNames.UN_UPLOADED); - //GA4 Analytics this.analytics.setGACurrentPage(AnalyticsScreenNames.UN_UPLOADED); @@ -38,13 +33,6 @@ export class UnuploadedTestsAnalyticsEffects { ofType(ContinueUnuploadedTest), switchMap(({ testStatus }) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.UN_UPLOADED_TESTS, - AnalyticsEvents.TEST_SELECTED, - testStatus, - ); - //GA4 Analytics this.analytics.logGAEvent( GoogleAnalyticsEvents.INCOMPLETE_TESTS, diff --git a/src/app/pages/view-test-result/__tests__/view-test-results.analytics.effects.spec.ts b/src/app/pages/view-test-result/__tests__/view-test-results.analytics.effects.spec.ts index 26f1124f9..fe1a780f4 100644 --- a/src/app/pages/view-test-result/__tests__/view-test-results.analytics.effects.spec.ts +++ b/src/app/pages/view-test-result/__tests__/view-test-results.analytics.effects.spec.ts @@ -5,7 +5,6 @@ import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { AnalyticsScreenNames, - AnalyticsDimensionIndices, GoogleAnalyticsCustomDimension, } from '@providers/analytics/analytics.model'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; @@ -39,12 +38,6 @@ describe('ViewTestResultAnalyticsEffects', () => { // ASSERT effects.viewTestResultViewDidEnter$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.setCurrentPage).toHaveBeenCalledWith(screenName); - expect(analyticsProviderMock.addCustomDimension).toHaveBeenCalledWith( - AnalyticsDimensionIndices.APPLICATION_REFERENCE, - '12345', - ); - expect(analyticsProviderMock.setGACurrentPage).toHaveBeenCalledWith(screenName); expect(analyticsProviderMock.addGACustomDimension).toHaveBeenCalledWith( GoogleAnalyticsCustomDimension.APPLICATION_REFERENCE, diff --git a/src/app/pages/view-test-result/view-test-result.analytics.effects.ts b/src/app/pages/view-test-result/view-test-result.analytics.effects.ts index ee458fa22..57adea267 100644 --- a/src/app/pages/view-test-result/view-test-result.analytics.effects.ts +++ b/src/app/pages/view-test-result/view-test-result.analytics.effects.ts @@ -6,7 +6,6 @@ import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; import { AnalyticsScreenNames, - AnalyticsDimensionIndices, GoogleAnalyticsCustomDimension, } from '@providers/analytics/analytics.model'; import { ViewTestResultViewDidEnter } from './view-test-result.actions'; @@ -23,9 +22,6 @@ export class ViewTestResultAnalyticsEffects { viewTestResultViewDidEnter$ = createEffect(() => this.actions$.pipe( ofType(ViewTestResultViewDidEnter), switchMap((action: ReturnType) => { - // TODO - MES-9495 - remove old analytics - this.analytics.addCustomDimension(AnalyticsDimensionIndices.APPLICATION_REFERENCE, action.applicationReference); - this.analytics.setCurrentPage(AnalyticsScreenNames.VIEW_TEST_RESULT); // GA4 Analytics this.analytics.addGACustomDimension( diff --git a/src/app/pages/waiting-room-to-car/__tests__/waiting-room-to-car.analytics.effects.spec.ts b/src/app/pages/waiting-room-to-car/__tests__/waiting-room-to-car.analytics.effects.spec.ts index 6468b4920..b0cab91c6 100644 --- a/src/app/pages/waiting-room-to-car/__tests__/waiting-room-to-car.analytics.effects.spec.ts +++ b/src/app/pages/waiting-room-to-car/__tests__/waiting-room-to-car.analytics.effects.spec.ts @@ -5,10 +5,6 @@ import { provideMockActions } from '@ngrx/effects/testing'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { - AnalyticsDimensionIndices, - AnalyticsErrorTypes, - AnalyticsEventCategories, - AnalyticsEvents, AnalyticsScreenNames, GoogleAnalyticsCustomDimension, GoogleAnalyticsEventPrefix, GoogleAnalyticsEvents, @@ -47,7 +43,6 @@ describe('WaitingRoomToCarAnalyticsEffects', () => { let actions$: ReplaySubject; let store$: Store; const screenName = AnalyticsScreenNames.WAITING_ROOM_TO_CAR; - const screenNamePracticeMode = `${AnalyticsEventCategories.PRACTICE_MODE} - ${screenName}`; const mockApplication: Application = { applicationId: 123456, bookingSequence: 78, @@ -84,7 +79,6 @@ describe('WaitingRoomToCarAnalyticsEffects', () => { effects = TestBed.inject(WaitingRoomToCarAnalyticsEffects); analyticsProviderMock = TestBed.inject(AnalyticsProvider); store$ = TestBed.inject(Store); - spyOn(analyticsProviderMock, 'logEvent'); }); describe('waitingRoomToCarViewDidEnter', () => { @@ -101,16 +95,6 @@ describe('WaitingRoomToCarAnalyticsEffects', () => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_ID, '1'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.APPLICATION_REFERENCE, '123456789'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.TEST_CATEGORY, 'B'); - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(screenName); - // GA4 Analytics expect(analyticsProviderMock.addGACustomDimension) .toHaveBeenCalledWith(GoogleAnalyticsCustomDimension.CANDIDATE_ID, '1'); @@ -135,15 +119,6 @@ describe('WaitingRoomToCarAnalyticsEffects', () => { effects.waitingRoomToCarViewDidEnter$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_ID, '1'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.APPLICATION_REFERENCE, '123456789'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.TEST_CATEGORY, 'B'); - expect(analyticsProviderMock.setCurrentPage) - .toHaveBeenCalledWith(screenNamePracticeMode); // GA4 Analytics expect(analyticsProviderMock.addGACustomDimension) @@ -170,21 +145,14 @@ describe('WaitingRoomToCarAnalyticsEffects', () => { actions$.next(waitingRoomToCarActions.WaitingRoomToCarError('error 123')); // ASSERT effects.waitingRoomToCarError$.subscribe((result) => { + expect(result.type === AnalyticRecorded.type) + .toBe(true); expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( `${GoogleAnalyticsEvents.SUBMIT_FORM_ERROR}`, GoogleAnalyticsEventsTitles.BLANK_FIELD, 'error 123', ); - expect(result.type === AnalyticRecorded.type) - .toBe(true); - expect(analyticsProviderMock.logError) - .toHaveBeenCalledWith( - `${AnalyticsErrorTypes.SUBMIT_FORM_ERROR} (${screenName})`, - 'error 123', - ); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.TEST_CATEGORY, 'B'); done(); }); }); @@ -197,19 +165,14 @@ describe('WaitingRoomToCarAnalyticsEffects', () => { actions$.next(waitingRoomToCarActions.WaitingRoomToCarError('error 123')); // ASSERT effects.waitingRoomToCarError$.subscribe((result) => { + expect(result.type === AnalyticRecorded.type) + .toBe(true); expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( `PM_${GoogleAnalyticsEvents.SUBMIT_FORM_ERROR}`, GoogleAnalyticsEventsTitles.BLANK_FIELD, 'error 123', ); - expect(result.type === AnalyticRecorded.type) - .toBe(true); - expect(analyticsProviderMock.logError) - .toHaveBeenCalledWith(`${AnalyticsErrorTypes.SUBMIT_FORM_ERROR} (${screenNamePracticeMode})`, - 'error 123'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.TEST_CATEGORY, 'B'); done(); }); }); @@ -234,11 +197,6 @@ describe('WaitingRoomToCarAnalyticsEffects', () => { ); expect(result.type === AnalyticRecorded.type) .toBe(true); - expect(analyticsProviderMock.logError) - .toHaveBeenCalledWith(`${AnalyticsErrorTypes.VALIDATION_ERROR} (${screenName})`, - 'formControl1'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.TEST_CATEGORY, 'B'); done(); }); }); @@ -259,11 +217,6 @@ describe('WaitingRoomToCarAnalyticsEffects', () => { ); expect(result.type === AnalyticRecorded.type) .toBe(true); - expect(analyticsProviderMock.logError) - .toHaveBeenCalledWith(`${AnalyticsErrorTypes.VALIDATION_ERROR} (${screenNamePracticeMode})`, - 'formControl1'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.TEST_CATEGORY, 'B'); done(); }); }); @@ -282,12 +235,6 @@ describe('WaitingRoomToCarAnalyticsEffects', () => { effects.waitingRoomToCarDualControlsChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsEventCategories.WAITING_ROOM_TO_CAR}`, - `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsEvents.DUAL_CONTROLS_CHANGED}`, - 'dual controls changed to Yes', - ); expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( `PM_${GoogleAnalyticsEvents.DUAL_CONTROLS}`, @@ -308,12 +255,6 @@ describe('WaitingRoomToCarAnalyticsEffects', () => { effects.waitingRoomToCarDualControlsChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsEventCategories.WAITING_ROOM_TO_CAR}`, - `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsEvents.DUAL_CONTROLS_CHANGED}`, - 'dual controls changed to No', - ); expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( `PM_${GoogleAnalyticsEvents.DUAL_CONTROLS}`, @@ -337,12 +278,6 @@ describe('WaitingRoomToCarAnalyticsEffects', () => { effects.waitingRoomToCarTransmissionChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsEventCategories.WAITING_ROOM_TO_CAR}`, - `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsEvents.GEARBOX_CATEGORY_CHANGED}`, - 'Automatic', - ); expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( `PM_${GoogleAnalyticsEvents.SET_TRANSMISSION}`, @@ -363,12 +298,6 @@ describe('WaitingRoomToCarAnalyticsEffects', () => { effects.waitingRoomToCarTransmissionChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsEventCategories.WAITING_ROOM_TO_CAR}`, - `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsEvents.GEARBOX_CATEGORY_CHANGED}`, - 'Manual', - ); expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( `PM_${GoogleAnalyticsEvents.SET_TRANSMISSION}`, @@ -392,12 +321,6 @@ describe('WaitingRoomToCarAnalyticsEffects', () => { effects.waitingRoomToCarPDILogbookChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsEventCategories.WAITING_ROOM_TO_CAR}`, - `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsEvents.PDI_LOGBOOK_CHANGED}`, - 'pdi logbook changed to Yes', - ); expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( `PM_${GoogleAnalyticsEvents.PDI_LOGBOOK}`, @@ -418,12 +341,6 @@ describe('WaitingRoomToCarAnalyticsEffects', () => { effects.waitingRoomToCarPDILogbookChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsEventCategories.WAITING_ROOM_TO_CAR}`, - `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsEvents.PDI_LOGBOOK_CHANGED}`, - 'pdi logbook changed to No', - ); expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( `PM_${GoogleAnalyticsEvents.PDI_LOGBOOK}`, @@ -447,12 +364,6 @@ describe('WaitingRoomToCarAnalyticsEffects', () => { effects.waitingRoomToCarTraineeLicenceChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsEventCategories.WAITING_ROOM_TO_CAR}`, - `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsEvents.TRAINEE_LICENCE_CHANGED}`, - 'trainee licence changed to Yes', - ); expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( `PM_${GoogleAnalyticsEvents.TRAINEE_LICENCE}`, @@ -473,12 +384,6 @@ describe('WaitingRoomToCarAnalyticsEffects', () => { effects.waitingRoomToCarTraineeLicenceChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type) .toBe(true); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsEventCategories.WAITING_ROOM_TO_CAR}`, - `${AnalyticsEventCategories.PRACTICE_MODE} - ${AnalyticsEvents.TRAINEE_LICENCE_CHANGED}`, - 'trainee licence changed to No', - ); expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( `PM_${GoogleAnalyticsEvents.TRAINEE_LICENCE}`, diff --git a/src/app/pages/waiting-room-to-car/cat-a-mod2/components/vehicle-checks-modal/__tests__/vehicle-checks-modal.cat-a-mod2.analytics.effects.spec.ts b/src/app/pages/waiting-room-to-car/cat-a-mod2/components/vehicle-checks-modal/__tests__/vehicle-checks-modal.cat-a-mod2.analytics.effects.spec.ts index 068fcbd4f..e1ae749df 100644 --- a/src/app/pages/waiting-room-to-car/cat-a-mod2/components/vehicle-checks-modal/__tests__/vehicle-checks-modal.cat-a-mod2.analytics.effects.spec.ts +++ b/src/app/pages/waiting-room-to-car/cat-a-mod2/components/vehicle-checks-modal/__tests__/vehicle-checks-modal.cat-a-mod2.analytics.effects.spec.ts @@ -10,9 +10,11 @@ import * as testsActions from '@store/tests/tests.actions'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; import { - AnalyticsEventCategories, - AnalyticsScreenNames, GoogleAnalyticsEventPrefix, - GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, GoogleAnalyticsEventsValues, + AnalyticsScreenNames, + GoogleAnalyticsEventPrefix, + GoogleAnalyticsEvents, + GoogleAnalyticsEventsTitles, + GoogleAnalyticsEventsValues, } from '@providers/analytics/analytics.model'; import * as SafetyAndBalanceQuestionsActions from '@store/tests/test-data/cat-a-mod2/safety-and-balance/safety-and-balance.cat-a-mod2.actions'; @@ -51,7 +53,6 @@ describe('VehicleChecksModalCatAMod2AnalyticsEffects', () => { effects = TestBed.inject(VehicleChecksModalCatAMod2AnalyticsEffects); analyticsProviderMock = TestBed.inject(AnalyticsProvider); store$ = TestBed.inject(Store); - spyOn(analyticsProviderMock, 'logEvent'); }); describe('vehicleChecksModalViewDidEnter$ effect', () => { @@ -60,7 +61,6 @@ describe('VehicleChecksModalCatAMod2AnalyticsEffects', () => { actions$.next(VehicleChecksViewDidEnter()); effects.vehicleChecksModalViewDidEnter$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.setCurrentPage).toHaveBeenCalledWith(screenName); expect(analyticsProviderMock.setGACurrentPage).toHaveBeenCalledWith(screenName); done(); }); @@ -77,11 +77,6 @@ describe('VehicleChecksModalCatAMod2AnalyticsEffects', () => { actions$.next(SafetyAndBalanceQuestionsActions.SafetyQuestionSelected(safetyQuestion, questionNumber)); effects.safetyQuestionChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.VEHICLE_CHECKS, - `safety question ${questionNumber + 1} changed`, - safetyQuestion.code, - ); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( (GoogleAnalyticsEvents.SAFETY_QUESTION + '2'), GoogleAnalyticsEventsTitles.QUESTION_NUMBER, @@ -96,11 +91,6 @@ describe('VehicleChecksModalCatAMod2AnalyticsEffects', () => { actions$.next(SafetyAndBalanceQuestionsActions.SafetyQuestionSelected(safetyQuestion, questionNumber)); effects.safetyQuestionChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - `practice mode - ${AnalyticsEventCategories.VEHICLE_CHECKS}`, - `safety question ${questionNumber + 1} changed`, - safetyQuestion.code, - ); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( `${GoogleAnalyticsEventPrefix.PRACTICE_MODE}_${(GoogleAnalyticsEvents.SAFETY_QUESTION + '2')}`, GoogleAnalyticsEventsTitles.QUESTION_NUMBER, @@ -119,11 +109,6 @@ describe('VehicleChecksModalCatAMod2AnalyticsEffects', () => { actions$.next(SafetyAndBalanceQuestionsActions.SafetyQuestionOutcomeChanged(questionOutcome, questionNumber)); effects.safetyQuestionOutcomeChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.VEHICLE_CHECKS, - `safety question ${questionNumber + 1} outcome changed`, - 'correct', - ); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( (GoogleAnalyticsEvents.SAFETY_QUESTION + '2'), GoogleAnalyticsEventsTitles.RESULT, @@ -138,11 +123,6 @@ describe('VehicleChecksModalCatAMod2AnalyticsEffects', () => { actions$.next(SafetyAndBalanceQuestionsActions.SafetyQuestionOutcomeChanged(questionOutcome, questionNumber)); effects.safetyQuestionOutcomeChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - `practice mode - ${AnalyticsEventCategories.VEHICLE_CHECKS}`, - `safety question ${questionNumber + 1} outcome changed`, - 'correct', - ); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( `${GoogleAnalyticsEventPrefix.PRACTICE_MODE}_${(GoogleAnalyticsEvents.SAFETY_QUESTION + '2')}`, GoogleAnalyticsEventsTitles.RESULT, @@ -163,11 +143,6 @@ describe('VehicleChecksModalCatAMod2AnalyticsEffects', () => { actions$.next(SafetyAndBalanceQuestionsActions.BalanceQuestionSelected(balanceQuestion, questionNumber)); effects.balanceQuestionChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.VEHICLE_CHECKS, - `balance question ${questionNumber + 1} changed`, - balanceQuestion.code, - ); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( (GoogleAnalyticsEvents.BALANCE_QUESTION + '2'), GoogleAnalyticsEventsTitles.QUESTION_NUMBER, @@ -182,11 +157,6 @@ describe('VehicleChecksModalCatAMod2AnalyticsEffects', () => { actions$.next(SafetyAndBalanceQuestionsActions.BalanceQuestionSelected(balanceQuestion, questionNumber)); effects.balanceQuestionChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - `practice mode - ${AnalyticsEventCategories.VEHICLE_CHECKS}`, - `balance question ${questionNumber + 1} changed`, - balanceQuestion.code, - ); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( `${GoogleAnalyticsEventPrefix.PRACTICE_MODE}_${(GoogleAnalyticsEvents.BALANCE_QUESTION + '2')}`, GoogleAnalyticsEventsTitles.QUESTION_NUMBER, @@ -205,11 +175,6 @@ describe('VehicleChecksModalCatAMod2AnalyticsEffects', () => { actions$.next(SafetyAndBalanceQuestionsActions.BalanceQuestionOutcomeChanged(questionOutcome, questionNumber)); effects.balanceQuestionOutcomeChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.VEHICLE_CHECKS, - `balance question ${questionNumber + 1} outcome changed`, - 'driving fault', - ); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( (GoogleAnalyticsEvents.BALANCE_QUESTION + '2'), GoogleAnalyticsEventsTitles.RESULT, @@ -224,11 +189,6 @@ describe('VehicleChecksModalCatAMod2AnalyticsEffects', () => { actions$.next(SafetyAndBalanceQuestionsActions.BalanceQuestionOutcomeChanged(questionOutcome, questionNumber)); effects.balanceQuestionOutcomeChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - `practice mode - ${AnalyticsEventCategories.VEHICLE_CHECKS}`, - `balance question ${questionNumber + 1} outcome changed`, - 'driving fault', - ); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( `${GoogleAnalyticsEventPrefix.PRACTICE_MODE}_${(GoogleAnalyticsEvents.BALANCE_QUESTION + '2')}`, GoogleAnalyticsEventsTitles.RESULT, diff --git a/src/app/pages/waiting-room-to-car/cat-a-mod2/components/vehicle-checks-modal/vehicle-checks-modal.cat-a-mod2.analytics.effects.ts b/src/app/pages/waiting-room-to-car/cat-a-mod2/components/vehicle-checks-modal/vehicle-checks-modal.cat-a-mod2.analytics.effects.ts index dfb4c4c2a..a0a47fef7 100644 --- a/src/app/pages/waiting-room-to-car/cat-a-mod2/components/vehicle-checks-modal/vehicle-checks-modal.cat-a-mod2.analytics.effects.ts +++ b/src/app/pages/waiting-room-to-car/cat-a-mod2/components/vehicle-checks-modal/vehicle-checks-modal.cat-a-mod2.analytics.effects.ts @@ -2,8 +2,10 @@ import { of } from 'rxjs'; import { Actions, createEffect, ofType } from '@ngrx/effects'; import { concatMap, switchMap, withLatestFrom } from 'rxjs/operators'; import { - AnalyticsEventCategories, - AnalyticsScreenNames, GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, GoogleAnalyticsEventsValues, + AnalyticsScreenNames, + GoogleAnalyticsEvents, + GoogleAnalyticsEventsTitles, + GoogleAnalyticsEventsValues, } from '@providers/analytics/analytics.model'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; import { AnalyticsProvider } from '@providers/analytics/analytics'; @@ -12,7 +14,7 @@ import { select, Store } from '@ngrx/store'; import { StoreModel } from '@shared/models/store.model'; import { getTests } from '@store/tests/tests.reducer'; import { TestsModel } from '@store/tests/tests.model'; -import { analyticsEventTypePrefix, formatAnalyticsText } from '@shared/helpers/format-analytics-text'; +import { analyticsEventTypePrefix } from '@shared/helpers/format-analytics-text'; import { SafetyQuestionOutcomeChanged, SafetyQuestionSelected, @@ -43,10 +45,6 @@ export class VehicleChecksModalCatAMod2AnalyticsEffects { ), )), switchMap(([, tests]: [ReturnType, TestsModel]) => { - // TODO - MES-9495 - remove old analytics - this.analytics.setCurrentPage( - formatAnalyticsText(AnalyticsScreenNames.VEHICLE_CHECKS, tests), - ); // GA4 Analytics this.analytics.setGACurrentPage( analyticsEventTypePrefix(AnalyticsScreenNames.VEHICLE_CHECKS, tests), @@ -65,13 +63,6 @@ export class VehicleChecksModalCatAMod2AnalyticsEffects { ), )), switchMap(([action, tests]: [ReturnType, TestsModel]) => { - // TODO - MES-9495 - remove old analytics - const eventText = `safety question ${action.index + 1} changed`; - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.VEHICLE_CHECKS, tests), - eventText, - action.safetyQuestion.code, - ); // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.SAFETY_QUESTION + (action.index + 1), tests), @@ -92,14 +83,7 @@ export class VehicleChecksModalCatAMod2AnalyticsEffects { ), )), switchMap(([action, tests]: [ReturnType, TestsModel]) => { - // TODO - MES-9495 - remove old analytics - const eventText = `safety question ${action.index + 1} outcome changed`; - const outComeText = action.safetyQuestionOutcome === 'P' ? 'correct' : 'driving fault'; - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.VEHICLE_CHECKS, tests), - eventText, - outComeText, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.SAFETY_QUESTION + (action.index + 1), tests), @@ -121,13 +105,7 @@ export class VehicleChecksModalCatAMod2AnalyticsEffects { ), )), switchMap(([action, tests]: [ReturnType, TestsModel]) => { - // TODO - MES-9495 - remove old analytics - const eventText = `balance question ${action.index + 1} changed`; - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.VEHICLE_CHECKS, tests), - eventText, - action.balanceQuestion.code, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.BALANCE_QUESTION + (action.index + 1), tests), @@ -148,14 +126,7 @@ export class VehicleChecksModalCatAMod2AnalyticsEffects { ), )), switchMap(([action, tests]: [ReturnType, TestsModel]) => { - // TODO - MES-9495 - remove old analytics - const eventText = `balance question ${action.index + 1} outcome changed`; - const outComeText = action.balanceQuestionOutcome === 'P' ? 'correct' : 'driving fault'; - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.VEHICLE_CHECKS, tests), - eventText, - outComeText, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.BALANCE_QUESTION + (action.index + 1), tests), diff --git a/src/app/pages/waiting-room-to-car/cat-adi-part2/components/vehicle-checks-modal/__tests__/vehicle-checks-modal.cat-adi-part2.analytics.effects.spec.ts b/src/app/pages/waiting-room-to-car/cat-adi-part2/components/vehicle-checks-modal/__tests__/vehicle-checks-modal.cat-adi-part2.analytics.effects.spec.ts index 2c0c4f5e5..19eb3ac3c 100644 --- a/src/app/pages/waiting-room-to-car/cat-adi-part2/components/vehicle-checks-modal/__tests__/vehicle-checks-modal.cat-adi-part2.analytics.effects.spec.ts +++ b/src/app/pages/waiting-room-to-car/cat-adi-part2/components/vehicle-checks-modal/__tests__/vehicle-checks-modal.cat-adi-part2.analytics.effects.spec.ts @@ -10,8 +10,8 @@ import * as testsActions from '@store/tests/tests.actions'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; import { - AnalyticsEventCategories, - AnalyticsScreenNames, GoogleAnalyticsEventPrefix, + AnalyticsScreenNames, + GoogleAnalyticsEventPrefix, GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, GoogleAnalyticsEventsValues, @@ -53,7 +53,6 @@ describe('VehicleChecksModalAnalyticsEffects', () => { effects = TestBed.inject(VehicleChecksModalAnalyticsEffects); analyticsProviderMock = TestBed.inject(AnalyticsProvider); store$ = TestBed.inject(Store); - spyOn(analyticsProviderMock, 'logEvent'); }); describe('vehicleChecksModalViewDidEnter$ effect', () => { @@ -62,7 +61,6 @@ describe('VehicleChecksModalAnalyticsEffects', () => { actions$.next(VehicleChecksViewDidEnter()); effects.vehicleChecksModalViewDidEnter$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.setCurrentPage).toHaveBeenCalledWith(screenName); expect(analyticsProviderMock.setGACurrentPage).toHaveBeenCalledWith(screenName); done(); }); @@ -79,11 +77,6 @@ describe('VehicleChecksModalAnalyticsEffects', () => { actions$.next(VehicleChecksActions.TellMeQuestionSelected(tellMeQuestion, questionNumber)); effects.tellMeQuestionChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.VEHICLE_CHECKS, - `tell me question ${questionNumber + 1} changed`, - tellMeQuestion.code, - ); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( (GoogleAnalyticsEvents.TELL_ME_QUESTION + '1'), GoogleAnalyticsEventsTitles.QUESTION_NUMBER, @@ -98,11 +91,6 @@ describe('VehicleChecksModalAnalyticsEffects', () => { actions$.next(VehicleChecksActions.TellMeQuestionSelected(tellMeQuestion, questionNumber)); effects.tellMeQuestionChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - `practice mode - ${AnalyticsEventCategories.VEHICLE_CHECKS}`, - `tell me question ${questionNumber + 1} changed`, - tellMeQuestion.code, - ); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( `${GoogleAnalyticsEventPrefix.PRACTICE_MODE}_${(GoogleAnalyticsEvents.TELL_ME_QUESTION + '1')}`, GoogleAnalyticsEventsTitles.QUESTION_NUMBER, @@ -121,11 +109,6 @@ describe('VehicleChecksModalAnalyticsEffects', () => { actions$.next(VehicleChecksActions.TellMeQuestionOutcomeChanged(questionOutcome, questionNumber)); effects.tellMeQuestionOutComeChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.VEHICLE_CHECKS, - `tell me question ${questionNumber + 1} outcome changed`, - 'driving fault', - ); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( (GoogleAnalyticsEvents.TELL_ME_QUESTION + '1'), GoogleAnalyticsEventsTitles.RESULT, @@ -140,11 +123,6 @@ describe('VehicleChecksModalAnalyticsEffects', () => { actions$.next(VehicleChecksActions.TellMeQuestionOutcomeChanged(questionOutcome, questionNumber)); effects.tellMeQuestionOutComeChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - `practice mode - ${AnalyticsEventCategories.VEHICLE_CHECKS}`, - `tell me question ${questionNumber + 1} outcome changed`, - 'driving fault', - ); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( `${GoogleAnalyticsEventPrefix.PRACTICE_MODE}_${(GoogleAnalyticsEvents.TELL_ME_QUESTION + '1')}`, GoogleAnalyticsEventsTitles.RESULT, diff --git a/src/app/pages/waiting-room-to-car/cat-adi-part2/components/vehicle-checks-modal/vehicle-checks-modal.cat-adi-part2.analytics.effects.ts b/src/app/pages/waiting-room-to-car/cat-adi-part2/components/vehicle-checks-modal/vehicle-checks-modal.cat-adi-part2.analytics.effects.ts index 6bcc70888..562a7371e 100644 --- a/src/app/pages/waiting-room-to-car/cat-adi-part2/components/vehicle-checks-modal/vehicle-checks-modal.cat-adi-part2.analytics.effects.ts +++ b/src/app/pages/waiting-room-to-car/cat-adi-part2/components/vehicle-checks-modal/vehicle-checks-modal.cat-adi-part2.analytics.effects.ts @@ -2,7 +2,6 @@ import { of } from 'rxjs'; import { Actions, createEffect, ofType } from '@ngrx/effects'; import { concatMap, switchMap, withLatestFrom } from 'rxjs/operators'; import { - AnalyticsEventCategories, AnalyticsScreenNames, GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, @@ -15,7 +14,7 @@ import { select, Store } from '@ngrx/store'; import { StoreModel } from '@shared/models/store.model'; import { getTests } from '@store/tests/tests.reducer'; import { TestsModel } from '@store/tests/tests.model'; -import { analyticsEventTypePrefix, formatAnalyticsText } from '@shared/helpers/format-analytics-text'; +import { analyticsEventTypePrefix } from '@shared/helpers/format-analytics-text'; import { TellMeQuestionOutcomeChanged, TellMeQuestionSelected, @@ -44,10 +43,6 @@ export class VehicleChecksModalAnalyticsEffects { ), )), switchMap(([, tests]: [ReturnType, TestsModel]) => { - // TODO - MES-9495 - remove old analytics - this.analytics.setCurrentPage( - formatAnalyticsText(AnalyticsScreenNames.VEHICLE_CHECKS, tests), - ); // GA4 Analytics this.analytics.setGACurrentPage( analyticsEventTypePrefix(AnalyticsScreenNames.VEHICLE_CHECKS, tests), @@ -66,13 +61,6 @@ export class VehicleChecksModalAnalyticsEffects { ), )), switchMap(([action, tests]: [ReturnType, TestsModel]) => { - // TODO - MES-9495 - remove old analytics - const eventText = `tell me question ${action.index + 1} changed`; - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.VEHICLE_CHECKS, tests), - eventText, - action.tellMeQuestion.code, - ); // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.TELL_ME_QUESTION + (action.index + 1), tests), @@ -93,14 +81,6 @@ export class VehicleChecksModalAnalyticsEffects { ), )), switchMap(([action, tests]: [ReturnType, TestsModel]) => { - // TODO - MES-9495 - remove old analytics - const eventText = `tell me question ${action.index + 1} outcome changed`; - const outComeText = action.tellMeQuestionOutcome === 'P' ? 'correct' : 'driving fault'; - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.VEHICLE_CHECKS, tests), - eventText, - outComeText, - ); // GA4 Analytics this.analytics.logGAEvent( diff --git a/src/app/pages/waiting-room-to-car/cat-c/components/vehicle-checks-modal/vehicle-checks-modal.cat-c.analytics.effects.ts b/src/app/pages/waiting-room-to-car/cat-c/components/vehicle-checks-modal/vehicle-checks-modal.cat-c.analytics.effects.ts index d860f4f57..f7aff884a 100644 --- a/src/app/pages/waiting-room-to-car/cat-c/components/vehicle-checks-modal/vehicle-checks-modal.cat-c.analytics.effects.ts +++ b/src/app/pages/waiting-room-to-car/cat-c/components/vehicle-checks-modal/vehicle-checks-modal.cat-c.analytics.effects.ts @@ -6,15 +6,17 @@ import { concatMap, switchMap, withLatestFrom } from 'rxjs/operators'; import { Injectable } from '@angular/core'; import { select, Store } from '@ngrx/store'; import { - AnalyticsEventCategories, - AnalyticsScreenNames, GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, GoogleAnalyticsEventsValues, + AnalyticsScreenNames, + GoogleAnalyticsEvents, + GoogleAnalyticsEventsTitles, + GoogleAnalyticsEventsValues, } from '@providers/analytics/analytics.model'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { StoreModel } from '@shared/models/store.model'; import { getTests } from '@store/tests/tests.reducer'; import { TestsModel } from '@store/tests/tests.model'; -import { analyticsEventTypePrefix, formatAnalyticsText } from '@shared/helpers/format-analytics-text'; +import { analyticsEventTypePrefix } from '@shared/helpers/format-analytics-text'; import { ShowMeQuestionOutcomeChanged, ShowMeQuestionSelected, @@ -45,8 +47,7 @@ export class VehicleChecksModalCatCAnalyticsEffects { ), )), switchMap(([, tests]: [ReturnType, TestsModel]) => { - // TODO - MES-9495 - remove old analytics - this.analytics.setCurrentPage(formatAnalyticsText(AnalyticsScreenNames.VEHICLE_CHECKS, tests)); + // GA4 Analytics this.analytics.setGACurrentPage(analyticsEventTypePrefix(AnalyticsScreenNames.VEHICLE_CHECKS, tests)); return of(AnalyticRecorded()); @@ -63,13 +64,6 @@ export class VehicleChecksModalCatCAnalyticsEffects { ), )), switchMap(([action, tests]: [ReturnType, TestsModel]) => { - // TODO - MES-9495 - remove old analytics - const eventText = `show me question ${action.index + 1} changed`; - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.VEHICLE_CHECKS, tests), - eventText, - action.showMeQuestion.code, - ); // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.SHOW_ME_QUESTION + (action.index + 1), tests), @@ -90,14 +84,6 @@ export class VehicleChecksModalCatCAnalyticsEffects { ), )), switchMap(([action, tests]: [ReturnType, TestsModel]) => { - // TODO - MES-9495 - remove old analytics - const eventText = `show me question ${action.index + 1} outcome changed`; - const outComeText = action.showMeQuestionOutcome === 'P' ? 'correct' : 'driving fault'; - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.VEHICLE_CHECKS, tests), - eventText, - outComeText, - ); // GA4 Analytics this.analytics.logGAEvent( @@ -120,13 +106,7 @@ export class VehicleChecksModalCatCAnalyticsEffects { ), )), switchMap(([action, tests]: [ReturnType, TestsModel]) => { - // TODO - MES-9495 - remove old analytics - const eventText = `tell me question ${action.index + 1} changed`; - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.VEHICLE_CHECKS, tests), - eventText, - action.tellMeQuestion.code, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.TELL_ME_QUESTION + (action.index + 1), tests), @@ -147,14 +127,7 @@ export class VehicleChecksModalCatCAnalyticsEffects { ), )), switchMap(([action, tests]: [ReturnType, TestsModel]) => { - // TODO - MES-9495 - remove old analytics - const eventText = `tell me question ${action.index + 1} outcome changed`; - const outComeText = action.tellMeQuestionOutcome === 'P' ? 'correct' : 'driving fault'; - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.VEHICLE_CHECKS, tests), - eventText, - outComeText, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.TELL_ME_QUESTION + (action.index + 1), tests), diff --git a/src/app/pages/waiting-room-to-car/cat-d/components/vehicle-checks-modal/__tests__/vehicle-checks-modal.cat-d.analytics.effects.spec.ts b/src/app/pages/waiting-room-to-car/cat-d/components/vehicle-checks-modal/__tests__/vehicle-checks-modal.cat-d.analytics.effects.spec.ts index d37397750..b07612b1d 100644 --- a/src/app/pages/waiting-room-to-car/cat-d/components/vehicle-checks-modal/__tests__/vehicle-checks-modal.cat-d.analytics.effects.spec.ts +++ b/src/app/pages/waiting-room-to-car/cat-d/components/vehicle-checks-modal/__tests__/vehicle-checks-modal.cat-d.analytics.effects.spec.ts @@ -10,9 +10,11 @@ import * as testsActions from '@store/tests/tests.actions'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; import { - AnalyticsEventCategories, - AnalyticsScreenNames, GoogleAnalyticsEventPrefix, - GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, GoogleAnalyticsEventsValues, + AnalyticsScreenNames, + GoogleAnalyticsEventPrefix, + GoogleAnalyticsEvents, + GoogleAnalyticsEventsTitles, + GoogleAnalyticsEventsValues, } from '@providers/analytics/analytics.model'; import * as VehicleChecksActions from '@store/tests/test-data/cat-d/vehicle-checks/vehicle-checks.cat-d.action'; @@ -54,7 +56,6 @@ describe('VehicleChecksModalCatDAnalyticsEffects', () => { effects = TestBed.inject(VehicleChecksModalCatDAnalyticsEffects); analyticsProviderMock = TestBed.inject(AnalyticsProvider); store$ = TestBed.inject(Store); - spyOn(analyticsProviderMock, 'logEvent'); }); describe('vehicleChecksModalViewDidEnter$ effect', () => { @@ -63,7 +64,6 @@ describe('VehicleChecksModalCatDAnalyticsEffects', () => { actions$.next(VehicleChecksViewDidEnter()); effects.vehicleChecksModalViewDidEnter$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.setCurrentPage).toHaveBeenCalledWith(screenName); expect(analyticsProviderMock.setGACurrentPage).toHaveBeenCalledWith(screenName); done(); }); @@ -80,11 +80,6 @@ describe('VehicleChecksModalCatDAnalyticsEffects', () => { actions$.next(VehicleChecksActions.ShowMeQuestionSelected(showMeQuestion, questionNumber)); effects.showMeQuestionChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.VEHICLE_CHECKS, - `show me question ${questionNumber + 1} changed`, - showMeQuestion.code, - ); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( (GoogleAnalyticsEvents.SHOW_ME_QUESTION + '2'), GoogleAnalyticsEventsTitles.QUESTION_NUMBER, @@ -99,11 +94,6 @@ describe('VehicleChecksModalCatDAnalyticsEffects', () => { actions$.next(VehicleChecksActions.ShowMeQuestionSelected(showMeQuestion, questionNumber)); effects.showMeQuestionChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - `practice mode - ${AnalyticsEventCategories.VEHICLE_CHECKS}`, - `show me question ${questionNumber + 1} changed`, - showMeQuestion.code, - ); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( `${GoogleAnalyticsEventPrefix.PRACTICE_MODE}_${(GoogleAnalyticsEvents.SHOW_ME_QUESTION + '2')}`, GoogleAnalyticsEventsTitles.QUESTION_NUMBER, @@ -122,11 +112,6 @@ describe('VehicleChecksModalCatDAnalyticsEffects', () => { actions$.next(VehicleChecksActions.ShowMeQuestionOutcomeChanged(questionOutcome, questionNumber)); effects.showMeQuestionOutComeChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.VEHICLE_CHECKS, - `show me question ${questionNumber + 1} outcome changed`, - 'correct', - ); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( (GoogleAnalyticsEvents.SHOW_ME_QUESTION + '2'), GoogleAnalyticsEventsTitles.RESULT, @@ -141,11 +126,6 @@ describe('VehicleChecksModalCatDAnalyticsEffects', () => { actions$.next(VehicleChecksActions.ShowMeQuestionOutcomeChanged(questionOutcome, questionNumber)); effects.showMeQuestionOutComeChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - `practice mode - ${AnalyticsEventCategories.VEHICLE_CHECKS}`, - `show me question ${questionNumber + 1} outcome changed`, - 'correct', - ); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( `${GoogleAnalyticsEventPrefix.PRACTICE_MODE}_${(GoogleAnalyticsEvents.SHOW_ME_QUESTION + '2')}`, GoogleAnalyticsEventsTitles.RESULT, @@ -166,11 +146,6 @@ describe('VehicleChecksModalCatDAnalyticsEffects', () => { actions$.next(VehicleChecksActions.TellMeQuestionSelected(tellMeQuestion, questionNumber)); effects.tellMeQuestionChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.VEHICLE_CHECKS, - `tell me question ${questionNumber + 1} changed`, - tellMeQuestion.code, - ); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( (GoogleAnalyticsEvents.TELL_ME_QUESTION + '2'), GoogleAnalyticsEventsTitles.QUESTION_NUMBER, @@ -185,11 +160,6 @@ describe('VehicleChecksModalCatDAnalyticsEffects', () => { actions$.next(VehicleChecksActions.TellMeQuestionSelected(tellMeQuestion, questionNumber)); effects.tellMeQuestionChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - `practice mode - ${AnalyticsEventCategories.VEHICLE_CHECKS}`, - `tell me question ${questionNumber + 1} changed`, - tellMeQuestion.code, - ); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( `${GoogleAnalyticsEventPrefix.PRACTICE_MODE}_${(GoogleAnalyticsEvents.TELL_ME_QUESTION + '2')}`, GoogleAnalyticsEventsTitles.QUESTION_NUMBER, @@ -208,11 +178,6 @@ describe('VehicleChecksModalCatDAnalyticsEffects', () => { actions$.next(VehicleChecksActions.TellMeQuestionOutcomeChanged(questionOutcome, questionNumber)); effects.tellMeQuestionOutComeChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.VEHICLE_CHECKS, - `tell me question ${questionNumber + 1} outcome changed`, - 'driving fault', - ); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( (GoogleAnalyticsEvents.TELL_ME_QUESTION + '2'), GoogleAnalyticsEventsTitles.RESULT, @@ -227,11 +192,6 @@ describe('VehicleChecksModalCatDAnalyticsEffects', () => { actions$.next(VehicleChecksActions.TellMeQuestionOutcomeChanged(questionOutcome, questionNumber)); effects.tellMeQuestionOutComeChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - `practice mode - ${AnalyticsEventCategories.VEHICLE_CHECKS}`, - `tell me question ${questionNumber + 1} outcome changed`, - 'driving fault', - ); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( `${GoogleAnalyticsEventPrefix.PRACTICE_MODE}_${(GoogleAnalyticsEvents.TELL_ME_QUESTION + '2')}`, GoogleAnalyticsEventsTitles.RESULT, @@ -250,11 +210,6 @@ describe('VehicleChecksModalCatDAnalyticsEffects', () => { actions$.next(SafetyQuestionsActions.SafetyQuestionOutcomeChanged(questionOutcome, questionNumber)); effects.safetyQuestionOutcomeChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.VEHICLE_CHECKS, - `safety question ${questionNumber + 1} outcome changed`, - 'correct', - ); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( (GoogleAnalyticsEvents.SAFETY_QUESTION + '2'), GoogleAnalyticsEventsTitles.RESULT, @@ -269,11 +224,6 @@ describe('VehicleChecksModalCatDAnalyticsEffects', () => { actions$.next(SafetyQuestionsActions.SafetyQuestionOutcomeChanged(questionOutcome, questionNumber)); effects.safetyQuestionOutcomeChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - `practice mode - ${AnalyticsEventCategories.VEHICLE_CHECKS}`, - `safety question ${questionNumber + 1} outcome changed`, - 'correct', - ); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( `${GoogleAnalyticsEventPrefix.PRACTICE_MODE}_${(GoogleAnalyticsEvents.SAFETY_QUESTION + '2')}`, GoogleAnalyticsEventsTitles.RESULT, diff --git a/src/app/pages/waiting-room-to-car/cat-d/components/vehicle-checks-modal/vehicle-checks-modal.cat-d.analytics.effects.ts b/src/app/pages/waiting-room-to-car/cat-d/components/vehicle-checks-modal/vehicle-checks-modal.cat-d.analytics.effects.ts index c1fcd940a..d0323dc18 100644 --- a/src/app/pages/waiting-room-to-car/cat-d/components/vehicle-checks-modal/vehicle-checks-modal.cat-d.analytics.effects.ts +++ b/src/app/pages/waiting-room-to-car/cat-d/components/vehicle-checks-modal/vehicle-checks-modal.cat-d.analytics.effects.ts @@ -5,15 +5,17 @@ import { Actions, createEffect, ofType } from '@ngrx/effects'; import { concatMap, switchMap, withLatestFrom } from 'rxjs/operators'; import { - AnalyticsEventCategories, - AnalyticsScreenNames, GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, GoogleAnalyticsEventsValues, + AnalyticsScreenNames, + GoogleAnalyticsEvents, + GoogleAnalyticsEventsTitles, + GoogleAnalyticsEventsValues, } from '@providers/analytics/analytics.model'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { StoreModel } from '@shared/models/store.model'; import { getTests } from '@store/tests/tests.reducer'; import { TestsModel } from '@store/tests/tests.model'; -import { analyticsEventTypePrefix, formatAnalyticsText } from '@shared/helpers/format-analytics-text'; +import { analyticsEventTypePrefix } from '@shared/helpers/format-analytics-text'; import { ShowMeQuestionOutcomeChanged, ShowMeQuestionSelected, @@ -47,10 +49,7 @@ export class VehicleChecksModalCatDAnalyticsEffects { ), )), switchMap(([, tests]: [ReturnType, TestsModel]) => { - // TODO - MES-9495 - remove old analytics - this.analytics.setCurrentPage( - formatAnalyticsText(AnalyticsScreenNames.VEHICLE_CHECKS, tests), - ); + // GA4 Analytics this.analytics.setGACurrentPage( analyticsEventTypePrefix(AnalyticsScreenNames.VEHICLE_CHECKS, tests), @@ -69,13 +68,7 @@ export class VehicleChecksModalCatDAnalyticsEffects { ), )), switchMap(([action, tests]: [ReturnType, TestsModel]) => { - // TODO - MES-9495 - remove old analytics - const eventText = `show me question ${action.index + 1} changed`; - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.VEHICLE_CHECKS, tests), - eventText, - action.showMeQuestion.code, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.SHOW_ME_QUESTION + (action.index + 1), tests), @@ -96,14 +89,7 @@ export class VehicleChecksModalCatDAnalyticsEffects { ), )), switchMap(([action, tests]: [ReturnType, TestsModel]) => { - // TODO - MES-9495 - remove old analytics - const eventText = `show me question ${action.index + 1} outcome changed`; - const outComeText = action.showMeQuestionOutcome === 'P' ? 'correct' : 'driving fault'; - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.VEHICLE_CHECKS, tests), - eventText, - outComeText, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.SHOW_ME_QUESTION + (action.index + 1), tests), @@ -125,13 +111,7 @@ export class VehicleChecksModalCatDAnalyticsEffects { ), )), switchMap(([action, tests]: [ReturnType, TestsModel]) => { - // TODO - MES-9495 - remove old analytics - const eventText = `tell me question ${action.index + 1} changed`; - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.VEHICLE_CHECKS, tests), - eventText, - action.tellMeQuestion.code, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.TELL_ME_QUESTION + (action.index + 1), tests), @@ -152,14 +132,7 @@ export class VehicleChecksModalCatDAnalyticsEffects { ), )), switchMap(([action, tests]: [ReturnType, TestsModel]) => { - // TODO - MES-9495 - remove old analytics - const eventText = `tell me question ${action.index + 1} outcome changed`; - const outComeText = action.tellMeQuestionOutcome === 'P' ? 'correct' : 'driving fault'; - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.VEHICLE_CHECKS, tests), - eventText, - outComeText, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.TELL_ME_QUESTION + (action.index + 1), tests), @@ -181,14 +154,7 @@ export class VehicleChecksModalCatDAnalyticsEffects { ), )), switchMap(([action, tests]: [ReturnType, TestsModel]) => { - // TODO - MES-9495 - remove old analytics - const eventText = `safety question ${action.index + 1} outcome changed`; - const outComeText = action.safetyQuestionOutcome === 'P' ? 'correct' : 'driving fault'; - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.VEHICLE_CHECKS, tests), - eventText, - outComeText, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.SAFETY_QUESTION + (action.index + 1), tests), diff --git a/src/app/pages/waiting-room-to-car/cat-home-test/components/vehicle-checks-modal/__tests__/vehicle-checks-modal.cat-home.analytics.effects.spec.ts b/src/app/pages/waiting-room-to-car/cat-home-test/components/vehicle-checks-modal/__tests__/vehicle-checks-modal.cat-home.analytics.effects.spec.ts index 839eed2c9..8e51f918b 100644 --- a/src/app/pages/waiting-room-to-car/cat-home-test/components/vehicle-checks-modal/__tests__/vehicle-checks-modal.cat-home.analytics.effects.spec.ts +++ b/src/app/pages/waiting-room-to-car/cat-home-test/components/vehicle-checks-modal/__tests__/vehicle-checks-modal.cat-home.analytics.effects.spec.ts @@ -10,7 +10,6 @@ import * as testsActions from '@store/tests/tests.actions'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; import { - AnalyticsEventCategories, AnalyticsScreenNames, GoogleAnalyticsEventPrefix, GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, GoogleAnalyticsEventsValues, @@ -56,7 +55,6 @@ describe('VehicleChecksModalCatHomeTestAnalyticsEffects', () => { effects = TestBed.inject(VehicleChecksModalCatHomeTestAnalyticsEffects); analyticsProviderMock = TestBed.inject(AnalyticsProvider); store$ = TestBed.inject(Store); - spyOn(analyticsProviderMock, 'logEvent'); }); describe('vehicleChecksModalViewDidEnter$ effect', () => { @@ -65,7 +63,6 @@ describe('VehicleChecksModalCatHomeTestAnalyticsEffects', () => { actions$.next(VehicleChecksViewDidEnter()); effects.vehicleChecksModalViewDidEnter$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.setCurrentPage).toHaveBeenCalledWith(screenName); expect(analyticsProviderMock.setGACurrentPage).toHaveBeenCalledWith(screenName); done(); }); @@ -82,11 +79,6 @@ describe('VehicleChecksModalCatHomeTestAnalyticsEffects', () => { actions$.next(VehicleChecksActions.ShowMeQuestionSelected(showMeQuestion, questionNumber)); effects.showMeQuestionChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.VEHICLE_CHECKS, - `show me question ${questionNumber + 1} changed`, - showMeQuestion.code, - ); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( (GoogleAnalyticsEvents.SHOW_ME_QUESTION + '2'), GoogleAnalyticsEventsTitles.QUESTION_NUMBER, @@ -101,11 +93,6 @@ describe('VehicleChecksModalCatHomeTestAnalyticsEffects', () => { actions$.next(VehicleChecksActions.ShowMeQuestionSelected(showMeQuestion, questionNumber)); effects.showMeQuestionChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - `practice mode - ${AnalyticsEventCategories.VEHICLE_CHECKS}`, - `show me question ${questionNumber + 1} changed`, - showMeQuestion.code, - ); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( `${GoogleAnalyticsEventPrefix.PRACTICE_MODE}_${(GoogleAnalyticsEvents.SHOW_ME_QUESTION + '2')}`, GoogleAnalyticsEventsTitles.QUESTION_NUMBER, @@ -124,11 +111,6 @@ describe('VehicleChecksModalCatHomeTestAnalyticsEffects', () => { actions$.next(VehicleChecksActions.ShowMeQuestionOutcomeChanged(questionOutcome, questionNumber)); effects.showMeQuestionOutComeChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.VEHICLE_CHECKS, - `show me question ${questionNumber + 1} outcome changed`, - 'correct', - ); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( (GoogleAnalyticsEvents.SHOW_ME_QUESTION + '2'), GoogleAnalyticsEventsTitles.RESULT, @@ -143,11 +125,6 @@ describe('VehicleChecksModalCatHomeTestAnalyticsEffects', () => { actions$.next(VehicleChecksActions.ShowMeQuestionOutcomeChanged(questionOutcome, questionNumber)); effects.showMeQuestionOutComeChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - `practice mode - ${AnalyticsEventCategories.VEHICLE_CHECKS}`, - `show me question ${questionNumber + 1} outcome changed`, - 'correct', - ); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( `${GoogleAnalyticsEventPrefix.PRACTICE_MODE}_${(GoogleAnalyticsEvents.SHOW_ME_QUESTION + '2')}`, GoogleAnalyticsEventsTitles.RESULT, @@ -168,11 +145,6 @@ describe('VehicleChecksModalCatHomeTestAnalyticsEffects', () => { actions$.next(VehicleChecksActions.TellMeQuestionSelected(tellMeQuestion, questionNumber)); effects.tellMeQuestionChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.VEHICLE_CHECKS, - `tell me question ${questionNumber + 1} changed`, - tellMeQuestion.code, - ); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( (GoogleAnalyticsEvents.TELL_ME_QUESTION + '2'), GoogleAnalyticsEventsTitles.QUESTION_NUMBER, @@ -187,11 +159,6 @@ describe('VehicleChecksModalCatHomeTestAnalyticsEffects', () => { actions$.next(VehicleChecksActions.TellMeQuestionSelected(tellMeQuestion, questionNumber)); effects.tellMeQuestionChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - `practice mode - ${AnalyticsEventCategories.VEHICLE_CHECKS}`, - `tell me question ${questionNumber + 1} changed`, - tellMeQuestion.code, - ); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( `${GoogleAnalyticsEventPrefix.PRACTICE_MODE}_${(GoogleAnalyticsEvents.TELL_ME_QUESTION + '2')}`, GoogleAnalyticsEventsTitles.QUESTION_NUMBER, @@ -210,11 +177,6 @@ describe('VehicleChecksModalCatHomeTestAnalyticsEffects', () => { actions$.next(VehicleChecksActions.TellMeQuestionOutcomeChanged(questionOutcome, questionNumber)); effects.tellMeQuestionOutComeChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - AnalyticsEventCategories.VEHICLE_CHECKS, - `tell me question ${questionNumber + 1} outcome changed`, - 'driving fault', - ); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( (GoogleAnalyticsEvents.TELL_ME_QUESTION + '2'), GoogleAnalyticsEventsTitles.RESULT, @@ -229,11 +191,6 @@ describe('VehicleChecksModalCatHomeTestAnalyticsEffects', () => { actions$.next(VehicleChecksActions.TellMeQuestionOutcomeChanged(questionOutcome, questionNumber)); effects.tellMeQuestionOutComeChanged$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBe(true); - expect(analyticsProviderMock.logEvent).toHaveBeenCalledWith( - `practice mode - ${AnalyticsEventCategories.VEHICLE_CHECKS}`, - `tell me question ${questionNumber + 1} outcome changed`, - 'driving fault', - ); expect(analyticsProviderMock.logGAEvent).toHaveBeenCalledWith( `${GoogleAnalyticsEventPrefix.PRACTICE_MODE}_${(GoogleAnalyticsEvents.TELL_ME_QUESTION + '2')}`, GoogleAnalyticsEventsTitles.RESULT, diff --git a/src/app/pages/waiting-room-to-car/cat-home-test/components/vehicle-checks-modal/vehicle-checks-modal.cat-home-test.analytics.effects.ts b/src/app/pages/waiting-room-to-car/cat-home-test/components/vehicle-checks-modal/vehicle-checks-modal.cat-home-test.analytics.effects.ts index 3e6bf812f..c831ad795 100644 --- a/src/app/pages/waiting-room-to-car/cat-home-test/components/vehicle-checks-modal/vehicle-checks-modal.cat-home-test.analytics.effects.ts +++ b/src/app/pages/waiting-room-to-car/cat-home-test/components/vehicle-checks-modal/vehicle-checks-modal.cat-home-test.analytics.effects.ts @@ -6,15 +6,17 @@ import { concatMap, switchMap, withLatestFrom } from 'rxjs/operators'; import { Injectable } from '@angular/core'; import { select, Store } from '@ngrx/store'; import { - AnalyticsEventCategories, - AnalyticsScreenNames, GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, GoogleAnalyticsEventsValues, + AnalyticsScreenNames, + GoogleAnalyticsEvents, + GoogleAnalyticsEventsTitles, + GoogleAnalyticsEventsValues, } from '@providers/analytics/analytics.model'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { StoreModel } from '@shared/models/store.model'; import { getTests } from '@store/tests/tests.reducer'; import { TestsModel } from '@store/tests/tests.model'; -import { analyticsEventTypePrefix, formatAnalyticsText } from '@shared/helpers/format-analytics-text'; +import { analyticsEventTypePrefix } from '@shared/helpers/format-analytics-text'; import { ShowMeQuestionOutcomeChanged, ShowMeQuestionSelected, @@ -45,8 +47,6 @@ export class VehicleChecksModalCatHomeTestAnalyticsEffects { ), )), switchMap(([, tests]: [ReturnType, TestsModel]) => { - // TODO - MES-9495 - remove old analytics - this.analytics.setCurrentPage(formatAnalyticsText(AnalyticsScreenNames.VEHICLE_CHECKS, tests)); // GA4 Analytics this.analytics.setGACurrentPage(analyticsEventTypePrefix(AnalyticsScreenNames.VEHICLE_CHECKS, tests)); return of(AnalyticRecorded()); @@ -63,14 +63,6 @@ export class VehicleChecksModalCatHomeTestAnalyticsEffects { ), )), switchMap(([action, tests]: [ReturnType, TestsModel]) => { - // TODO - MES-9495 - remove old analytics - - const eventText = `show me question ${action.index + 1} changed`; - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.VEHICLE_CHECKS, tests), - eventText, - action.showMeQuestion.code, - ); // GA4 Analytics this.analytics.logGAEvent( @@ -92,14 +84,7 @@ export class VehicleChecksModalCatHomeTestAnalyticsEffects { ), )), switchMap(([action, tests]: [ReturnType, TestsModel]) => { - // TODO - MES-9495 - remove old analytics - const eventText = `show me question ${action.index + 1} outcome changed`; - const outComeText = action.showMeQuestionOutcome === 'P' ? 'correct' : 'driving fault'; - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.VEHICLE_CHECKS, tests), - eventText, - outComeText, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.SHOW_ME_QUESTION + (action.index + 1), tests), @@ -121,13 +106,7 @@ export class VehicleChecksModalCatHomeTestAnalyticsEffects { ), )), switchMap(([action, tests]: [ReturnType, TestsModel]) => { - // TODO - MES-9495 - remove old analytics - const eventText = `tell me question ${action.index + 1} changed`; - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.VEHICLE_CHECKS, tests), - eventText, - action.tellMeQuestion.code, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.TELL_ME_QUESTION + (action.index + 1), tests), @@ -148,14 +127,7 @@ export class VehicleChecksModalCatHomeTestAnalyticsEffects { ), )), switchMap(([action, tests]: [ReturnType, TestsModel]) => { - // TODO - MES-9495 - remove old analytics - const eventText = `tell me question ${action.index + 1} outcome changed`; - const outComeText = action.tellMeQuestionOutcome === 'P' ? 'correct' : 'driving fault'; - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.VEHICLE_CHECKS, tests), - eventText, - outComeText, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.TELL_ME_QUESTION + (action.index + 1), tests), diff --git a/src/app/pages/waiting-room-to-car/waiting-room-to-car.analytics.effects.ts b/src/app/pages/waiting-room-to-car/waiting-room-to-car.analytics.effects.ts index 121dbad08..87f1598fa 100644 --- a/src/app/pages/waiting-room-to-car/waiting-room-to-car.analytics.effects.ts +++ b/src/app/pages/waiting-room-to-car/waiting-room-to-car.analytics.effects.ts @@ -7,10 +7,6 @@ import { CategoryCode } from '@dvsa/mes-test-schema/categories/common'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { - AnalyticsDimensionIndices, - AnalyticsErrorTypes, - AnalyticsEventCategories, - AnalyticsEvents, AnalyticsScreenNames, GoogleAnalyticsCustomDimension, GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, @@ -38,7 +34,7 @@ import { getApplicationNumber, } from '@store/tests/journal-data/common/application-reference/application-reference.selector'; import { getTestCategory } from '@store/tests/category/category.reducer'; -import { analyticsEventTypePrefix, formatAnalyticsText } from '@shared/helpers/format-analytics-text'; +import { analyticsEventTypePrefix } from '@shared/helpers/format-analytics-text'; import * as vehicleDetailsActions from '@store/tests/vehicle-details/vehicle-details.actions'; import { DualControlsToggledNo, @@ -122,13 +118,6 @@ export class WaitingRoomToCarAnalyticsEffects { [, tests, applicationReference, candidateId, category]: [ReturnType, TestsModel, string, number, CategoryCode, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.addCustomDimension(AnalyticsDimensionIndices.CANDIDATE_ID, `${candidateId}`); - this.analytics.addCustomDimension(AnalyticsDimensionIndices.APPLICATION_REFERENCE, applicationReference); - this.analytics.addCustomDimension(AnalyticsDimensionIndices.TEST_CATEGORY, category); - this.analytics.setCurrentPage( - formatAnalyticsText(AnalyticsScreenNames.WAITING_ROOM_TO_CAR, tests), - ); //GA4 Analytics this.analytics.setGACurrentPage(analyticsEventTypePrefix(AnalyticsScreenNames.WAITING_ROOM_TO_CAR, tests)); @@ -166,15 +155,8 @@ export class WaitingRoomToCarAnalyticsEffects { ? true : this.appConfigProvider.getAppConfig()?.journal?.enablePracticeModeAnalytics), switchMap(( - [action, tests, category]: [ReturnType, TestsModel, CategoryCode, boolean], + [action, tests,]: [ReturnType, TestsModel, CategoryCode, boolean], ) => { - // TODO - MES-9495 - remove old analytics - const screenName = formatAnalyticsText(AnalyticsScreenNames.WAITING_ROOM_TO_CAR, tests); - this.analytics.addCustomDimension(AnalyticsDimensionIndices.TEST_CATEGORY, category); - this.analytics.logError( - `${AnalyticsErrorTypes.SUBMIT_FORM_ERROR} (${screenName})`, - action.errorMessage, - ); // GA4 Analytics this.analytics.logGAEvent( @@ -210,16 +192,9 @@ export class WaitingRoomToCarAnalyticsEffects { ? true : this.appConfigProvider.getAppConfig()?.journal?.enablePracticeModeAnalytics), switchMap(( - [action, tests, category]: + [action, tests, ]: [ReturnType, TestsModel, CategoryCode, boolean], ) => { - // TODO - MES-9495 - remove old analytics - const screenName = formatAnalyticsText(AnalyticsScreenNames.WAITING_ROOM_TO_CAR, tests); - this.analytics.addCustomDimension(AnalyticsDimensionIndices.TEST_CATEGORY, category); - this.analytics.logError( - `${AnalyticsErrorTypes.VALIDATION_ERROR} (${screenName})`, - action.errorMessage, - ); // GA4 Analytics this.analytics.logGAEvent( @@ -252,13 +227,6 @@ export class WaitingRoomToCarAnalyticsEffects { [action, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.addCustomDimension(AnalyticsDimensionIndices.TEST_CATEGORY, action.selectedBikeCategory); - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.WAITING_ROOM_TO_CAR, tests), - formatAnalyticsText(AnalyticsEvents.BIKE_CATEGORY_CHANGED, tests), - `bike category changed to ${action.initialBikeCategory} from ${action.selectedBikeCategory}`, - ); // GA4 Analytics this.analytics.logGAEvent( @@ -293,13 +261,6 @@ export class WaitingRoomToCarAnalyticsEffects { [action, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.addCustomDimension(AnalyticsDimensionIndices.TEST_CATEGORY, action.bikeCategory); - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.WAITING_ROOM_TO_CAR, tests), - formatAnalyticsText(AnalyticsEvents.BIKE_CATEGORY_SELECTED, tests), - `bike category ${action.bikeCategory} selected`, - ); // GA4 Analytics this.analytics.logGAEvent( @@ -332,12 +293,7 @@ export class WaitingRoomToCarAnalyticsEffects { [, tests]: [ReturnType, TestsModel, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.WAITING_ROOM_TO_CAR, tests), - formatAnalyticsText(AnalyticsEvents.BIKE_CATEGORY_MODAL_TRIGGERED, tests), - 'bike category selection modal triggered', - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.NAVIGATION, tests), @@ -378,12 +334,7 @@ export class WaitingRoomToCarAnalyticsEffects { [, tests, dualControls]: [ReturnType, TestsModel, boolean, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.WAITING_ROOM_TO_CAR, tests), - formatAnalyticsText(AnalyticsEvents.DUAL_CONTROLS_CHANGED, tests), - `dual controls changed to ${dualControls ? 'Yes' : 'No'}`, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.DUAL_CONTROLS, tests), @@ -417,12 +368,7 @@ export class WaitingRoomToCarAnalyticsEffects { ) => { // Check current URL begins with WRTC prefix before recording analytic to stop duplicated events. if (this.router.url?.startsWith(this.classPrefix)) { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.WAITING_ROOM_TO_CAR, tests), - formatAnalyticsText(AnalyticsEvents.GEARBOX_CATEGORY_CHANGED, tests), - gearboxCategory, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.SET_TRANSMISSION, tests), @@ -462,12 +408,7 @@ export class WaitingRoomToCarAnalyticsEffects { [, tests, pdiLogBook]: [ReturnType, TestsModel, boolean, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.WAITING_ROOM_TO_CAR, tests), - formatAnalyticsText(AnalyticsEvents.PDI_LOGBOOK_CHANGED, tests), - `pdi logbook changed to ${pdiLogBook ? 'Yes' : 'No'}`, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.PDI_LOGBOOK, tests), @@ -505,12 +446,7 @@ export class WaitingRoomToCarAnalyticsEffects { [, tests, traineeLicence]: [ReturnType, TestsModel, boolean, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.WAITING_ROOM_TO_CAR, tests), - formatAnalyticsText(AnalyticsEvents.TRAINEE_LICENCE_CHANGED, tests), - `trainee licence changed to ${traineeLicence ? 'Yes' : 'No'}`, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.TRAINEE_LICENCE, tests), @@ -548,12 +484,7 @@ export class WaitingRoomToCarAnalyticsEffects { [, tests, orditTrained]: [ReturnType, TestsModel, boolean, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.WAITING_ROOM_TO_CAR, tests), - formatAnalyticsText(AnalyticsEvents.ORDIT_TRAINED_CHANGED, tests), - `ordit trained changed to ${orditTrained ? 'Yes' : 'No'}`, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.ORDIT_TRAINER, tests), @@ -588,15 +519,10 @@ export class WaitingRoomToCarAnalyticsEffects { ? true : this.appConfigProvider.getAppConfig()?.journal?.enablePracticeModeAnalytics), switchMap(( - [, tests, trainerRegistrationNumber]: + [, tests, ]: [ReturnType, TestsModel, number, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.WAITING_ROOM_TO_CAR, tests), - formatAnalyticsText(AnalyticsEvents.TRAINER_REG_NUMBER_CHANGED, tests), - `trainer registration number changed to ${trainerRegistrationNumber}`, - ); + // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.TRAINER_REG_NUMBER, tests), @@ -634,12 +560,6 @@ export class WaitingRoomToCarAnalyticsEffects { [, tests, motStatus]: [ReturnType, TestsModel, string, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.WAITING_ROOM_TO_CAR, tests), - formatAnalyticsText(AnalyticsEvents.MOT_STATUS_CHANGED, tests), - `mot status: ${motStatus}`, - ); // GA4 Analytics this.analytics.logGAEvent( diff --git a/src/app/pages/waiting-room/waiting-room.analytics.effects.ts b/src/app/pages/waiting-room/waiting-room.analytics.effects.ts index 5a5687bdb..db021a64a 100644 --- a/src/app/pages/waiting-room/waiting-room.analytics.effects.ts +++ b/src/app/pages/waiting-room/waiting-room.analytics.effects.ts @@ -6,9 +6,6 @@ import { } from 'rxjs/operators'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { - AnalyticsDimensionIndices, - AnalyticsErrorTypes, - AnalyticsEventCategories, AnalyticsEvents, AnalyticsScreenNames, GoogleAnalyticsCustomDimension, @@ -26,7 +23,7 @@ import { getCandidate } from '@store/tests/journal-data/common/candidate/candida import { getCandidateId } from '@store/tests/journal-data/common/candidate/candidate.selector'; import { TestsModel } from '@store/tests/tests.model'; import { AnalyticNotRecorded, AnalyticRecorded } from '@providers/analytics/analytics.actions'; -import { analyticsEventTypePrefix, formatAnalyticsText } from '@shared/helpers/format-analytics-text'; +import { analyticsEventTypePrefix } from '@shared/helpers/format-analytics-text'; import { getApplicationReference, } from '@store/tests/journal-data/common/application-reference/application-reference.reducer'; @@ -98,11 +95,6 @@ export class WaitingRoomAnalyticsEffects { [, tests, applicationReference, candidateId, category]: [ReturnType, TestsModel, string, number, CategoryCode, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.addCustomDimension(AnalyticsDimensionIndices.TEST_CATEGORY, category); - this.analytics.addCustomDimension(AnalyticsDimensionIndices.CANDIDATE_ID, `${candidateId}`); - this.analytics.addCustomDimension(AnalyticsDimensionIndices.APPLICATION_REFERENCE, applicationReference); - this.analytics.setCurrentPage(formatAnalyticsText(AnalyticsScreenNames.WAITING_ROOM, tests)); //GA4 Analytics this.analytics.setGACurrentPage(analyticsEventTypePrefix(AnalyticsScreenNames.WAITING_ROOM, tests)); @@ -140,16 +132,10 @@ export class WaitingRoomAnalyticsEffects { ? true : this.appConfigProvider.getAppConfig()?.journal?.enablePracticeModeAnalytics), switchMap(( - [action, tests, category]: + [action, tests, ]: [ReturnType, TestsModel, CategoryCode, boolean], ) => { - // TODO - MES-9495 - remove old analytics - const screenName = formatAnalyticsText(AnalyticsScreenNames.WAITING_ROOM, tests); - this.analytics.addCustomDimension(AnalyticsDimensionIndices.TEST_CATEGORY, category); - this.analytics.logError(`${AnalyticsErrorTypes.VALIDATION_ERROR} (${screenName})`, - action.errorMessage); - // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.VALIDATION_ERROR, tests), @@ -180,12 +166,6 @@ export class WaitingRoomAnalyticsEffects { : this.appConfigProvider.getAppConfig()?.journal?.enablePracticeModeAnalytics), concatMap(([, tests]: [ReturnType, TestsModel, boolean]) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.WAITING_ROOM, tests), - formatAnalyticsText(AnalyticsEvents.CBT_CHANGED, tests), - ); - // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(AnalyticsEvents.CBT_CHANGED, tests) @@ -215,13 +195,6 @@ export class WaitingRoomAnalyticsEffects { concatMap(([, tests]: [ReturnType, TestsModel, boolean]) => { if (this.router.url?.startsWith(this.className)) { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.WAITING_ROOM, tests), - AnalyticsEvents.VRN_CAPTURE, - AnalyticsEvents.VRN_CAPTURE_SELECTED, - ); - // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(AnalyticsEvents.VRN_CAPTURE, tests), @@ -258,13 +231,6 @@ export class WaitingRoomAnalyticsEffects { ) => { if (this.router.url?.startsWith(this.className)) { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.WAITING_ROOM, tests), - AnalyticsEvents.VRN_CAPTURE, - AnalyticsEvents.VRN_CAPTURE_CANCELLED, - ); - // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(AnalyticsEvents.VRN_CAPTURE, tests), @@ -297,13 +263,6 @@ export class WaitingRoomAnalyticsEffects { concatMap(([, tests]: [ReturnType, TestsModel, boolean]) => { if (this.router.url?.startsWith(this.className)) { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.WAITING_ROOM, tests), - AnalyticsEvents.VRN_CAPTURE, - AnalyticsEvents.VRN_CAPTURE_SAVED, - ); - // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(AnalyticsEvents.VRN_CAPTURE, tests), diff --git a/src/app/providers/analytics/__tests__/analytics.spec.ts b/src/app/providers/analytics/__tests__/analytics.spec.ts index 75db14eb9..933b18f33 100644 --- a/src/app/providers/analytics/__tests__/analytics.spec.ts +++ b/src/app/providers/analytics/__tests__/analytics.spec.ts @@ -49,50 +49,4 @@ xdescribe('AnalyticsProvider', () => { .and .returnValue(true); }); - - describe('setUserId', () => { - it('should start tracker with id, and then call setUserId with encrypted staff number', () => { - spyOn(analyticsProvider, 'addCustomDimension'); - analyticsProvider.setUserId('123'); - expect(googleAnalyticsMock.startTrackerWithId) - .toHaveBeenCalledWith('abc123-ghj-123'); - }); - // it('should hash the userId for 456 correctly', () => { - // expect(googleAnalyticsMock).toBeDefined(); - // analyticsProvider.setUserId('456'); - // expect(analyticsProvider.uniqueUserId) - // .toEqual('b3a8e0e1f9ab1bfe3a36f231f676f78bb30a519d2b21e6c530c0eee8ebb4a5d0'); - // }); - // it('should hash the userId consistently when no value is available', () => { - // expect(googleAnalyticsMock).toBeDefined(); - // analyticsProvider.setUserId(''); - // expect(analyticsProvider.uniqueUserId) - // .toEqual('ba691ba042bcedd9a61a36f5969026bc95859dccdc7e47f24e6bce35673baf2f'); - // }); - }); - - describe('setDeviceId', () => { - it('should hash the userId for abcdef123456 correctly', () => { - expect(googleAnalyticsMock) - .toBeDefined(); - analyticsProvider.setDeviceId('abcdef123456'); - expect(analyticsProvider.uniqueDeviceId) - .toEqual('da4ec3358a10c9b0872eb877953cc7b07af5f4d75e4c1cb0597cbbf41e5dbe35'); - }); - it('should hash the userId for aabbccddeeff correctly', () => { - expect(googleAnalyticsMock) - .toBeDefined(); - analyticsProvider.setDeviceId('aabbccddeeff'); - expect(analyticsProvider.uniqueDeviceId) - .toEqual('c1799564f2eefcaf63dd2e5cc08573e63856222a232dab2d91a17b232830d430'); - }); - it('should hash the userId consistently when no value is available', () => { - expect(googleAnalyticsMock) - .toBeDefined(); - analyticsProvider.setDeviceId(''); - expect(analyticsProvider.uniqueDeviceId) - .toEqual('96ed066cad78965eafb18fdffbc37509aa98ff9dc21b9781589eebba01d5be3e'); - }); - }); - }); diff --git a/src/app/providers/analytics/analytics.model.ts b/src/app/providers/analytics/analytics.model.ts index 2e30fb312..5b9cda6eb 100644 --- a/src/app/providers/analytics/analytics.model.ts +++ b/src/app/providers/analytics/analytics.model.ts @@ -1,19 +1,7 @@ -import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; export interface IAnalyticsProvider { - setCurrentPage(name: string): void; - - addCustomDimension(key: number, value: string): void; - - logEvent(category: TestCategory, event: string, label?: string, params?: any): void; - - logError(type: string, message: string): void; logException(message: string, fatal: boolean): void; - - setUserId(userId: string): void; - - initialiseAnalytics(): Promise; } export enum AnalyticsScreenNames { diff --git a/src/app/providers/analytics/analytics.ts b/src/app/providers/analytics/analytics.ts index fc55b5237..50d7ff6eb 100644 --- a/src/app/providers/analytics/analytics.ts +++ b/src/app/providers/analytics/analytics.ts @@ -6,7 +6,6 @@ import { DateTime } from '@shared/helpers/date-time'; import { DeviceProvider } from '../device/device'; import { AppConfigProvider } from '../app-config/app-config'; import { - AnalyticsDimensionIndices, AnalyticsEventCategories, GoogleAnalyticsCustomDimension, IAnalyticsProvider, @@ -237,20 +236,6 @@ export class AnalyticsProvider implements IAnalyticsProvider { this.logGAEvent(type, AnalyticsEventCategories.VALIDATION_ERROR, message); } - // TODO - MES-9495 - remove old analytics - initialiseAnalytics = (): Promise => new Promise((resolve) => { - this.googleAnalyticsKey = this.appConfig.getAppConfig()?.googleAnalyticsId; - this.platform.ready() - .then(async () => { - this.setDeviceId(await this.device.getUniqueDeviceId()); - this.setUserId(this.authProvider.getEmployeeId()); - this.addCustomDimension(AnalyticsDimensionIndices.DEVICE_ID, this.uniqueDeviceId); - this.addCustomDimension(AnalyticsDimensionIndices.DEVICE_MODEL, await this.device.getDeviceName()); - this.enableExceptionReporting(); - }); - resolve(true); - }); - enableExceptionReporting(): void { this.platform.ready() .then(() => { @@ -268,62 +253,6 @@ export class AnalyticsProvider implements IAnalyticsProvider { }); } - // TODO - MES-9495 - remove old analytics - setCurrentPage(name: string): void { - this.platform.ready() - .then(() => { - if (this.isIos()) { - this.ga - .startTrackerWithId(this.googleAnalyticsKey) - .then(() => { - this.ga.trackView(name) - .then(() => { - }) - .catch((pageError) => console.log('Error setting page', pageError)); - }) - .catch((error) => console.log('Error starting Google Analytics', error)); - } - }); - } - - // TODO - MES-9495 - remove old analytics - logEvent(category: string, event: string, label?: string, value?: number): void { - this.platform.ready() - .then(() => { - if (this.isIos()) { - this.ga - .startTrackerWithId(this.googleAnalyticsKey) - .then(() => { - this.ga.trackEvent(category, event, label, value) - .then(() => { - }) - .catch((eventError) => console.log('Error tracking event', eventError)); - }) - .catch((error) => console.log(`logEvent: ${this.analyticsStartupError}`, error)); - } - }); - } - - // TODO - MES-9495 - remove old analytics - addCustomDimension(key: number, value: string): void { - if (this.isIos()) { - this.ga - .startTrackerWithId(this.googleAnalyticsKey) - .then(() => { - this.ga.addCustomDimension(key, value) - .then(() => { - }) - .catch((dimError) => console.log('Error adding custom dimension ', dimError)); - }) - .catch((error) => console.log(`addCustomDimension: ${this.analyticsStartupError}`, error)); - } - } - - // TODO - MES-9495 - remove old analytics - logError(type: string, message: string): void { - this.logEvent(AnalyticsEventCategories.ERROR, type, message); - } - logException(message: string, fatal: boolean): void { if (this.isIos()) { this.ga @@ -338,36 +267,6 @@ export class AnalyticsProvider implements IAnalyticsProvider { } } - // TODO - MES-9495 - remove old analytics - setUserId(userId: string): void { - if (this.isIos()) { - // @TODO: Consider using `createHash('sha512')` based on SonarQube suggestion. - // This will have GA user implications - this.uniqueUserId = createHash('sha256') - .update(userId || 'unavailable') - .digest('hex'); - this.ga - .startTrackerWithId(this.googleAnalyticsKey) - .then(() => { - this.addCustomDimension(AnalyticsDimensionIndices.USER_ID, this.uniqueUserId); - this.ga.setUserId(this.uniqueUserId) - .then(() => { - }) - .catch((idError) => console.log(`Error setting userid ${this.uniqueUserId}`, idError)); - }) - .catch((error) => console.log(`setUserId: ${this.analyticsStartupError}`, error)); - } - } - - // TODO - MES-9495 - remove old analytics - setDeviceId(deviceId: string): void { - // @TODO: Consider using `createHash('sha512')` based on SonarQube suggestion. - // This will have GA device implications - this.uniqueDeviceId = createHash('sha256') - .update(deviceId || 'defaultDevice') - .digest('hex'); - this.addCustomDimension(AnalyticsDimensionIndices.DEVICE_ID, this.uniqueDeviceId); - } getDiffDays(userDate: string): number { const today = new DateTime(); diff --git a/src/store/tests/__tests__/tests.analytics.effects.spec.ts b/src/store/tests/__tests__/tests.analytics.effects.spec.ts index c09424ea8..a4a41fe83 100644 --- a/src/store/tests/__tests__/tests.analytics.effects.spec.ts +++ b/src/store/tests/__tests__/tests.analytics.effects.spec.ts @@ -5,9 +5,8 @@ import { provideMockActions } from '@ngrx/effects/testing'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { - AnalyticsDimensionIndices, AnalyticsEventCategories, - AnalyticsEvents, GoogleAnalyticsCustomDimension, + GoogleAnalyticsCustomDimension, GoogleAnalyticsEventPrefix, GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, @@ -88,7 +87,6 @@ describe('TestsAnalyticsEffects', () => { analyticsProviderMock = TestBed.inject(AnalyticsProvider); navigationStateProviderMock = TestBed.inject(NavigationStateProvider); store$ = TestBed.inject(Store); - spyOn(analyticsProviderMock, 'logEvent'); }); describe('setTestStatusSubmittedEffect', () => { @@ -104,18 +102,6 @@ describe('TestsAnalyticsEffects', () => { effects.setTestStatusSubmittedEffect$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.POST_TEST, - AnalyticsEvents.SUBMIT_TEST, - 'Pass', - ); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_ID, '1'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.APPLICATION_REFERENCE, '123456789'); // GA4 Analytics expect(analyticsProviderMock.logGAEvent) @@ -146,18 +132,6 @@ describe('TestsAnalyticsEffects', () => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.POST_TEST, - AnalyticsEvents.SUBMIT_REKEY_TEST, - 'Fail', - ); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_ID, '1'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.APPLICATION_REFERENCE, '123456789'); - // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -182,12 +156,6 @@ describe('TestsAnalyticsEffects', () => { effects.sendCompletedTestsFailureEffect$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logError) - .toHaveBeenCalledWith( - 'Error connecting to microservice (test submission)', - 'No message', - ); // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -208,12 +176,6 @@ describe('TestsAnalyticsEffects', () => { effects.sendPartialTestsFailureEffect$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logError) - .toHaveBeenCalledWith( - 'Error connecting to microservice (partial test submission)', - 'No message', - ); // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith( @@ -240,17 +202,6 @@ describe('TestsAnalyticsEffects', () => { effects.testOutcomeChangedEffect$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.TEST_OUTCOME_CHANGED, - eventLabel, - ); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_ID, '1'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.APPLICATION_REFERENCE, '123456789'); // GA4 Analytics expect(analyticsProviderMock.logGAEvent) @@ -281,17 +232,6 @@ describe('TestsAnalyticsEffects', () => { effects.testOutcomeChangedEffect$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.TEST_OUTCOME_CHANGED, - eventLabel, - ); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_ID, '1'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.APPLICATION_REFERENCE, '123456789'); // GA4 Analytics expect(analyticsProviderMock.logGAEvent) @@ -322,17 +262,6 @@ describe('TestsAnalyticsEffects', () => { effects.testOutcomeChangedEffect$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.TEST_REPORT, - AnalyticsEvents.TEST_OUTCOME_CHANGED, - eventLabel, - ); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.CANDIDATE_ID, '1'); - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith(AnalyticsDimensionIndices.APPLICATION_REFERENCE, '123456789'); // GA4 Analytics expect(analyticsProviderMock.logGAEvent) @@ -380,17 +309,6 @@ describe('TestsAnalyticsEffects', () => { effects.startTestAnalyticsEffect$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith( - AnalyticsDimensionIndices.TEST_CATEGORY, - TestCategory.B, - ); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.JOURNAL, - AnalyticsEvents.START_TEST, - ); // GA4 Analytics expect(analyticsProviderMock.addGACustomDimension) .toHaveBeenCalledWith( @@ -416,44 +334,8 @@ describe('TestsAnalyticsEffects', () => { effects.startTestAnalyticsEffect$.subscribe((result) => { expect(result.type) .toEqual(AnalyticRecorded.type); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.addCustomDimension) - .toHaveBeenCalledWith( - AnalyticsDimensionIndices.TEST_CATEGORY, - TestCategory.B, - ); - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.REKEY_SEARCH, - AnalyticsEvents.START_TEST, - ); - - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.METADATA, - AnalyticsEvents.REPORT_DEVICE_STATE, - 'batteryLevel', - 0.9, - ); - - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.METADATA, - AnalyticsEvents.REPORT_DEVICE_STATE, - 'realDiskFree', - 456 - ); - - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith( - AnalyticsEventCategories.METADATA, - AnalyticsEvents.REPORT_DEVICE_STATE, - 'realDiskTotal', - 1000 - ); // GA4 Analytics - expect(analyticsProviderMock.addGACustomDimension) .toHaveBeenCalledWith( GoogleAnalyticsCustomDimension.TEST_CATEGORY, diff --git a/src/store/tests/test-status/__tests__/test-status.analytics.effects.spec.ts b/src/store/tests/test-status/__tests__/test-status.analytics.effects.spec.ts index e18348d65..646c5888f 100644 --- a/src/store/tests/test-status/__tests__/test-status.analytics.effects.spec.ts +++ b/src/store/tests/test-status/__tests__/test-status.analytics.effects.spec.ts @@ -6,7 +6,7 @@ import { provideMockActions } from '@ngrx/effects/testing'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; -import { AnalyticsEventCategories, AnalyticsEvents, GoogleAnalyticsEvents } from '@providers/analytics/analytics.model'; +import { GoogleAnalyticsEvents } from '@providers/analytics/analytics.model'; import { TestStatusAnalyticsEffects } from '../test-status.analytics.effects'; import { testsReducer } from '../../tests.reducer'; import * as testStatusActions from '../test-status.actions'; @@ -37,7 +37,6 @@ describe('TestStatusAnalyticsEffects', () => { actions$ = new ReplaySubject(1); effects = TestBed.inject(TestStatusAnalyticsEffects); analyticsProviderMock = TestBed.inject(AnalyticsProvider); - spyOn(analyticsProviderMock, 'logEvent'); }); describe('setTestStatusDecidedEffect', () => { @@ -49,10 +48,6 @@ describe('TestStatusAnalyticsEffects', () => { effects.setTestStatusDecidedEffect$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBeTruthy(); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith(AnalyticsEventCategories.TEST_LIFECYCLE, AnalyticsEvents.TEST_DECIDED); - // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith(GoogleAnalyticsEvents.TEST_DECIDED); @@ -69,11 +64,6 @@ describe('TestStatusAnalyticsEffects', () => { effects.setTestStatusWriteUpEffect$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBeTruthy(); - - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith(AnalyticsEventCategories.TEST_LIFECYCLE, AnalyticsEvents.TEST_IN_WRITE_UP); - // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith(GoogleAnalyticsEvents.TEST_IN_WRITE_UP); @@ -91,10 +81,6 @@ describe('TestStatusAnalyticsEffects', () => { effects.setTestStatusAutosavedEffect$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBeTruthy(); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith(AnalyticsEventCategories.TEST_LIFECYCLE, AnalyticsEvents.TEST_AUTOSAVED); - // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith(GoogleAnalyticsEvents.TEST_AUTOSAVED); @@ -112,10 +98,6 @@ describe('TestStatusAnalyticsEffects', () => { effects.setTestStatusSubmittedEffect$.subscribe((result) => { expect(result.type === AnalyticRecorded.type).toBeTruthy(); - // TODO - MES-9495 - remove old analytics - expect(analyticsProviderMock.logEvent) - .toHaveBeenCalledWith(AnalyticsEventCategories.TEST_LIFECYCLE, AnalyticsEvents.TEST_SUBMITTED); - // GA4 Analytics expect(analyticsProviderMock.logGAEvent) .toHaveBeenCalledWith(GoogleAnalyticsEvents.TEST_SUBMITTED); diff --git a/src/store/tests/test-status/test-status.analytics.effects.ts b/src/store/tests/test-status/test-status.analytics.effects.ts index be3c4a561..b39fd4398 100644 --- a/src/store/tests/test-status/test-status.analytics.effects.ts +++ b/src/store/tests/test-status/test-status.analytics.effects.ts @@ -3,7 +3,7 @@ import { Actions, createEffect, ofType } from '@ngrx/effects'; import { of } from 'rxjs'; import { concatMap, filter, withLatestFrom } from 'rxjs/operators'; import { AnalyticsProvider } from '@providers/analytics/analytics'; -import { AnalyticsEventCategories, AnalyticsEvents, GoogleAnalyticsEvents } from '@providers/analytics/analytics.model'; +import { GoogleAnalyticsEvents } from '@providers/analytics/analytics.model'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; import * as testStatusActions from './test-status.actions'; import { analyticsEventTypePrefix } from '@shared/helpers/format-analytics-text'; @@ -47,12 +47,6 @@ export class TestStatusAnalyticsEffects { [ReturnType, TestsModel, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.TEST_LIFECYCLE, - AnalyticsEvents.TEST_DECIDED, - ); - //GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.TEST_DECIDED, tests), @@ -83,12 +77,6 @@ export class TestStatusAnalyticsEffects { [ReturnType, TestsModel, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.TEST_LIFECYCLE, - AnalyticsEvents.TEST_IN_WRITE_UP, - ); - //GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.TEST_IN_WRITE_UP, tests), @@ -101,12 +89,6 @@ export class TestStatusAnalyticsEffects { ofType(testStatusActions.SetTestStatusAutosaved), concatMap(() => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.TEST_LIFECYCLE, - AnalyticsEvents.TEST_AUTOSAVED, - ); - // GA4 Analytics this.analytics.logGAEvent( GoogleAnalyticsEvents.TEST_AUTOSAVED, @@ -137,12 +119,6 @@ export class TestStatusAnalyticsEffects { [ReturnType, TestsModel, boolean], ) => { - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.TEST_LIFECYCLE, - AnalyticsEvents.TEST_SUBMITTED, - ); - // GA4 Analytics this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.TEST_SUBMITTED, tests), diff --git a/src/store/tests/tests.analytics.effects.ts b/src/store/tests/tests.analytics.effects.ts index be62c63c2..439b81b4c 100644 --- a/src/store/tests/tests.analytics.effects.ts +++ b/src/store/tests/tests.analytics.effects.ts @@ -5,9 +5,7 @@ import { select, Store } from '@ngrx/store'; import { StoreModel } from '@shared/models/store.model'; import { concatMap, map, switchMap, withLatestFrom } from 'rxjs/operators'; import { - AnalyticsDimensionIndices, - AnalyticsEventCategories, - AnalyticsEvents, GoogleAnalyticsCustomDimension, + GoogleAnalyticsCustomDimension, GoogleAnalyticsEvents, GoogleAnalyticsEventsTitles, GoogleAnalyticsEventsValues, @@ -15,7 +13,7 @@ import { import { of } from 'rxjs'; import { AnalyticNotRecorded, AnalyticRecorded } from '@providers/analytics/analytics.actions'; import { formatApplicationReference } from '@shared/helpers/formatters'; -import { analyticsEventTypePrefix, formatAnalyticsText } from '@shared/helpers/format-analytics-text'; +import { analyticsEventTypePrefix } from '@shared/helpers/format-analytics-text'; import { Router } from '@angular/router'; import { NavigationStateProvider } from '@providers/navigation-state/navigation-state'; import { getTestOutcome } from '@pages/debrief/debrief.selector'; @@ -60,41 +58,14 @@ export class TestsAnalyticsEffects { concatMap(([action, tests]: [ReturnType, TestsModel]) => { const test = getTestById(tests, action.slotId); const testOutcome = getTestOutcome(test as TestResultCommonSchema); - const isRekey: boolean = test.rekey; const journalDataOfTest = test.journalData; - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.POST_TEST, - isRekey ? AnalyticsEvents.SUBMIT_REKEY_TEST : AnalyticsEvents.SUBMIT_TEST, - testOutcome, - ); - - this.analytics.addCustomDimension( - AnalyticsDimensionIndices.APPLICATION_REFERENCE, - formatApplicationReference(journalDataOfTest.applicationReference), - ); - this.analytics.addCustomDimension( - AnalyticsDimensionIndices.CANDIDATE_ID, - journalDataOfTest.candidate.candidateId ? journalDataOfTest.candidate.candidateId.toString() : null, - ); - // GA4 Analytics - let returnValue = null; - switch (testOutcome) { - case 'Fail': - returnValue = GoogleAnalyticsEventsValues.FAIL; - break; - case 'Pass': - returnValue = GoogleAnalyticsEventsValues.PASS; - break; - case 'Terminated': - returnValue = GoogleAnalyticsEventsValues.TERMINATED; - break; - default: - returnValue = GoogleAnalyticsEventsValues.UNKNOWN; - break; - } + const returnValue = { + 'Fail': GoogleAnalyticsEventsValues.FAIL, + 'Pass': GoogleAnalyticsEventsValues.PASS, + 'Terminated': GoogleAnalyticsEventsValues.TERMINATED, + } [testOutcome] || GoogleAnalyticsEventsValues.UNKNOWN; this.analytics.logGAEvent( analyticsEventTypePrefix(GoogleAnalyticsEvents.SUBMIT_TEST, tests), @@ -118,8 +89,6 @@ export class TestsAnalyticsEffects { sendCompletedTestsFailureEffect$ = createEffect(() => this.actions$.pipe( ofType(SendCompletedTestsFailure), switchMap(() => { - // TODO - MES-9495 - remove old analytics - this.analytics.logError('Error connecting to microservice (test submission)', 'No message'); // GA4 Analytics this.analytics.logGAEvent( GoogleAnalyticsEvents.MICROSERVICE_ERROR, @@ -133,8 +102,6 @@ export class TestsAnalyticsEffects { sendPartialTestsFailureEffect$ = createEffect(() => this.actions$.pipe( ofType(SendPartialTestsFailure), switchMap(() => { - // TODO - MES-9495 - remove old analytics - this.analytics.logError('Error connecting to microservice (partial test submission)', 'No message'); // GA4 Analytics this.analytics.logGAEvent( GoogleAnalyticsEvents.MICROSERVICE_ERROR, @@ -169,28 +136,12 @@ export class TestsAnalyticsEffects { const { journalData } = test; - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - AnalyticsEventCategories.TEST_SUBMISSION, - this.formatter(action.type), - JSON.stringify({ - slotID, - appRef: formatApplicationReference(journalData.applicationReference), - testStatus: action.testStatus, - }), - ); // GA4 Analytics - let submissionType: string; - switch (this.formatter(action.type)) { - case 'send completed tests success': - submissionType = GoogleAnalyticsEventsValues.COMPLETED; - break; - case 'send partial tests success': - submissionType = GoogleAnalyticsEventsValues.PARTIAL; - break; - default: - submissionType = GoogleAnalyticsEventsValues.UNKNOWN; - } + const submissionType = { + 'send completed tests success': GoogleAnalyticsEventsValues.COMPLETED, + 'send partial tests success': GoogleAnalyticsEventsValues.PARTIAL, + } [this.formatter(action.type)] || GoogleAnalyticsEventsValues.UNKNOWN; + this.analytics.logGAEvent( GoogleAnalyticsEvents.TEST_SUBMISSION, GoogleAnalyticsEventsTitles.STATUS, @@ -220,22 +171,6 @@ export class TestsAnalyticsEffects { const test = getCurrentTest(tests); const journalDataOfTest = test.journalData; - // TODO - MES-9495 - remove old analytics - this.analytics.logEvent( - formatAnalyticsText(AnalyticsEventCategories.TEST_REPORT, tests), - formatAnalyticsText(AnalyticsEvents.TEST_OUTCOME_CHANGED, tests), - action.outcome, - ); - - this.analytics.addCustomDimension( - AnalyticsDimensionIndices.APPLICATION_REFERENCE, - formatApplicationReference(journalDataOfTest.applicationReference), - ); - this.analytics.addCustomDimension( - AnalyticsDimensionIndices.CANDIDATE_ID, - journalDataOfTest.candidate.candidateId.toString(), - ); - // GA4 Analytics let oldValue = null; let newValue = null; @@ -303,42 +238,6 @@ export class TestsAnalyticsEffects { switchMap(( [action, applicationReference, device, battery], ) => { - const category: AnalyticsEventCategories = this.navigationStateProvider.isRekeySearch() - ? AnalyticsEventCategories.REKEY_SEARCH - : AnalyticsEventCategories.JOURNAL; - - // TODO - MES-9495 - remove old analytics - this.analytics.addCustomDimension(AnalyticsDimensionIndices.TEST_CATEGORY, action.category); - - if (applicationReference) { - this.analytics.addCustomDimension( - AnalyticsDimensionIndices.APPLICATION_REFERENCE, - formatApplicationReference(applicationReference), - ); - } - - this.analytics.logEvent(category, AnalyticsEvents.START_TEST); - - this.analytics.logEvent( - AnalyticsEventCategories.METADATA, - AnalyticsEvents.REPORT_DEVICE_STATE, - 'batteryLevel', - (battery as BatteryInfo).batteryLevel, - ); - - this.analytics.logEvent( - AnalyticsEventCategories.METADATA, - AnalyticsEvents.REPORT_DEVICE_STATE, - 'realDiskFree', - (device as DeviceInfo).realDiskFree, - ); - - this.analytics.logEvent( - AnalyticsEventCategories.METADATA, - AnalyticsEvents.REPORT_DEVICE_STATE, - 'realDiskTotal', - (device as DeviceInfo).realDiskTotal, - ); // GA4 Analytics const prefix = this.navigationStateProvider.isRekeySearch()