From b1e14f80df2d2ea2c6b7d13f832a165d9c4e2142 Mon Sep 17 00:00:00 2001 From: Donielle Austin Date: Wed, 18 May 2022 08:43:06 -0400 Subject: [PATCH] ga event defect --- src/layouts/address-lookup/address-lookup.vue | 9 ++++----- .../license-plate-lookup/license-plate-lookup.vue | 7 +++---- src/layouts/vin-lookup/vin-lookup.vue | 7 +++---- src/mixins/analytics-mixin.js | 9 +++++++-- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index 87278476a..cebc7e414 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -153,16 +153,15 @@ export default { ); }, attachCustomEvents() { - this.prependActionToMethod(this, this.forwardButtonAction, this.logGAEventForVin()); - }, - logGAEventForVin(){ + this.prependActionToMethod(this, this.forwardButtonAction, () => { this.pushEventToGA( this.$route.query[this.queryStrings.FMG_PAGE], this.GaActions.SUBMITTED, this.GaLabels.ADDRESS_LOOKUP, true - ); - }, + ); + }); + }, getRegistrationAddressFromStore() { return store.getters.vehicle.registration.address; }, diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.vue b/src/layouts/license-plate-lookup/license-plate-lookup.vue index 13f50ecc4..e76f05435 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.vue +++ b/src/layouts/license-plate-lookup/license-plate-lookup.vue @@ -187,15 +187,14 @@ export default { store.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES); }, attachCustomEvents() { - this.prependActionToMethod(this, this.forwardButtonAction, this.logGAEventForVin()); - }, - logGAEventForVin(){ + this.prependActionToMethod(this, this.forwardButtonAction, () => { this.pushEventToGA( this.$route.query[this.queryStrings.FMG_PAGE], this.GaActions.SUBMITTED, this.GaLabels.LICENSE_PLATE_LOOKUP, true - ); + ); + }); }, getLicensePlateFromStore() { return store.getters.vehicle.registration.licensePlate; diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index 4dc1f6382..1ef501829 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -259,15 +259,14 @@ export default { return store.getters.order.serviceLocation.zipCode; }, attachCustomEvents() { - this.prependActionToMethod(this, this.forwardButtonAction, this.logGAEventForVin()); - }, - logGAEventForVin(){ - this.pushEventToGA( + this.prependActionToMethod(this, this.forwardButtonAction, () => { + this.pushEventToGA( this.$route.query[this.queryStrings.FMG_PAGE], this.GaActions.SUBMITTED, this.GaLabels.VIN_LOOKUP, true ); + }); }, backButtonAction() { this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route); diff --git a/src/mixins/analytics-mixin.js b/src/mixins/analytics-mixin.js index d13e1b222..926c4764c 100644 --- a/src/mixins/analytics-mixin.js +++ b/src/mixins/analytics-mixin.js @@ -97,8 +97,13 @@ export default { }, prependActionToMethod(object, method, actionToPrepend) { - const baseMethod = object[method.name]; - object[method.name] = function () { + var baseMethod = object[method.name]; + if(method.name.startsWith('bound ')){ + baseMethod = method.name.substring(6); + }else{ + baseMethod = object[method.name]; + } + object[method.name.substring(6)] = function () { actionToPrepend.apply(this, arguments); return baseMethod.apply(object, arguments); };