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

View file

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