Merge pull request #1176 from Safelite/feature/richardson/INSR-8886

updates for schedule page analytics
This commit is contained in:
brich1212safe 2026-04-09 15:59:05 -04:00 committed by GitHub
commit 2a6171b58b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 49 additions and 9 deletions

View file

@ -38,7 +38,8 @@ const mockMixin = {
days: []
}
};
})
}),
pushGenericObjectToGA: jest.fn()
}
};

View file

@ -514,6 +514,8 @@ export default {
jobMinMinutes: emittedValue.estimatedServiceMinutesMin.toString(),
};
this.selectedAppointmentType = AppointmentTypeStrings.MOBILE;
this.pushServiceTypeEvent();
this.mainStore.saveSchedule(timeSlotToUse);
showIssLoadingModal(true);
this.$router.navigate(
@ -813,6 +815,7 @@ export default {
if (this.selectedAppointmentType === AppointmentTypeStrings.MOBILE
|| this.selectedAppointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP) {
this.pushMobileFirstDateEvent(initialData);
this.mobileDatesData = initialData;
if (this.selectedProvider?.providerNumber) {
@ -833,9 +836,11 @@ export default {
daysFromStart: endDateObject.daysFromStart || null
}));
this.pushInshopFirstDateEvent(inShopData);
this.inShopDatesData = inShopData;
}
} else {
this.pushInshopFirstDateEvent(initialData);
this.inShopDatesData = initialData;
this.mobileDatesData = [];
}
@ -940,6 +945,30 @@ export default {
});
}
},
pushInshopFirstDateEvent(inshopData) {
let dateDiffString = '';
if (inshopData?.initialShopTimeSlotsResponse?.days?.length > 0) {
const todayDateString = convertDateToDateString(new Date());
dateDiffString = calcDaysBetweenDates(todayDateString, inshopData.initialShopTimeSlotsResponse.days[0].date).toString();
}
this.pushEventToGA('appointment', 'availability_inshop', `days_out_${dateDiffString}`, true, null, null);
},
pushMobileFirstDateEvent(mobileData) {
let dateDiffString = '';
if (mobileData?.initialShopTimeSlotsResponse?.days?.length > 0) {
const todayDateString = convertDateToDateString(new Date());
dateDiffString = calcDaysBetweenDates(todayDateString, mobileData.initialShopTimeSlotsResponse.days[0].date).toString();
}
this.pushEventToGA('appointment', 'availability_mobile', `days_out_${dateDiffString}`, true, null, null);
},
pushServiceTypeEvent() {
if (this.selectedAppointmentType) {
const gaScheduleType = {
['service_type']: this.selectedAppointmentType.toLowerCase()
};
this.pushGenericObjectToGA(gaScheduleType);
}
},
async refreshDatePicker() {
this.resetLocalFlags();
this.isDatePickerRefreshing = true;
@ -977,6 +1006,7 @@ export default {
}
await this.$refs.serviceLocation.forwardButtonAction(appointmentTypeToUse);
this.pushServiceTypeEvent();
this.mainStore.saveSchedule(this.selectedTimeSlotInfo.timeSlot);
this.$router.navigate(
this.navigationScenarios.CLICKED_FORWARD,

View file

@ -571,7 +571,6 @@ export default {
await mobileFeePromise.then((result) => {
this.mobileFeePart = result ?? null;
});
}
}
}

View file

@ -91,7 +91,6 @@ export default {
store.logCustomEvent(payload);
},
pushEventToGA(category, action, label, pushToLogApp = false, valueToLogType = null, value = undefined) {
const currentPageName = this.getPageNameByQueryString();
const labelToLog = getValueToLog(label, valueToLogType);
@ -111,6 +110,9 @@ export default {
this.logCustomEvent(category, action, labelToLog, value);
}
},
pushGenericObjectToGA(object) {
pushToDataLayerIfDefined(object);
},
pushPageViewToGA() {
const currentPageName = this.getPageNameByQueryString();
@ -126,9 +128,17 @@ export default {
},
pushValueToGA() {
pushToDataLayerIfDefined({
siteType: useMainStore().issConfig.siteType
});
const gaSiteType = {
['siteType']: useMainStore().issConfig.siteType
};
this.pushGenericObjectToGA(gaSiteType);
const gaServiceType = {
['service_type']: useMainStore().order?.serviceLocation?.appointmentType?.toLowerCase()
};
if (gaServiceType && gaServiceType['service_type']) {
this.pushGenericObjectToGA(gaServiceType);
}
},
pushExperimentsToDataLayer() {
@ -229,13 +239,13 @@ export default {
const applicationUser = store.applicationUser;
// NOTE: ISS does not support early bird times.
const isEarlyBird = false; /*order?.lineItems?.supportingItems?.find(
const isEarlyBird = false; /* order?.lineItems?.supportingItems?.find(
(lineItem) => lineItem.partType == partTypeStrings.EARLY_BIRD
);
*/
// NOTE: No promo codes on ISS at the moment.
const promoCodes = ""; /*Array.isArray(order?.lineItems?.promos)
const promoCodes = ""; /* Array.isArray(order?.lineItems?.promos)
? order?.lineItems?.promos
.map((item) => item.promoCode)
.filter((code) => code)
@ -280,7 +290,7 @@ export default {
}
}
*/
var parentAccountNumber = (order?.parentAccountNumber ?? ( issConfig.parentAccountNumber ?? 0)).toString();
var parentAccountNumber = (order?.parentAccountNumber ?? (issConfig.parentAccountNumber ?? 0)).toString();
var sessionData = {};
sessionData.currentPage = currentPageName;