CSR-762 GA Cleanup

This commit is contained in:
Katie 2022-10-11 08:27:00 -04:00
parent 9b95effca5
commit 42eac1d08a
5 changed files with 27 additions and 52 deletions

View file

@ -25,6 +25,7 @@
<script>
import { useField } from "vee-validate";
import { toRef } from "vue";
import { queryStrings } from "@/constants/query-strings";
export default {
name: "base-input-button",
@ -60,7 +61,7 @@ export default {
},
isRequired: Boolean,
lastValuePushedToGa: [String, Number],
setLastValuePushedToGa: Function
setLastValuePushedToGa: Function,
},
data() {
return {
@ -79,7 +80,9 @@ export default {
case this.eventTypes.ENTER:
case this.eventTypes.CHANGE:
this.handleClick(e);
this.pushClickEventToGA(this.eventTypes.CLICK);
this.handlePushClickEventToGACheck(
this.eventTypes.CLICK
);
break;
}
} else {
@ -88,7 +91,9 @@ export default {
case this.eventTypes.ENTER:
case this.eventTypes.SPACE:
this.handleClick(e);
this.pushClickEventToGA(this.eventTypes.CLICK);
this.handlePushClickEventToGACheck(
this.eventTypes.CLICK
);
break;
case this.eventTypes.CHANGE:
this.selectOnKeypress
@ -121,9 +126,6 @@ export default {
this.handleSelectionChange(e);
this.$emit("inputButtonClicked", this.valueToEmit);
},
// onFocusCallbackForRoot() {
// this.pushClickEventToGA();
// },
handleFocus() {
this.$root.handleInputFocus({
groupName: this.groupName,
@ -132,25 +134,33 @@ export default {
handleBlur() {
this.$root.handleInputBlur({
groupName: this.groupName,
onFocusCallback: this.pushClickEventToGA,
onFocusCallback: this.handlePushClickEventToGACheck,
});
},
pushClickEventToGA(source) {
handlePushClickEventToGACheck(source) {
if (source === this.eventTypes.CLICK) {
console.log("------------------PUSHING 1: ", this.value);
this.setLastValuePushedToGa(this.value)
this.pushClickEventToGA();
} else {
if (
!this.isValueSelectedOnClick &&
this.isChecked &&
this.lastValuePushedToGa != this.value
) {
console.log("------------------PUSHING 2: ", this.value);
this.setLastValuePushedToGa(this.value)
this.pushClickEventToGA();
}
}
},
pushClickEventToGA(value) {
this.pushEventToGA(
this.$route.query[queryStrings.FMG_PAGE],
this.GaActions.CLICKED,
value?.toString() ?? this.value?.toString(),
true,
this.valueToLogType
);
this.setLastValuePushedToGa(this.value);
},
},
computed: {
isChecked() {

View file

@ -1,7 +1,6 @@
<template>
<button
@click="handleClick"
@focus="pushRadioClickEventIfNecessary"
class="back-button-wrapper"
:aria-label="backButtonAccessibleText"
>

View file

@ -61,39 +61,6 @@ export default {
state: serviceZipValidationResponse.data.state,
};
},
// pushRadioClickEventIfNecessary() {
// const {
// firedGaClickEventValues,
// currentlySelectedValues,
// lastFocusedInputGroup,
// wasLastFocusedInputMultiselect,
// } = this.$store.getters.gaClickInformation;
// // Keyboard navigation
// if (
// !wasLastFocusedInputMultiselect &&
// currentlySelectedValues[lastFocusedInputGroup] &&
// firedGaClickEventValues[lastFocusedInputGroup] !=
// currentlySelectedValues[lastFocusedInputGroup]
// ) {
// const value =
// currentlySelectedValues[lastFocusedInputGroup]?.toString();
// // this.dispatchStoreAction(
// // gaStoreActions.UPDATE_FIRED_GA_CLICK_EVENT_VALUES,
// // {
// // groupName: lastFocusedInputGroup,
// // value: value,
// // }
// // );
// this.pushEventToGA(
// this.$route.query[queryStrings.FMG_PAGE],
// this.GaActions.CLICKED,
// value,
// true
// );
// }
// },
},
computed: {
storeActions() {

View file

@ -7,7 +7,6 @@
isFloat ? 'float-end' : '',
isLoaderDisplayed ? 'has-loader' : '',
]"
@focus="pushRadioClickEventIfNecessary"
@click="clicked">
<span class="m-0">{{ this.buttonText }}</span>
<loader

View file

@ -1,9 +1,9 @@
<template>
<a v-if="linkType === 'navigation'" @click="handleClick" @focus="pushRadioClickEventIfNecessary" class="navigation-link" :href="href">{{text}}</a>
<a v-else-if="linkType === 'footer'" @click="handleClick" @focus="pushRadioClickEventIfNecessary" class="footer-link" :href="href" target="_blank">{{text}}</a>
<a v-else-if="linkType === 'textSmall'" @click="handleClick" @focus="pushRadioClickEventIfNecessary" class="small" :href="href">{{text}}</a>
<a v-else-if="linkType === 'dashedUnderline'" @click="handleClick" @focus="pushRadioClickEventIfNecessary" class="dashed-underline" :href="href">{{text}}</a>
<a v-else-if="linkType === 'text'" @click="handleClick" @focus="pushRadioClickEventIfNecessary" :href="href">{{text}}</a>
<a v-if="linkType === 'navigation'" @click="handleClick" class="navigation-link" :href="href">{{text}}</a>
<a v-else-if="linkType === 'footer'" @click="handleClick" class="footer-link" :href="href" target="_blank">{{text}}</a>
<a v-else-if="linkType === 'textSmall'" @click="handleClick" class="small" :href="href">{{text}}</a>
<a v-else-if="linkType === 'dashedUnderline'" @click="handleClick" class="dashed-underline" :href="href">{{text}}</a>
<a v-else-if="linkType === 'text'" @click="handleClick" :href="href">{{text}}</a>
</template>
<script>