CSR-762 Get GA event working with state

This commit is contained in:
Katie 2022-09-29 15:08:13 -04:00
parent 9e91a60ea3
commit aba72ca593
7 changed files with 736 additions and 406 deletions

View file

@ -25,6 +25,8 @@
import { queryStrings } from "@/constants/query-strings"; import { queryStrings } from "@/constants/query-strings";
import { useField } from "vee-validate"; import { useField } from "vee-validate";
import { toRef } from "vue"; import { toRef } from "vue";
import { gaStoreActions } from "../../constants/store-actions";
import store from "../../store";
export default { export default {
name: "base-input-button", name: "base-input-button",
@ -83,7 +85,12 @@ export default {
case eventTypes.KEYPRESS_SUBMIT: case eventTypes.KEYPRESS_SUBMIT:
case eventTypes.CHANGE: case eventTypes.CHANGE:
this.handleClick(e); this.handleClick(e);
window.lastFocusedInputGroup = this.groupName; this.dispatchStoreAction(
gaStoreActions.UPDATE_LAST_FOCUSED_INPUT_GROUP,
this.groupName,
false
);
// window.lastFocusedInputGroup = this.groupName;
this.pushClickEventToGA(); this.pushClickEventToGA();
break; break;
} }
@ -119,9 +126,17 @@ export default {
this.valueToEmit = this.value; this.valueToEmit = this.value;
} }
window.currentlySelectedValues = // window.currentlySelectedValues =
window.currentlySelectedValues ?? {}; // window.currentlySelectedValues ?? {};
window.currentlySelectedValues[this.groupName] = this.value; this.dispatchStoreAction(
gaStoreActions.UPDATE_CURRENTLY_SELECTED_VALUES,
{
groupName: this.groupName,
value: this.value,
},
// false
);
// window.currentlySelectedValues[this.groupName] = this.value;
this.handleChange(this.valueToEmit); this.handleChange(this.valueToEmit);
}, },
handleClick(e) { handleClick(e) {
@ -129,10 +144,20 @@ export default {
this.$emit("buttonClicked", this.valueToEmit); this.$emit("buttonClicked", this.valueToEmit);
}, },
pushClickEventToGA(value) { pushClickEventToGA(value) {
window.firedGaClickEventValues = // window.firedGaClickEventValues =
window.firedGaClickEventValues ?? {}; // window.firedGaClickEventValues ?? {};
window.firedGaClickEventValues[window.lastFocusedInputGroup] = const lastFocusedInputGroup =
value ?? this.value; store.getters.gaClickInformation.lastFocusedInputGroup;
this.dispatchStoreAction(
gaStoreActions.UPDATE_FIRED_GA_CLICK_EVENT_VALUES,
{
groupName: lastFocusedInputGroup,
value: value ?? this.value,
},
// false
);
// window.firedGaClickEventValues[window.lastFocusedInputGroup] =
// value ?? this.value;
this.pushEventToGA( this.pushEventToGA(
this.$route.query[queryStrings.FMG_PAGE], this.$route.query[queryStrings.FMG_PAGE],
@ -143,65 +168,68 @@ export default {
); );
}, },
handleBlur() { handleBlur() {
window.lastFocusedInputGroup = this.groupName; this.dispatchStoreAction(
window.wasLastFocusedInputMultiselect = this.isMultiSelect; gaStoreActions.UPDATE_LAST_FOCUSED_INPUT_GROUP,
this.groupName,
false
);
this.dispatchStoreAction(
gaStoreActions.UPDATE_WAS_LAST_FOCUSED_INPUT_MULTISELECT,
this.isMultiSelect,
false
);
// window.lastFocusedInputGroup = this.groupName;
// window.wasLastFocusedInputMultiselect = this.isMultiSelect;
}, },
handleKeyboardNavigation(key) { handleKeyboardNavigation(key) {
this.test(key); this.test(key);
}, },
test(event) { test(event) {
window.firedGaClickEventValues = const gaClickInformation = store.getters.gaClickInformation;
window.firedGaClickEventValues ?? {}; const firedGaClickEventValues =
window.currentlySelectedValues = gaClickInformation.firedGaClickEventValues;
window.currentlySelectedValues ?? {}; const currentlySelectedValues =
gaClickInformation.currentlySelectedValues;
const lastFocusedInputGroup =
gaClickInformation.lastFocusedInputGroup;
const wasLastFocusedInputMultiselect =
gaClickInformation.wasLastFocusedInputMultiselect;
const keyCode = event?.code; const keyCode = event?.code;
// Keyboard navigation // Keyboard navigation
if (keyCode) { if (keyCode) {
if ( if (
window.currentlySelectedValues && !wasLastFocusedInputMultiselect &&
window.firedGaClickEventValues && currentlySelectedValues[lastFocusedInputGroup] &&
window.lastFocusedInputGroup && firedGaClickEventValues[lastFocusedInputGroup] !=
!window.wasLastFocusedInputMultiselect && currentlySelectedValues[lastFocusedInputGroup]
window.currentlySelectedValues[
window.lastFocusedInputGroup
] &&
window.firedGaClickEventValues[
window.lastFocusedInputGroup
] !=
window.currentlySelectedValues[
window.lastFocusedInputGroup
]
) { ) {
if (keyCode === "Tab") { if (keyCode === "Tab") {
this.pushClickEventToGA( this.pushClickEventToGA(
window.currentlySelectedValues[ currentlySelectedValues[lastFocusedInputGroup]
window.lastFocusedInputGroup
]
); );
} else if (keyCode?.includes("Arrow")) { } else if (keyCode?.includes("Arrow")) {
if (window.lastFocusedInputGroup != this.groupName) { if (lastFocusedInputGroup != this.groupName) {
this.pushClickEventToGA( this.pushClickEventToGA(
window.currentlySelectedValues[ currentlySelectedValues[lastFocusedInputGroup]
window.lastFocusedInputGroup
]
); );
} }
} }
} }
} else { } else {
// Radio click // Radio click
window.lastFocusedInputGroup = this.groupName; this.dispatchStoreAction(
gaStoreActions.UPDATE_LAST_FOCUSED_INPUT_GROUP,
this.groupName,
false
);
// window.lastFocusedInputGroup = this.groupName;
if ( if (
window.firedGaClickEventValues[ firedGaClickEventValues[lastFocusedInputGroup] !=
window.lastFocusedInputGroup currentlySelectedValues[lastFocusedInputGroup]
] !=
window.currentlySelectedValues[window.lastFocusedInputGroup]
) { ) {
this.pushClickEventToGA( this.pushClickEventToGA(
window.currentlySelectedValues[ currentlySelectedValues[lastFocusedInputGroup]
window.lastFocusedInputGroup
]
); );
} }
} }

View file

@ -1,78 +1,84 @@
const storeActions = { const storeActions = {
// Content Actions // Content Actions
GET_ROUTE_INFO_ACTION: "getRouteInfo", GET_ROUTE_INFO_ACTION: "getRouteInfo",
GET_HOMEPAGE_NAME: "getHomepageName", GET_HOMEPAGE_NAME: "getHomepageName",
GET_PAGE_DATA: "getPageData", GET_PAGE_DATA: "getPageData",
// Vehicle Actions // Vehicle Actions
GET_VEHICLE_YEARS: "getVehicleYears", GET_VEHICLE_YEARS: "getVehicleYears",
GET_VEHICLE_MAKES: "getVehicleMakes", GET_VEHICLE_MAKES: "getVehicleMakes",
GET_VEHICLE_MODELS: "getVehicleModels", GET_VEHICLE_MODELS: "getVehicleModels",
GET_VEHICLE_STYLES: "getVehicleStyles", GET_VEHICLE_STYLES: "getVehicleStyles",
SET_VEHICLE: "setVehicle", SET_VEHICLE: "setVehicle",
GET_DAMAGE_OPTIONS: "getDamageOptions", GET_DAMAGE_OPTIONS: "getDamageOptions",
GET_EVOX_IMAGE: "getEvoxImage", GET_EVOX_IMAGE: "getEvoxImage",
// Lookup Actions // Lookup Actions
LOOKUP_VEHICLE_BY_YMMS: "lookupVehicleByYmms", LOOKUP_VEHICLE_BY_YMMS: "lookupVehicleByYmms",
LOOKUP_VEHICLE_BY_VIN: "lookupVehicleByVin", LOOKUP_VEHICLE_BY_VIN: "lookupVehicleByVin",
LOOKUP_VIN_BY_PLATE: "lookupVinByPlate", LOOKUP_VIN_BY_PLATE: "lookupVinByPlate",
LOOKUP_VIN_BY_ADDRESS: "lookupVinByAddress", LOOKUP_VIN_BY_ADDRESS: "lookupVinByAddress",
GET_PARTS_OR_QUESTIONS: "getPartsOrQuestions", GET_PARTS_OR_QUESTIONS: "getPartsOrQuestions",
GET_PARTS: "getParts", GET_PARTS: "getParts",
GET_CAPABILITY_QUESTIONS: "getCapabilityQuestions", GET_CAPABILITY_QUESTIONS: "getCapabilityQuestions",
GET_PART_FROM_CAPABILITY_QUESTION_ANSWER: GET_PART_FROM_CAPABILITY_QUESTION_ANSWER:
"getPartFromCapabilityQuestionAnswer", "getPartFromCapabilityQuestionAnswer",
GET_MOLDING_QUESTIONS: "getMoldingQuestions", GET_MOLDING_QUESTIONS: "getMoldingQuestions",
SAVE_ORDER: "saveOrder", SAVE_ORDER: "saveOrder",
LOAD_ORDER: "loadOrder", LOAD_ORDER: "loadOrder",
UPDATE_STORE_WITH_SAVE_ORDER_RESPONSE: "updateStoreWithSaveOrderResponse", UPDATE_STORE_WITH_SAVE_ORDER_RESPONSE: "updateStoreWithSaveOrderResponse",
VALIDATE_ZIP: "validateZip", VALIDATE_ZIP: "validateZip",
LOG_EXPERIMENT_EXPOSURE: "logExperimentExposure", LOG_EXPERIMENT_EXPOSURE: "logExperimentExposure",
LOG_PAGE_VIEW: "logPageView", LOG_PAGE_VIEW: "logPageView",
LOG_CUSTOM_EVENT: "logCustomEvent", LOG_CUSTOM_EVENT: "logCustomEvent",
INITIALIZE_SESSION: "initializeSession", INITIALIZE_SESSION: "initializeSession",
GET_EXPERIMENTS_BY_USER: "GetExperimentsByUser", GET_EXPERIMENTS_BY_USER: "GetExperimentsByUser",
RUN_EXPERIMENTS_FOR_TRIGGER: "runExperimentsForTrigger", RUN_EXPERIMENTS_FOR_TRIGGER: "runExperimentsForTrigger",
CLEAR_VIN: "clearVin", CLEAR_VIN: "clearVin",
RESET_SAVE_ORDER_PROMISE: "resetSaveOrderPromise", RESET_SAVE_ORDER_PROMISE: "resetSaveOrderPromise",
// DEPENDENCY MUTATIONS // DEPENDENCY MUTATIONS
RESET_VEHICLE_STATE_AND_DEPENDENCIES: "resetVehicleAndDependencies", RESET_VEHICLE_STATE_AND_DEPENDENCIES: "resetVehicleAndDependencies",
RESET_DAMAGE_STATE_AND_DEPENDENCIES: "resetDamageAndDependencies", RESET_DAMAGE_STATE_AND_DEPENDENCIES: "resetDamageAndDependencies",
RESET_REGISTRATION_STATE_AND_DEPENDENCIES: RESET_REGISTRATION_STATE_AND_DEPENDENCIES: "resetRegistrationAndDependencies",
"resetRegistrationAndDependencies", RESET_PARTS_STATE_AND_DEPENDENCIES: "resetPartsAndDependencies",
RESET_PARTS_STATE_AND_DEPENDENCIES: "resetPartsAndDependencies", RESET_STATE: "resetState",
RESET_STATE: "resetState",
// SAVE COMPONENT STATE // SAVE COMPONENT STATE
SAVE_VEHICLE_YEAR: "saveVehicleYear", SAVE_VEHICLE_YEAR: "saveVehicleYear",
SAVE_VEHICLE_MAKE: "saveVehicleMake", SAVE_VEHICLE_MAKE: "saveVehicleMake",
SAVE_VEHICLE_MODEL: "saveVehicleModel", SAVE_VEHICLE_MODEL: "saveVehicleModel",
SAVE_VEHICLE_STYLE: "saveVehicleStyle", SAVE_VEHICLE_STYLE: "saveVehicleStyle",
SAVE_VEHICLE_DAMAGE: "saveVehicleDamage", SAVE_VEHICLE_DAMAGE: "saveVehicleDamage",
SAVE_VIN_LOOKUP: "saveVinLookup", SAVE_VIN_LOOKUP: "saveVinLookup",
SAVE_SERVICE_LOCATION: "saveServiceLocation", SAVE_SERVICE_LOCATION: "saveServiceLocation",
SAVE_EMAIL: "saveEmail", SAVE_EMAIL: "saveEmail",
SAVE_REGISTRATION_LICENSE_PLATE_LOOKUP: SAVE_REGISTRATION_LICENSE_PLATE_LOOKUP: "saveRegistrationLicensePlateLookup",
"saveRegistrationLicensePlateLookup", SAVE_VIN: "saveVin",
SAVE_VIN: "saveVin", SAVE_REGISTRATION_ADDRESS_LOOKUP: "saveRegistrationAddressLookup",
SAVE_REGISTRATION_ADDRESS_LOOKUP: "saveRegistrationAddressLookup", SAVE_GLASS_PARTS: "saveGlassParts",
SAVE_GLASS_PARTS: "saveGlassParts", SAVE_PART_QUESTION_ANSWERS: "savePartQuestionAnswers",
SAVE_PART_QUESTION_ANSWERS: "savePartQuestionAnswers", RESET_MOLDING_AND_CAPABILITY_QUESTIONS_IF_NEEDED:
RESET_MOLDING_AND_CAPABILITY_QUESTIONS_IF_NEEDED: "resetMoldingAndCapabilityQuestionAnswersIfNeeded",
"resetMoldingAndCapabilityQuestionAnswersIfNeeded", SAVE_MOLDING_QUESTION_ANSWERS: "saveMoldingQuestionAnswers",
SAVE_MOLDING_QUESTION_ANSWERS: "saveMoldingQuestionAnswers", SAVE_CAPABILITY_QUESTION_ANSWERS: "saveCapabilityQuestionAnswers",
SAVE_CAPABILITY_QUESTION_ANSWERS: "saveCapabilityQuestionAnswers",
// START GA click event actions
// UPDATE_CURRENTLY_SELECTED_VALUES: "updateCurrentlySelectedValues",
// UPDATE_FIRED_GA_CLICK_EVENT_VALUES: "updateFiredGaClickEventValues",
// UPDATE_LAST_FOCUSED_INPUT_GROUP: "updateLastFocusedInputGroup",
// UPDATE_WAS_LAST_FOCUSED_INPUT_MULTISELECT:
// "updateWasLastFocusedInputMultiselect",
// END GA click event actions
}; };
const gaStoreActions = { const gaStoreActions = {
UPDATE_CURRENTLY_SELECTED_VALUES: "updateCurrentlySelectedValues", UPDATE_CURRENTLY_SELECTED_VALUES: "updateCurrentlySelectedValues",
UPDATE_FIRED_GA_CLICK_EVENT_VALUES: "updateFiredGaClickEventValues", UPDATE_FIRED_GA_CLICK_EVENT_VALUES: "updateFiredGaClickEventValues",
UPDATE_LAST_FOCUSED_INPUT_GROUP: "updateLastFocusedInputGroup", UPDATE_LAST_FOCUSED_INPUT_GROUP: "updateLastFocusedInputGroup",
UPDATE_WAS_LAST_FOCUSED_INPUT_MULTISELECT: UPDATE_WAS_LAST_FOCUSED_INPUT_MULTISELECT:
"updateWasLastFocusedInputMultiselect", "updateWasLastFocusedInputMultiselect",
}; };
export { storeActions, gaStoreActions }; export { storeActions, gaStoreActions };

View file

@ -1,71 +1,79 @@
const storeMutations = { const storeMutations = {
// VEHICLE MUTATIONS // VEHICLE MUTATIONS
UPDATE_YEAR: "updateYear", UPDATE_YEAR: "updateYear",
UPDATE_MAKE: "updateMake", UPDATE_MAKE: "updateMake",
UPDATE_MODEL: "updateModel", UPDATE_MODEL: "updateModel",
UPDATE_STYLE: "updateStyle", UPDATE_STYLE: "updateStyle",
UPDATE_CAR_ID: "updateCarId", UPDATE_CAR_ID: "updateCarId",
UPDATE_VEHICLE_CATEGORY: "updateVehicleCategory", UPDATE_VEHICLE_CATEGORY: "updateVehicleCategory",
UPDATE_VEHICLE_IMAGE_URL: "updateVehicleImageUrl", UPDATE_VEHICLE_IMAGE_URL: "updateVehicleImageUrl",
UPDATE_VEHICLE_IMAGE_VIF_NUMBER: "updateVehicleImageVifNumber", UPDATE_VEHICLE_IMAGE_VIF_NUMBER: "updateVehicleImageVifNumber",
UPDATE_VEHICLE_IMAGE_COLOR: "updateVehicleImageColor", UPDATE_VEHICLE_IMAGE_COLOR: "updateVehicleImageColor",
UPDATE_VEHICLE_VIN: "updateVehicleVin", UPDATE_VEHICLE_VIN: "updateVehicleVin",
UPDATE_VEHICLE: "updateVehicle", UPDATE_VEHICLE: "updateVehicle",
UPDATE_IS_REPAIR: "updateIsRepair", UPDATE_IS_REPAIR: "updateIsRepair",
UPDATE_NUMBER_OF_CHIPS: "updateNumberOfChips", UPDATE_NUMBER_OF_CHIPS: "updateNumberOfChips",
UPDATE_GLASS_TO_REPLACE: "updateGlassToReplace", UPDATE_GLASS_TO_REPLACE: "updateGlassToReplace",
UPDATE_PART_QUESTION_ANSWERS: "updatePartQuestionAnswers", UPDATE_PART_QUESTION_ANSWERS: "updatePartQuestionAnswers",
UPDATE_MOLDING_QUESTION_ANSWERS: "updateMoldingQuestionAnswers", UPDATE_MOLDING_QUESTION_ANSWERS: "updateMoldingQuestionAnswers",
UPDATE_CAPABILITY_QUESTION_ANSWERS: "updateCapabilityQuestionAnswers", UPDATE_CAPABILITY_QUESTION_ANSWERS: "updateCapabilityQuestionAnswers",
UPDATE_GLASS_PARTS: "updateGlassParts", UPDATE_GLASS_PARTS: "updateGlassParts",
UPDATE_OTHER_PARTS: "updateOtherParts", UPDATE_OTHER_PARTS: "updateOtherParts",
UPDATE_REGISTRATION_LICENSE_PLATE: "updateRegistrationLicensePlate", UPDATE_REGISTRATION_LICENSE_PLATE: "updateRegistrationLicensePlate",
UPDATE_REGISTRATION_ADDRESS: "updateRegistrationAddress", UPDATE_REGISTRATION_ADDRESS: "updateRegistrationAddress",
UPDATE_REGISTRATION_CITY: "updateRegistrationCity", UPDATE_REGISTRATION_CITY: "updateRegistrationCity",
UPDATE_REGISTRATION_STATE: "updateRegistrationState", UPDATE_REGISTRATION_STATE: "updateRegistrationState",
UPDATE_REGISTRATION_ZIP_CODE: "updateRegistrationZipCode", UPDATE_REGISTRATION_ZIP_CODE: "updateRegistrationZipCode",
UPDATE_REGISTRATION_FIRST_NAME: "updateRegistrationFirstName", UPDATE_REGISTRATION_FIRST_NAME: "updateRegistrationFirstName",
UPDATE_REGISTRATION_LAST_NAME: "updateRegistrationLastName", UPDATE_REGISTRATION_LAST_NAME: "updateRegistrationLastName",
UPDATE_REGISTRATION: "updateRegistration", UPDATE_REGISTRATION: "updateRegistration",
UPDATE_SERVICE_LOCATION_ZIP_CODE: "updateServiceLocationZipCode", UPDATE_SERVICE_LOCATION_ZIP_CODE: "updateServiceLocationZipCode",
UPDATE_SERVICE_LOCATION_STATE: "updateServiceLocationState", UPDATE_SERVICE_LOCATION_STATE: "updateServiceLocationState",
UPDATE_SERVICE_LOCATION: "updateServiceLocation", UPDATE_SERVICE_LOCATION: "updateServiceLocation",
UPDATE_CUSTOMER_EMAIL_ADDRESS: "updateCustomerEmailAddress", UPDATE_CUSTOMER_EMAIL_ADDRESS: "updateCustomerEmailAddress",
// ORDER MUTATIONS // ORDER MUTATIONS
UPDATE_REFERRAL_NUMBER: "updateReferralNumber", UPDATE_REFERRAL_NUMBER: "updateReferralNumber",
UPDATE_REFERRAL_DATE: "updateReferralDate", UPDATE_REFERRAL_DATE: "updateReferralDate",
UPDATE_REFERRAL_CORRELATION_ID: "updateReferralCorrelationId", UPDATE_REFERRAL_CORRELATION_ID: "updateReferralCorrelationId",
UPDATE_PARENT_ACCT_NUMBER: "updateParentAcctNumber", UPDATE_PARENT_ACCT_NUMBER: "updateParentAcctNumber",
UPDATE_EON: "updateEON", UPDATE_EON: "updateEON",
UPDATE_SAVED_SESSION_ID: "updateSavedSessionId", UPDATE_SAVED_SESSION_ID: "updateSavedSessionId",
UPDATE_CRM_CUSTOMER_ID: "updateCrmCustomerId", UPDATE_CRM_CUSTOMER_ID: "updateCrmCustomerId",
// EVENT BUS MUTATIONS // EVENT BUS MUTATIONS
ADD_EVENT_TO_BUS: "addEventToBus", ADD_EVENT_TO_BUS: "addEventToBus",
REMOVE_EVENT_FROM_BUS: "removeEventFromBus", REMOVE_EVENT_FROM_BUS: "removeEventFromBus",
// DEPENDENCY MUTATIONS // DEPENDENCY MUTATIONS
RESET_VEHICLE_STATE: "resetVehicleState", RESET_VEHICLE_STATE: "resetVehicleState",
RESET_DAMAGE_STATE: "resetDamageState", RESET_DAMAGE_STATE: "resetDamageState",
RESET_REGISTRATION_STATE: "resetRegistrationState", RESET_REGISTRATION_STATE: "resetRegistrationState",
RESET_GLASS_PARTS_STATE: "resetGlassPartsState", RESET_GLASS_PARTS_STATE: "resetGlassPartsState",
RESET_STATE: "resetState", RESET_STATE: "resetState",
RESET_SAVE_ORDER_PROMISE: "resetSaveOrderPromise", RESET_SAVE_ORDER_PROMISE: "resetSaveOrderPromise",
// OTHER MUTATIONS // OTHER MUTATIONS
UPDATE_PAGE_DATA: "updatePageData", UPDATE_PAGE_DATA: "updatePageData",
UPDATE_STATE_WITH_ORDER_INFORMATION: "updateStateWithOrderInformation", UPDATE_STATE_WITH_ORDER_INFORMATION: "updateStateWithOrderInformation",
UPDATE_SAVE_ORDER_PROMISE: "updateSaveOrderPromise", UPDATE_SAVE_ORDER_PROMISE: "updateSaveOrderPromise",
UPDATE_LAST_PAGE_VISITED: "updateLastPageVisited", UPDATE_LAST_PAGE_VISITED: "updateLastPageVisited",
// EXPERIMENT MUTATIONS // EXPERIMENT MUTATIONS
UPDATE_EXPERIMENTS: "updateExperiments", UPDATE_EXPERIMENTS: "updateExperiments",
UPDATE_TRIGGERED_SITE_ENTRY: "updateTriggeredSiteEntry", UPDATE_TRIGGERED_SITE_ENTRY: "updateTriggeredSiteEntry",
// START GA click event mutations
// UPDATE_CURRENTLY_SELECTED_VALUES: "updateCurrentlySelectedValues",
// UPDATE_FIRED_GA_CLICK_EVENT_VALUES: "updateFiredGaClickEventValues",
// UPDATE_LAST_FOCUSED_INPUT_GROUP: "updateLastFocusedInputGroup",
// UPDATE_WAS_LAST_FOCUSED_INPUT_MULTISELECT:
// "updateWasLastFocusedInputMultiselect",
// END GA click event mutations
}; };
const gaStoreMutations = { const gaStoreMutations = {

View file

@ -8,12 +8,14 @@ import baseMixin from "@/mixins/base-mixin.js";
import analyticsMixin from "@/mixins/analytics-mixin.js"; import analyticsMixin from "@/mixins/analytics-mixin.js";
import experimentMixin from "@/mixins/experiment-mixin.js"; import experimentMixin from "@/mixins/experiment-mixin.js";
import "../node_modules/bootstrap/dist/js/bootstrap.js"; import "../node_modules/bootstrap/dist/js/bootstrap.js";
import gaState from "./store/gaState";
// Vue App Setup // Vue App Setup
const vueApp = createApp(App); const vueApp = createApp(App);
vueApp.use(router); vueApp.use(router);
vueApp.use(store); vueApp.use(store);
vueApp.use(gaState)
vueApp.use(LoadScript); vueApp.use(LoadScript);
vueApp.use(Maska); vueApp.use(Maska);
vueApp.mixin(baseMixin); vueApp.mixin(baseMixin);

View file

@ -29,6 +29,8 @@ export default {
logCustomEvent(category, action, label, value) { logCustomEvent(category, action, label, value) {
const currentPageName = getPageNameByQueryString(); const currentPageName = getPageNameByQueryString();
console.log("PUSHING: ", label)
var payload = { var payload = {
userId: getDeviceIdValue(), userId: getDeviceIdValue(),
sessionKey: getSessionKeyValue(), sessionKey: getSessionKeyValue(),

View file

@ -1,90 +1,72 @@
import { createStore } from "vuex";
import { endpoints } from "@/constants/endpoints.js";
import { gaStoreMutations } from "@/constants/store-mutations"; import { gaStoreMutations } from "@/constants/store-mutations";
import { getDateForSavedSessionTimeout } from "@/helpers/heritage-integration/session-helper";
import createPersistedState from "vuex-persistedstate";
import globalMethods from "@/global-methods";
import { gaStoreActions } from "@/constants/store-actions";
import { applicationConfig } from "@/constants/application-config";
import { experimentTriggers } from "@/constants/experiments";
import { damageLocationsSelected } from "@/constants/damage-locations-selected";
import { fmgPageValues } from "@/router/router-constants/fmgPage-values";
// Export State // Export State
const getDefaultState = () => { const getDefaultState = () => {
return { return {
gaClickInformation: { gaClickInformation: {
currentlySelectedValues: {}, currentlySelectedValues: {},
firedGaClickEventValues: {}, firedGaClickEventValues: {},
lastFocusedInputGroup: "", lastFocusedInputGroup: "",
wasLastFocusedInputMultiselect: undefined, wasLastFocusedInputMultiselect: undefined,
}, },
}; };
}; };
export const gaState = getDefaultState(); export const gaState = getDefaultState();
// Export Mutations // Export Mutations
export const gaMutations = { export const gaMutations = {
updateCurrentlySelectedValues(state, groupName, value) { updateCurrentlySelectedValues(state, { groupName, value }) {
state.gaClickInformation.currentlySelectedValues[groupName] = value; state.gaClickInformation.currentlySelectedValues[groupName] = value;
}, },
updateFiredGaClickEventValues(state, groupName, value) { updateFiredGaClickEventValues(state, { groupName, value }) {
state.gaClickInformation.firedGaClickEventValues[groupName] = value; state.gaClickInformation.firedGaClickEventValues[groupName] = value;
}, },
updateLastFocusedInputGroup(state, groupName) { updateLastFocusedInputGroup(state, groupName) {
state.gaClickInformation.lastFocusedInputGroup = groupName; state.gaClickInformation.lastFocusedInputGroup = groupName;
}, },
updateWasLastFocusedInputMultiselect( updateWasLastFocusedInputMultiselect(state, wasLastFocusedInputMultiselect) {
state, state.gaClickInformation.wasLastFocusedInputMultiselect =
wasLastFocusedInputMultiselect wasLastFocusedInputMultiselect;
) { },
state.gaClickInformation.wasLastFocusedInputMultiselect =
wasLastFocusedInputMultiselect;
},
}; };
// Export Getters // Export Getters
export const getters = { export const getters = {
gaClickInformation: (state) => state.gaClickInformation, gaClickInformation: (state) => state.gaClickInformation,
}; };
// Export Actions // Export Actions
export const gaActions = { export const gaActions = {
updateCurrentlySelectedValues(context, groupName, value) { updateCurrentlySelectedValues(context, { groupName, value }) {
context.commit( context.commit(gaStoreMutations.UPDATE_CURRENTLY_SELECTED_VALUES, {
gaStoreMutations.UPDATE_CURRENTLY_SELECTED_VALUES, groupName,
groupName, value,
value });
); },
}, updateFiredGaClickEventValues(context, { groupName, value }) {
updateFiredGaClickEventValues(context, groupName, value) { context.commit(gaStoreMutations.UPDATE_FIRED_GA_CLICK_EVENT_VALUES, {
context.commit( groupName,
gaStoreMutations.UPDATE_FIRED_GA_CLICK_EVENT_VALUES, value,
groupName, });
value },
); updateLastFocusedInputGroup(context, groupName) {
}, context.commit(gaStoreMutations.UPDATE_LAST_FOCUSED_INPUT_GROUP, groupName);
updateLastFocusedInputGroup(context, groupName) { },
context.commit( updateWasLastFocusedInputMultiselect(
gaStoreMutations.UPDATE_LAST_FOCUSED_INPUT_GROUP, context,
groupName wasLastFocusedInputMultiselect
); ) {
}, context.commit(
updateWasLastFocusedInputMultiselect( gaStoreMutations.UPDATE_WAS_LAST_FOCUSED_INPUT_MULTISELECT,
context, wasLastFocusedInputMultiselect
wasLastFocusedInputMultiselect );
) { },
context.commit(
gaStoreMutations.UPDATE_WAS_LAST_FOCUSED_INPUT_MULTISELECT,
wasLastFocusedInputMultiselect
);
},
}; };
export default createStore({ export default {
gaState, state: gaState,
gaMutations, mutations: gaMutations,
getters, getters,
gaActions, actions: gaActions,
}); };

File diff suppressed because it is too large Load diff