INSR-8884: More payment-method events

This commit is contained in:
Alex Humphries 2026-04-21 16:53:34 -04:00
parent fa21cb1a7c
commit 9a7b452b98
2 changed files with 37 additions and 2 deletions

View file

@ -20,6 +20,7 @@ import buttonQuestion from '@/digital-components/button-question/button-question
import widgetFields from '@/constants/cms-widget-fields.js';
import paymentMethodListButton from './payment-method-list-button/payment-method-list-button.vue';
import { markRaw } from 'vue';
import { analyticsPaymentTypeMap } from '@/constants/analytics';
export default {
name: 'payment-method-question',
@ -43,6 +44,7 @@ export default {
return this.modelValue;
},
set(selectedMethod) {
this.pushEventToGA('submit_order', 'payment_type_selected', analyticsPaymentTypeMap.get(selectedMethod), true);
this.$emit('update:modelValue', selectedMethod);
}
},

View file

@ -157,6 +157,7 @@ import { formatAmountInDollars } from '@/helpers/text-helper';
import widgetFields from '@/constants/cms-widget-fields';
import MaskaFormattedMasks from '@/constants/maska-masks';
import { containsRecalParts } from '@/helpers/recal-helper';
import coverageType from '@/constants/coverage-type';
export default {
name: 'payment-method',
@ -199,7 +200,7 @@ export default {
});
},
mounted() {
this.handleAnalyticsEvents();
this.handleAnalyticsEventsOnMounted();
},
data() {
return {
@ -415,6 +416,7 @@ export default {
this.$refs.siteFooter.updateButtonText(newValue);
},
async forwardButtonAction() {
this.handleAnalyticsEventsOnForwardButtonAction();
this.mainStore.savePaymentMethodChoice(this.paymentMethod);
this.savePageDataToStore(issPageValues.PAYMENT_METHOD, { smsOptIn: this.smsOptIn });
if (!this.hideSMSOptIn) {
@ -464,6 +466,7 @@ export default {
handleEditClicked(section) {
switch (section) {
case 'location':
this.pushEventToGA('order_summary', 'change', 'location', true);
const scenario = this.mainStore.isMobileAppointment
? this.navigationScenarios.EDIT_SERVICE_LOCATION_MOBILE
: this.navigationScenarios.EDIT_SERVICE_LOCATION_INSHOP;
@ -473,6 +476,7 @@ export default {
);
break;
case 'schedule':
this.pushEventToGA('order_summary', 'change', 'time', true);
this.$router.navigateWithSpinner(
this.navigationScenarios.EDIT_SCHEDULE,
this.$route
@ -504,7 +508,7 @@ export default {
closeContactDetailsWithoutSaving() {
this.smsOptIn = 'No';
},
handleAnalyticsEvents() {
handleAnalyticsEventsOnMounted() {
const mobileOrInshop = this.mainStore.isMobileAppointment ? 'mobile' : 'in_shop';
const verifiedOrNotVerified = this.mainStore.isVerified ? 'verified' : 'not_verified';
const repairOrReplace = this.mainStore.isRepair ? 'repair' : 'replace';
@ -524,6 +528,35 @@ export default {
const recalibrationType = this.mainStore.lineItems.glassParts?.find((part) => part.requiresRecalibration)?.recalibrationType;
this.pushEventToGA(`recalibration_added_${coverageType}`, this.mainStore.vehicle.carId, `recal_type_${recalibrationType}`.replace(/ /g, '_').toLowerCase(), true);
}
const hasFrontWiper = this.mainStore.lineItems.vaps.some((part) => part.partType === partTypeStrings.FRONT_WIPER);
const hasRearWiper = this.mainStore.lineItems.vaps.some((part) => part.partType === partTypeStrings.REAR_WIPER);
const wiperEventLabel = `front_${hasFrontWiper ? 'advanced' : 'none'}_rear_${hasRearWiper ? 'advanced' : 'none'}`;
this.pushEventToGA('wipers', 'attached_to_order', wiperEventLabel, true);
},
handleAnalyticsEventsOnForwardButtonAction() {
this.pushEventToGA('order_summary', 'edit', 'contact_details', true);
let action;
let label;
switch (this.mainStore.coverageType) {
case coverageType.Deductible:
action = 'Covered';
label = this.mainStore.currentDeductible;
break;
case coverageType.ITAC:
action = 'ITAC';
label = this.mainStore.currentDeductible + "_" + getCartTotal(this.mainStore.order);
break;
case coverageType.NO_COMP:
action = 'NOCOMP';
label = 'Unverified';
break;
case coverageType.NONE:
action = 'Unverified';
label = 'Unverified';
break;
}
this.pushEventToGA('Submit Appointment', action, label, true, null, 1);
}
}
};