Merge pull request #1193 from Safelite/feature/jzimmerman/INSR-9277

INSR-9277: Added missing GA events from ISS Hertiage
This commit is contained in:
Jeremy-Z 2026-04-21 16:28:27 -04:00 committed by GitHub
commit f9d0f29a1c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 60 additions and 33 deletions

View file

@ -28,6 +28,20 @@ export function getServiceLineItems(order) {
]; ];
} }
/**
* Returns an array containing only the
* @param {object} order order object
* @returns {[]} array of service line items
*/
export function getAvailableLineItems(order) {
const { glassParts, supportingItems } = getLineItems(order);
const availableLineItems = [
...(glassParts ?? []),
...(supportingItems ?? [])
];
return availableLineItems;
}
/** /**
* Returns an array containing only the non-service line items (Vaps and Fees) * Returns an array containing only the non-service line items (Vaps and Fees)
* @param {object} order order object * @param {object} order order object

View file

@ -145,6 +145,7 @@ import widgetFields from '@/constants/cms-widget-fields.js';
import { formatAmountInDollars, createUnorderedListFromStringOfParagraphs, createOrderedListFromStringOfParagraphs } from '@/helpers/text-helper.js'; import { formatAmountInDollars, createUnorderedListFromStringOfParagraphs, createOrderedListFromStringOfParagraphs } from '@/helpers/text-helper.js';
import showIssLoadingModal from '@/helpers/loading-modal-helper'; import showIssLoadingModal from '@/helpers/loading-modal-helper';
import { getPriceOfLineItems } from '@/helpers/price-calculator'; import { getPriceOfLineItems } from '@/helpers/price-calculator';
import { getAvailableLineItems } from '@/helpers/cart-helper';
import coverageStatuses from '@/constants/coverage-statuses'; import coverageStatuses from '@/constants/coverage-statuses';
import coverageType from '@/constants/coverage-type'; import coverageType from '@/constants/coverage-type';
import oemEndorsementModal from '@/layouts/coverage-statement/oem-endorsement-modal/oem-endorsement-modal.vue'; import oemEndorsementModal from '@/layouts/coverage-statement/oem-endorsement-modal/oem-endorsement-modal.vue';
@ -470,11 +471,7 @@ export default {
this.isPageLoading = false; this.isPageLoading = false;
}, },
async getPricedParts() { async getPricedParts() {
const { glassParts, supportingItems } = this.mainStore.order.lineItems; const availableLineItems = getAvailableLineItems(this.mainStore.order);
const availableLineItems = [
...(glassParts ?? []),
...(supportingItems ?? [])
];
// We only call the ITAC pricing endpoint if we are not repair or we are NoComp // We only call the ITAC pricing endpoint if we are not repair or we are NoComp
if (!this.isRepair || this.mainStore.isNoComp) { if (!this.isRepair || this.mainStore.isNoComp) {
@ -494,6 +491,7 @@ export default {
this.navigateWithScenario(navigationScenarios.CLICKED_FORWARD); this.navigateWithScenario(navigationScenarios.CLICKED_FORWARD);
} else if (this.isITACQuoteVisible || this.isNoCompQuoteVisible) { } else if (this.isITACQuoteVisible || this.isNoCompQuoteVisible) {
this.mainStore.updateIsSafeliteProvider(true); this.mainStore.updateIsSafeliteProvider(true);
this.pushEventToGA('ShopSelection', 'Safelite', this.mainStore.currentDeductible + `_` + getPriceOfLineItems(getAvailableLineItems(this.mainStore.order)), true);
this.navigateWithScenario(navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE); this.navigateWithScenario(navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE);
} else { } else {
this.$router.navigateBailout(bailoutMessage.coverageStatementInvalidState()); this.$router.navigateBailout(bailoutMessage.coverageStatementInvalidState());

View file

@ -665,7 +665,7 @@ export default {
// TODO: Check if we're coming from SFA and add relevant events // TODO: Check if we're coming from SFA and add relevant events
// eslint-disable-next-line // eslint-disable-next-line
if (false) { if (false) {
this.pushEventToGA('visitor_info_confirmation', 'referring_site', 'SFA', null); this.pushEventToGA('visitor_info_confirmation', 'referring_site', 'SFA', true);
} }
else { else {
this.pushEventToGA('visitor_info_confirmation', 'referring_site', 'ClientSite', true); this.pushEventToGA('visitor_info_confirmation', 'referring_site', 'ClientSite', true);

View file

@ -201,6 +201,7 @@ export default {
policyVehicleId: vehicle.id, policyVehicleId: vehicle.id,
vin: this.selectedVehicleVin vin: this.selectedVehicleVin
}); });
useMainStore().updateVehicleCoverage({ useMainStore().updateVehicleCoverage({
noCoverage: this.noCoverageForSelectedVehicle, noCoverage: this.noCoverageForSelectedVehicle,
deductible: this.deductibleForSelectedVehicle, deductible: this.deductibleForSelectedVehicle,
@ -208,6 +209,9 @@ export default {
endorsements: this.endorsementsForSelectedVehicle, endorsements: this.endorsementsForSelectedVehicle,
cvrgEndorsementCode: this.endorsementCodesForSelectedVehicle cvrgEndorsementCode: this.endorsementCodesForSelectedVehicle
}); });
this.pushEventToGA("policy_vehicle", "submitted", useMainStore().order.vehicle.make + "_" + useMainStore().order.vehicle.model + " " + useMainStore().order.vehicle.carId, true);
this.navigateForward(); this.navigateForward();
} catch (e) { } catch (e) {
if (e.isAxiosError && e.status === 404) { if (e.isAxiosError && e.status === 404) {
@ -223,6 +227,9 @@ export default {
vin: vehicle.vin vin: vehicle.vin
}); });
this.policyVinFound = false; this.policyVinFound = false;
this.pushEventToGA("policy_vehicle", "submitted", useMainStore().order.vehicle.make + "_" + useMainStore().order.vehicle.model + " " + useMainStore().order.vehicle.carId, true);
this.navigateForward(); this.navigateForward();
return; return;
} }

View file

@ -67,6 +67,8 @@ import showIssLoadingModal from '@/helpers/loading-modal-helper';
import bailoutMessage from '@/constants/bailoutMessage'; import bailoutMessage from '@/constants/bailoutMessage';
import baseFormMixin from '@/mixins/base-form-mixin'; import baseFormMixin from '@/mixins/base-form-mixin';
import PROVIDER_PREFERENCE_OPTIONS from '@/constants/provider-preference'; import PROVIDER_PREFERENCE_OPTIONS from '@/constants/provider-preference';
import { getPriceOfLineItems } from '@/helpers/price-calculator';
import { getAvailableLineItems } from '@/helpers/cart-helper';
// Import Component // Import Component
import { Form } from 'vee-validate'; import { Form } from 'vee-validate';
@ -159,12 +161,14 @@ export default {
this.mainStore.updateIsSafeliteProvider(true); this.mainStore.updateIsSafeliteProvider(true);
const scenario = this.navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE; const scenario = this.navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE;
this.pushEventToGA('prefered_provider', 'Safelite', this.mainStore.accountNameForEvents, true); this.pushEventToGA('prefered_provider', 'Safelite', this.mainStore.accountNameForEvents, true);
this.pushEventToGA('ShopSelection', 'Safelite', this.mainStore.currentDeductible + `_` + getPriceOfLineItems(getAvailableLineItems(this.mainStore.order)), true);
this.navigateForward(scenario); this.navigateForward(scenario);
}, },
scheduleWithTPA() { scheduleWithTPA() {
this.mainStore.updateIsSafeliteProvider(false); this.mainStore.updateIsSafeliteProvider(false);
const scenario = this.navigationScenarios.CLICKED_FORWARD_WITH_TPA_ENABLED; const scenario = this.navigationScenarios.CLICKED_FORWARD_WITH_TPA_ENABLED;
this.pushEventToGA('prefered_provider', 'TPA', this.mainStore.accountNameForEvents, true); this.pushEventToGA('prefered_provider', 'TPA', this.mainStore.accountNameForEvents, true);
this.pushEventToGA('ShopSelection', 'Other', this.mainStore.currentDeductible + `_` + getPriceOfLineItems(getAvailableLineItems(this.mainStore.order)), true);
this.navigateForward(scenario); this.navigateForward(scenario);
}, },
findAnotherShopClicked() { findAnotherShopClicked() {

View file

@ -961,12 +961,9 @@ export default {
} }
this.pushEventToGA('appointment', 'availability_mobile', `days_out_${dateDiffString}`, true, null, null); this.pushEventToGA('appointment', 'availability_mobile', `days_out_${dateDiffString}`, true, null, null);
}, },
pushServiceTypeEvent() { pushServiceTypeEvent() {
if (this.selectedAppointmentType) { if (this.selectedAppointmentType) {
const gaScheduleType = { this.pushEventToGA('appointment', 'service_type', this.selectedAppointmentType.toLowerCase(), true, null, null);
['service_type']: this.selectedAppointmentType.toLowerCase()
};
this.pushGenericObjectToGA(gaScheduleType);
} }
}, },
async refreshDatePicker() { async refreshDatePicker() {

View file

@ -270,17 +270,17 @@ export default {
this.mainStore.applicationUser.firstHit = false; this.mainStore.applicationUser.firstHit = false;
} }
// TODO: Check if we're coming from SFA // TODO: Check if we're coming from SFA - site does not support SFA yet, add this back when it is enabled.
// eslint-disable-next-line // eslint-disable-next-line
if (false) { if (false) {
this.pushEventToGA("co_branded", "welcome_clicked_cta", "yes_clicked", 0); this.pushEventToGA("co_branded", "welcome_clicked_cta", "yes_clicked", true, null, '0');
this.pushEventToGA("visitor_info_welcome", "referring_site", "SFA", null); this.pushEventToGA("visitor_info_welcome", "referring_site", "SFA", true);
} }
else { else {
this.pushEventToGA("visitor_info_welcome", "referring_site", "ClientSite", null); this.pushEventToGA("visitor_info_welcome", "referring_site", "ClientSite", true);
} }
this.pushEventToGA("visitor_info_welcome", "client_name", this.mainStore.accountNameForEvents, null); this.pushEventToGA("visitor_info_welcome", "client_name", this.mainStore.accountNameForEvents, true);
}, },
computed: { computed: {
DamageCauseOptions() { DamageCauseOptions() {
@ -358,6 +358,18 @@ export default {
} }
promises.push(this.mainStore.getCoveragePolicyInfo()); promises.push(this.mainStore.getCoveragePolicyInfo());
await Promise.all(promises); await Promise.all(promises);
this.pushEventToGA("policy_search", "policy_found", this.mainStore.isPolicyLookupSuccessful ? "Yes" : "No", true);
if ( this.mainStore.isPolicyLookupSuccessful) {
this.pushEventToGA("zip_validation", "success", "N/A", true);
}
else {
if ( this.mainStore.order.policy.policyLookupErrorCode === 2) {
this.pushEventToGA("zip_validation", "fail", "N/A", true);
}
}
await saveSession({ shouldAwaitSaveSessionQueue: true, bailoutOnError: true }) await saveSession({ shouldAwaitSaveSessionQueue: true, bailoutOnError: true })
this.navigateForward(); this.navigateForward();
}, },

View file

@ -20,7 +20,8 @@ import {
GaEvents, GaEvents,
ValueToLogTypes ValueToLogTypes
} from '@/constants/analytics'; } from '@/constants/analytics';
import { getCartTotal, getSubtotal } from '@/helpers/cart-helper'; import { getPriceOfLineItems } from '@/helpers/price-calculator';
import { getAvailableLineItems, getCartTotal, getSubtotal } from '@/helpers/cart-helper';
import { getRecalPartNumbers, isRecalOrder } from "@/helpers/recal-helper"; import { getRecalPartNumbers, isRecalOrder } from "@/helpers/recal-helper";
import coverageStatuses from '@/constants/coverage-statuses'; import coverageStatuses from '@/constants/coverage-statuses';
import coverageType from '@/constants/coverage-type'; import coverageType from '@/constants/coverage-type';
@ -128,15 +129,6 @@ export default {
this.logPageView(analyticsPageEvents.ENTRY); this.logPageView(analyticsPageEvents.ENTRY);
}, },
pushValueToGA() {
const gaServiceType = {
['service_type']: useMainStore().order?.serviceLocation?.appointmentType?.toLowerCase()
};
if (gaServiceType && gaServiceType['service_type']) {
this.pushGenericObjectToGA(gaServiceType);
}
},
pushOrderToDataLayer() { pushOrderToDataLayer() {
// helper check for if an object is defined (but maybe falsey) // helper check for if an object is defined (but maybe falsey)
const isDefined = (x) => x !== null && x !== undefined; const isDefined = (x) => x !== null && x !== undefined;
@ -282,7 +274,7 @@ export default {
payload.priceTotal = ""; payload.priceTotal = "";
// ITAC or NoComp (where cash price is shown) // ITAC or NoComp (where cash price is shown)
} else if (store.isVerified && (store.isITAC || store.isNoComp)) { } else if (store.isVerified && (store.isITAC || store.isNoComp)) {
const subtotal = getSubtotal(order).toFixed(2); const subtotal = getPriceOfLineItems(getAvailableLineItems(order)).toFixed(2);
payload.priceSubTotal = parseFloat(subtotal); payload.priceSubTotal = parseFloat(subtotal);
const total = getCartTotal(order).toFixed(2); const total = getCartTotal(order).toFixed(2);
payload.priceTotal = parseFloat(total); payload.priceTotal = parseFloat(total);
@ -292,7 +284,7 @@ export default {
} }
// Cash Quote or Cash Price Sub Total // Cash Quote or Cash Price Sub Total
payload.cashPriceSubTotal = getSubtotal(order).toString(); payload.cashPriceSubTotal = getPriceOfLineItems(getAvailableLineItems(order)).toString();
// Recalibration // Recalibration
payload.isRecalibrationOnOrder = isRecalOrder(order.lineItems); payload.isRecalibrationOnOrder = isRecalOrder(order.lineItems);

View file

@ -190,9 +190,6 @@ router.afterEach(async (to, from) => {
// Push experiments to Data Layer // Push experiments to Data Layer
analyticsMixin.methods.pushExperimentsToDataLayer(); analyticsMixin.methods.pushExperimentsToDataLayer();
// Push values to GA
analyticsMixin.methods.pushValueToGA();
// Push current order status to Data Layer // Push current order status to Data Layer
analyticsMixin.methods.pushOrderToDataLayer(); analyticsMixin.methods.pushOrderToDataLayer();
} }

View file

@ -112,7 +112,8 @@ export const getDefaultState = () => ({
endorsementQuestionAnswers: [], endorsementQuestionAnswers: [],
cvrgEndorsementCode: null, cvrgEndorsementCode: null,
status: null, status: null,
policyData: null policyData: null,
policyLookupErrorCode: 0
}, },
customer: { customer: {
address: { address: {
@ -451,7 +452,7 @@ export const useMainStore = defineStore({
.reduce((r, c) => Object.assign(r, c), {}) ?? {}, .reduce((r, c) => Object.assign(r, c), {}) ?? {},
originalDeductible: (state) => (state.order.damage.isRepair ? state.order.originalDeductible.repair : state.order.originalDeductible.replace), originalDeductible: (state) => (state.order.damage.isRepair ? state.order.originalDeductible.repair : state.order.originalDeductible.replace),
currentDeductible: (state) => (state.order.damage.isRepair ? state.order.currentDeductible.repair : state.order.currentDeductible.replace), currentDeductible: (state) => (state.order.damage.isRepair ? state.order.currentDeductible.repair : state.order.currentDeductible.replace),
accountNameForEvents: (state) => state.issConfig.clientName.replaceAll(" ", "").replaceAll("&", "amp") accountNameForEvents: (state) => state.issConfig.clientName
}, },
actions: actions:
{ {
@ -561,6 +562,7 @@ export const useMainStore = defineStore({
console.log(`Coverage lookup attempt #${this.applicationUser.coverageAttempts}. Max attempts allowed: 10.`); console.log(`Coverage lookup attempt #${this.applicationUser.coverageAttempts}. Max attempts allowed: 10.`);
try { try {
order.policy.policyLookupErrorCode = 0;
const response = await globalMethods.callHttpClient({ const response = await globalMethods.callHttpClient({
method: endpoints.CoveragePolicyInfo.method, method: endpoints.CoveragePolicyInfo.method,
endpoint: endpoints.CoveragePolicyInfo.url, endpoint: endpoints.CoveragePolicyInfo.url,
@ -598,6 +600,9 @@ export const useMainStore = defineStore({
// populate vehicles // populate vehicles
order.policy.vehicles = responsePolicy.vehicles ?? []; order.policy.vehicles = responsePolicy.vehicles ?? [];
} else { } else {
if ( response?.data?.isError) {
order.policy.policyLookupErrorCode = response?.data?.errorCode;
}
this.updateCoverageType(coverageType.NONE); this.updateCoverageType(coverageType.NONE);
} }
} catch (e) { } catch (e) {
@ -2119,6 +2124,7 @@ export const useMainStore = defineStore({
this.order.policy.endorsementQuestionAnswers = []; this.order.policy.endorsementQuestionAnswers = [];
this.order.policy.cvrgEndorsementCode = null; this.order.policy.cvrgEndorsementCode = null;
this.order.policy.policyData = null; this.order.policy.policyData = null;
this.order.policy.policyLookupErrorCode = 0;
this.order.policy.deductible.repair = null; this.order.policy.deductible.repair = null;
this.order.policy.deductible.replace = null; this.order.policy.deductible.replace = null;
}, },