CSR-762 GA WIP

This commit is contained in:
Katie 2022-10-05 15:17:36 -04:00
parent 7cdb291641
commit bef4baf91b
2 changed files with 38 additions and 30 deletions

View file

@ -79,7 +79,7 @@ export default {
CLICK: "click",
};
console.log("Handling: ", eventType)
// console.log("Handling: ", eventType)
if (this.isMultiSelect) {
switch (eventType) {
@ -98,6 +98,8 @@ export default {
} else {
switch (eventType) {
case eventTypes.CLICK: // TODO KO pushClickEventToGa?
this.pushClickEventToGA();
// fallthrough
case eventTypes.ENTER:
case eventTypes.SPACE:
this.handleClick(e);
@ -141,6 +143,7 @@ export default {
handleClick(e) {
this.handleSelectionChange(e);
// console.log("addEventToBus: ", this.value?.toString())
eventBus.readAndPopEventFromBus("GA", "click")
eventBus.addEventToBus("GA", "click", {
category: this.$route.query[queryStrings.FMG_PAGE],
action: this.GaActions.CLICKED,
@ -150,25 +153,26 @@ export default {
});
this.$emit("inputButtonClicked", this.valueToEmit);
},
// pushClickEventToGA(value) {
// const lastFocusedInputGroup =
// this.$store.getters.gaClickInformation.lastFocusedInputGroup;
// // this.disA MKJ `,,.patchStoreAction(
// // gaStoreActions.UPDATE_FIRED_GA_CLICK_EVENT_VALUES,
// // {
// // groupName: lastFocusedInputGroup,
// // value: value ?? this.value,
// // },
// // );
pushClickEventToGA(value) {
// const lastFocusedInputGroup =
// this.$store.getters.gaClickInformation.lastFocusedInputGroup;
// this.dispatchStoreAction(
// gaStoreActions.UPDATE_FIRED_GA_CLICK_EVENT_VALUES,
// {
// groupName: lastFocusedInputGroup,
// value: value ?? this.value,
// },
// );
// // this.pushEventToGA(
// // this.$route.query[queryStrings.FMG_PAGE],
// // this.GaActions.CLICKED,
// // value?.toString() ?? this.value?.toString(),
// // true,
// // this.valueToLogType
// // );
// },
console.log("BIB")
this.pushEventToGA(
this.$route.query[queryStrings.FMG_PAGE],
this.GaActions.CLICKED,
value?.toString() ?? this.value?.toString(),
true,
this.valueToLogType
);
},
// handleBlur() {
// // this.dispatchStoreAction(
// // gaStoreActions.UPDATE_LAST_FOCUSED_INPUT_GROUP,

View file

@ -13,7 +13,6 @@
</div>
<div class="w-100 d-flex justify-content-center">
<fieldset
class="w-100"
:aria-required="isRequired"
@ -230,7 +229,9 @@ export default {
handleAnswerChange(primaryAnswerValue) {
this.primaryValue = primaryAnswerValue;
this.pushClickEventToGA(primaryAnswerValue);
if (this.isValueSelectedOnClick) {
this.pushClickEventToGA();
}
this.$emit("buttonQuestionChange", primaryAnswerValue);
this.$emit("update:modelValue", primaryAnswerValue);
@ -239,13 +240,18 @@ export default {
// const valueToPushToGa =
// value?.toString() ?? this.primaryValue?.toString();
const event = eventBus.readAndPopEventFromBus("GA", "click")
const valueToPushToGa = event.label;
console.log({
valueToPushToGa,
lastPushedGaEventValue: this.lastPushedGaEventValue,
});
if (valueToPushToGa && valueToPushToGa !== this.lastPushedGaEventValue) {
// console.log("pushing")
const event = eventBus.readAndPopEventFromBus("GA", "click");
const valueToPushToGa = event?.label;
// console.log({
// valueToPushToGa,
// lastPushedGaEventValue: this.lastPushedGaEventValue,
// });
if (
(valueToPushToGa &&
valueToPushToGa !== this.lastPushedGaEventValue) ||
this.isValueSelectedOnClick
) {
this.lastPushedGaEventValue = valueToPushToGa;
this.pushEventToGA(
event.category,
@ -262,13 +268,11 @@ export default {
}
},
handleFocus(e) {
console.log("B")
this.$root.handleInputFocus({
groupName: this.groupName,
});
},
handleBlur(e) {
console.log("A")
this.$root.handleInputBlur({
groupName: this.groupName,
onFocusCallback: this.onFocusCallbackForRoot,