From 7f565fb8cf654bcb49f498c39fb11ec5c51ac4ff Mon Sep 17 00:00:00 2001 From: Alex Humphries Date: Tue, 24 Mar 2026 17:15:15 -0400 Subject: [PATCH 1/2] INSR-8878/9031: Add analytics events on welcome-page and contact-details --- .../continue-modal/continue-modal.vue | 6 +++ .../contact-details/contact-details.vue | 4 ++ src/layouts/welcome-page/welcome-page.vue | 46 +++++++++++++++++++ src/store/index.js | 3 +- 4 files changed, 58 insertions(+), 1 deletion(-) diff --git a/src/iss-components/continue-modal/continue-modal.vue b/src/iss-components/continue-modal/continue-modal.vue index def01d34..062cb86b 100644 --- a/src/iss-components/continue-modal/continue-modal.vue +++ b/src/iss-components/continue-modal/continue-modal.vue @@ -64,10 +64,14 @@ export default { modalSubHeaderText() { return this.getCmsContent('ContinueReferralModalWidget', 'SubheaderText') .replaceAll('{custom:mmFound}', this.getMakeModelString.toUpperCase()); + }, + accountName() { + return this.mainStore.issConfig.clientName.replaceAll(" ", "").replaceAll("&", "amp"); } }, methods: { openModal() { + this.pushEventToGA("existing_claim", "pop_up_displayed", this.accountName, true); this.$refs.continueModal.openModal(); }, setModalStatus(isOpened) { @@ -77,9 +81,11 @@ export default { this.$refs.continueModal.closeModal(); }, continueReferral() { + this.pushEventToGA("existing_claim", "finish_claim", this.accountName, true); this.$emit('continue-previous-referral'); }, startNewReferral() { + this.pushEventToGA("existing_claim", "start_new_claim", this.accountName, true); this.$emit('start-new-referral'); } } diff --git a/src/layouts/contact-details/contact-details.vue b/src/layouts/contact-details/contact-details.vue index b73d3fc4..a5c0c646 100644 --- a/src/layouts/contact-details/contact-details.vue +++ b/src/layouts/contact-details/contact-details.vue @@ -230,11 +230,15 @@ export default { }, watch: { isSameAsPolicyAddress(newValue) { + this.pushEventToGA("mobile_location", "same_as_policy_address", newValue ? "checked" : "unchecked", true); if (newValue) { this.copyPolicyAddressToServiceLocation(); } else { this.clearAddressFields(); } + }, + isVehicleProtected(newValue) { + this.pushEventToGA("mobile_location", "is_vehicle_protected", newValue, true); } }, methods: { diff --git a/src/layouts/welcome-page/welcome-page.vue b/src/layouts/welcome-page/welcome-page.vue index 92d8dd10..11584f52 100644 --- a/src/layouts/welcome-page/welcome-page.vue +++ b/src/layouts/welcome-page/welcome-page.vue @@ -68,6 +68,7 @@ :options="DamageCauseOptions" disableAutoFill :validationRules="rules.damageOption" + isRequired placeHolderText="Select an option" class="form-group" /> { + const requiredFieldCount = document.querySelectorAll('[aria-required="true"]').length; + this.pushEventToGA("policy_info", "required_fields", requiredFieldCount.toString(), true); + }); + + this.mainStore.applicationUser.firstHit = false; + } + + // TODO: Check if we're coming from SFA + // eslint-disable-next-line + if (false) { + this.pushEventToGA("co_branded", "welcome_clicked_cta", "yes_clicked", 0); + this.pushEventToGA("visitor_info_welcome", "referring_site", "SFA", null); + } + else { + this.pushEventToGA("visitor_info_welcome", "referring_site", "ClientSite", null); + } + + this.pushEventToGA("visitor_info_welcome", "client_name", this.accountName, null); + }, computed: { DamageCauseOptions() { const damageCauseAnswers = this.getCmsContent( @@ -300,6 +329,9 @@ export default { }, phoneMask() { return MaskaFormattedMasks.PHONE_NUMBER; + }, + accountName() { + return this.mainStore.issConfig.clientName.replaceAll(" ", "").replaceAll("&", "amp"); } }, methods: { @@ -460,6 +492,20 @@ export default { this.answeredContinueModal = true; this.$refs.continueModal.closeModal(); } + }, + watch: { + 'welcomePageModel.policyZipCode': { + handler: async function (newZip) { + if (newZip.length === 5) { + this.pushEventToGA("policy_info", "policy_zip", newZip, true); + } + } + }, + 'welcomePageModel.damageCause': function (newCause) { + if (newCause) { + this.pushEventToGA("policy_info", "cause_of_loss", newCause, true); + } + } } }; diff --git a/src/store/index.js b/src/store/index.js index 4321a8f4..305ba605 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -238,7 +238,8 @@ export const getDefaultState = () => ({ triggeredSiteEntry: false, // TODO not in save session duplicateOrders: [], hasSentSaveQuoteEmail: null, - coverageLookupAttempts: 0 + coverageLookupAttempts: 0, + firstHit: true }, issConfig: { clientName: 'Generic Insurance', // this is the default and will be overriden by the client's name From 6acefcb307e3abef0629057e6e642b09e76f52e3 Mon Sep 17 00:00:00 2001 From: Alex Humphries Date: Tue, 24 Mar 2026 17:28:26 -0400 Subject: [PATCH 2/2] Move accountName logic to store getter, better required field search --- src/iss-components/continue-modal/continue-modal.vue | 9 +++------ src/layouts/welcome-page/welcome-page.vue | 8 +++----- src/store/index.js | 3 ++- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/iss-components/continue-modal/continue-modal.vue b/src/iss-components/continue-modal/continue-modal.vue index 062cb86b..8bca85ce 100644 --- a/src/iss-components/continue-modal/continue-modal.vue +++ b/src/iss-components/continue-modal/continue-modal.vue @@ -64,14 +64,11 @@ export default { modalSubHeaderText() { return this.getCmsContent('ContinueReferralModalWidget', 'SubheaderText') .replaceAll('{custom:mmFound}', this.getMakeModelString.toUpperCase()); - }, - accountName() { - return this.mainStore.issConfig.clientName.replaceAll(" ", "").replaceAll("&", "amp"); } }, methods: { openModal() { - this.pushEventToGA("existing_claim", "pop_up_displayed", this.accountName, true); + this.pushEventToGA("existing_claim", "pop_up_displayed", this.mainStore.accountNameForEvents, true); this.$refs.continueModal.openModal(); }, setModalStatus(isOpened) { @@ -81,11 +78,11 @@ export default { this.$refs.continueModal.closeModal(); }, continueReferral() { - this.pushEventToGA("existing_claim", "finish_claim", this.accountName, true); + this.pushEventToGA("existing_claim", "finish_claim", this.mainStore.accountNameForEvents, true); this.$emit('continue-previous-referral'); }, startNewReferral() { - this.pushEventToGA("existing_claim", "start_new_claim", this.accountName, true); + this.pushEventToGA("existing_claim", "start_new_claim", this.mainStore.accountNameForEvents, true); this.$emit('start-new-referral'); } } diff --git a/src/layouts/welcome-page/welcome-page.vue b/src/layouts/welcome-page/welcome-page.vue index 11584f52..2b80ca23 100644 --- a/src/layouts/welcome-page/welcome-page.vue +++ b/src/layouts/welcome-page/welcome-page.vue @@ -262,7 +262,8 @@ export default { this.pushEventToGA("policy_info", "info_prefilled", isInfoPrefilled.toString(), true); this.$nextTick(() => { - const requiredFieldCount = document.querySelectorAll('[aria-required="true"]').length; + const formRoot = this.$el; + const requiredFieldCount = formRoot.querySelectorAll('[aria-required="true"]').length; this.pushEventToGA("policy_info", "required_fields", requiredFieldCount.toString(), true); }); @@ -279,7 +280,7 @@ export default { this.pushEventToGA("visitor_info_welcome", "referring_site", "ClientSite", null); } - this.pushEventToGA("visitor_info_welcome", "client_name", this.accountName, null); + this.pushEventToGA("visitor_info_welcome", "client_name", this.mainStore.accountNameForEvents, null); }, computed: { DamageCauseOptions() { @@ -329,9 +330,6 @@ export default { }, phoneMask() { return MaskaFormattedMasks.PHONE_NUMBER; - }, - accountName() { - return this.mainStore.issConfig.clientName.replaceAll(" ", "").replaceAll("&", "amp"); } }, methods: { diff --git a/src/store/index.js b/src/store/index.js index 305ba605..dc5c549f 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -445,7 +445,8 @@ export const useMainStore = defineStore({ .map((x) => x.settings) .reduce((r, c) => Object.assign(r, c), {}) ?? {}, 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") }, actions: {