Merge pull request #440 from Safelite/feature/CSR-33-V2

ga event defect
This commit is contained in:
DonielleAtSafelite 2022-05-19 09:36:10 -04:00 committed by GitHub
commit f70154c62a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 37 additions and 7 deletions

View file

@ -26,6 +26,7 @@ const GaLabels = {
ERROR: 'Error', ERROR: 'Error',
LICENSE_PLATE_LOOKUP: 'License_Plate_Look_Up', LICENSE_PLATE_LOOKUP: 'License_Plate_Look_Up',
VIN_LOOKUP: 'Vin_Look_Up', VIN_LOOKUP: 'Vin_Look_Up',
ADDRESS_LOOKUP: 'Address_Look_up',
}; };

View file

@ -150,6 +150,16 @@ export default {
this.$route this.$route
); );
}, },
attachCustomEvents() {
this.prependActionToMethod(this, this.forwardButtonAction, () => {
this.pushEventToGA(
this.$route.query[this.queryStrings.FMG_PAGE],
this.GaActions.SUBMITTED,
this.GaLabels.ADDRESS_LOOKUP,
true
);
});
},
getRegistrationAddressFromStore() { getRegistrationAddressFromStore() {
return store.getters.vehicle.registration.address; return store.getters.vehicle.registration.address;
}, },
@ -356,6 +366,9 @@ export default {
} }
} }
}, },
mounted() {
this.attachCustomEvents();
},
computed: { computed: {
AlertNonServiceableZipHeader(){ AlertNonServiceableZipHeader(){
const zipCode = this.serviceZipCode ? this.serviceZipCode : this.customerQuestions.addressQuestions.zipCode; const zipCode = this.serviceZipCode ? this.serviceZipCode : this.customerQuestions.addressQuestions.zipCode;

View file

@ -86,7 +86,6 @@ describe("license-plate-lookup.vue", () => {
//Assert //Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
}); });
}); });

View file

@ -229,12 +229,12 @@ export default {
}, },
attachCustomEvents() { attachCustomEvents() {
this.prependActionToMethod(this, this.forwardButtonAction, () => { this.prependActionToMethod(this, this.forwardButtonAction, () => {
this.pushEventToGA( this.pushEventToGA(
this.$route.query[this.queryStrings.FMG_PAGE], this.$route.query[this.queryStrings.FMG_PAGE],
this.GaActions.SUBMITTED, this.GaActions.SUBMITTED,
this.GaLabels.LICENSE_PLATE_LOOKUP, this.GaLabels.LICENSE_PLATE_LOOKUP,
true true
); );
}); });
}, },
getLicensePlateFromStore() { getLicensePlateFromStore() {

View file

@ -200,6 +200,9 @@ export default {
vinPopulatedOnPageLoad: this.getVinFromStore()?.length > 0, vinPopulatedOnPageLoad: this.getVinFromStore()?.length > 0,
}; };
}, },
mounted() {
this.attachCustomEvents();
},
watch: { watch: {
vin() { vin() {
this.$refs.funnelFooter.updateButtonText( this.$refs.funnelFooter.updateButtonText(
@ -277,7 +280,7 @@ export default {
this.pushEventToGA( this.pushEventToGA(
this.$route.query[this.queryStrings.FMG_PAGE], this.$route.query[this.queryStrings.FMG_PAGE],
this.GaActions.SUBMITTED, this.GaActions.SUBMITTED,
this.GaLabels.VINLOOKUP, this.GaLabels.VIN_LOOKUP,
true true
); );
}); });

View file

@ -97,8 +97,9 @@ export default {
}, },
prependActionToMethod(object, method, actionToPrepend) { prependActionToMethod(object, method, actionToPrepend) {
const baseMethod = object[method.name]; const baseMethodName = method.name.startsWith('bound ') ? method.name.substring(6) : method.name ;
object[method.name] = function () { const baseMethod = object[baseMethodName];
object[baseMethodName] = function () {
actionToPrepend.apply(this, arguments); actionToPrepend.apply(this, arguments);
return baseMethod.apply(object, arguments); return baseMethod.apply(object, arguments);
}; };

View file

@ -107,4 +107,17 @@ describe("analyticsMixin.js", () => {
}]); }]);
}); });
test("Obj is not null after action prepended", () => {
//Arrange
const obj = {baseMethodName:"testMethodName", data:"testData"};
const method = {name:"testMethodName", data:"testData" }
const action = "testAction";
//Act
analyticsMixin.methods.prependActionToMethod(obj, method, action);
//Assert
expect(obj!=null);
});
}); });