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

View file

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

View file

@ -61,39 +61,6 @@ export default {
state: serviceZipValidationResponse.data.state, 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: { computed: {
storeActions() { storeActions() {

View file

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

View file

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