zipcode GA event
This commit is contained in:
hiteshkumar87 2023-07-21 18:00:06 +05:30
parent 802e8f3e3e
commit d4db6c821c
3 changed files with 37 additions and 6 deletions

View file

@ -12,6 +12,7 @@ const GaEvents = {
const GaCategories = { const GaCategories = {
API_RESPONSE: "Api_Response", API_RESPONSE: "Api_Response",
EVOX: "Evox", EVOX: "Evox",
FUNNEL_ENTRY: "funnel_entry",
}; };
const GaActions = { const GaActions = {
@ -20,6 +21,7 @@ const GaActions = {
VIF: "vif", VIF: "vif",
SUBMITTED: "Submitted", SUBMITTED: "Submitted",
DISPLAYED: "Displayed", DISPLAYED: "Displayed",
ZIP_CODE_PROVIDED: "zip_code_provided",
}; };
const GaLabels = { const GaLabels = {
@ -27,7 +29,7 @@ const GaLabels = {
ERROR: "Error", ERROR: "Error",
LICENSE_PLATE_LOOKUP: "License_Plate_Look_Up", LICENSE_PLATE_LOOKUP: "License_Plate_Look_Up",
VIN_LOOKUP: "Vin_Look_Up", VIN_LOOKUP: "Vin_Look_Up",
ADDRESS_LOOKUP: "Address_Look_up", ADDRESS_LOOKUP: "Address_Look_up",
}; };
const ValueToLogTypes = { const ValueToLogTypes = {

View file

@ -81,7 +81,7 @@ import { getFunnelCookie } from "@/helpers/heritage-integration/cookie-helper";
import store from "@/store"; import store from "@/store";
import baseMixin from "@/mixins/base-mixin"; import baseMixin from "@/mixins/base-mixin";
import { queryStrings } from "@/constants/query-strings";
// DEFINE VALIDATION RULES // DEFINE VALIDATION RULES
defineRule("replace-options-required", required(errorMessages.REPLACE_OPTIONS_REQUIRED)); defineRule("replace-options-required", required(errorMessages.REPLACE_OPTIONS_REQUIRED));
@ -90,9 +90,22 @@ export default {
async beforeRouteEnter(to, from, next) { async beforeRouteEnter(to, from, next) {
// Call APIs // Call APIs
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage); const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const lowerCaseParams = new URLSearchParams();
for (const [name, value] of urlParams) {
lowerCaseParams.append(name.toLowerCase(), value);
}
const zip = lowerCaseParams.get(queryStrings.ZIP_CODE)
? lowerCaseParams.get(queryStrings.ZIP_CODE)
: store.getters.order.serviceLocation.zipCode;
const damageOptionsPromise = baseMixin.methods.dispatchStoreAction( const damageOptionsPromise = baseMixin.methods.dispatchStoreAction(
storeActions.GET_DAMAGE_OPTIONS, storeActions.GET_DAMAGE_OPTIONS,
{ carId: store.getters.vehicle.carId } { carId: store.getters.vehicle.carId,
zipCode:zip,
}
); );
// Settle promises and get results // Settle promises and get results
@ -122,7 +135,7 @@ export default {
); );
vm.$refs.backGlassOptions.initializeComponent( vm.$refs.backGlassOptions.initializeComponent(
resultMap.damageOptions.backGlassOptions.availableReplacementOptions resultMap.damageOptions.backGlassOptions.availableReplacementOptions
); );
}); });
}, },
data() { data() {
@ -134,7 +147,8 @@ export default {
selectedPassengerSideReplaceOptions: this.getPassengerSideReplaceOptionsFromStore(), selectedPassengerSideReplaceOptions: this.getPassengerSideReplaceOptionsFromStore(),
}, },
selectedWindshieldOptions: this.getWindshieldOptionsFromStore(), selectedWindshieldOptions: this.getWindshieldOptionsFromStore(),
selectedRearReplaceOptions: this.getRearReplaceOptionsFromStore(), selectedRearReplaceOptions: this.getRearReplaceOptionsFromStore(),
serviceZipCode: this.getZipFromStore() ?? this.$route.query.zipcode,
}; };
}, },
mounted() { mounted() {
@ -156,9 +170,21 @@ export default {
this.$store.getters.vehicle.carId, this.$store.getters.vehicle.carId,
true true
); );
}
if(this.serviceZipCode){
this.pushEventToGA(
this.GaCategories.FUNNEL_ENTRY,
this.GaActions.ZIP_CODE_PROVIDED,
this.serviceZipCode,
true
);
} }
}, },
getZipFromStore() {
return this.$store.getters.order.serviceLocation.zipCode;
},
backButtonAction() { backButtonAction() {
// route to move backwards // route to move backwards
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route); this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route);
@ -415,6 +441,7 @@ export default {
return selectedGlassToReplace; return selectedGlassToReplace;
}, },
}, },
computed: { computed: {
isWindshieldDamageLocation() { isWindshieldDamageLocation() {

View file

@ -740,11 +740,13 @@ export const actions = {
}); });
}, },
getDamageOptions(context, { carId }) { getDamageOptions(context, { carId,zipCode }) {
return globalMethods.callHttpClient({ return globalMethods.callHttpClient({
methods: endpoints.GetDamageOptions.method, methods: endpoints.GetDamageOptions.method,
endpoint: `${endpoints.GetDamageOptions.url}/${carId}`, endpoint: `${endpoints.GetDamageOptions.url}/${carId}`,
payload: {}, payload: {},
additionalSuccessEventDataHandler: (response) =>
"QueryStringZip: " + zipCode,
}); });
}, },