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 = {

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
@ -135,6 +148,7 @@ export default {
}, },
selectedWindshieldOptions: this.getWindshieldOptionsFromStore(), selectedWindshieldOptions: this.getWindshieldOptionsFromStore(),
selectedRearReplaceOptions: this.getRearReplaceOptionsFromStore(), selectedRearReplaceOptions: this.getRearReplaceOptionsFromStore(),
serviceZipCode: this.getZipFromStore() ?? this.$route.query.zipcode,
}; };
}, },
mounted() { mounted() {
@ -157,6 +171,18 @@ export default {
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() {
@ -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,
}); });
}, },