Merge pull request #1194 from Safelite/feature/richardson/INSR-8885

capture bailout dataLayer event
This commit is contained in:
brich1212safe 2026-04-22 10:40:28 -04:00 committed by GitHub
commit f23e97ab91
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 14 additions and 2 deletions

View file

@ -14,6 +14,7 @@ const GaEvents = Object.freeze({
const GaCategories = Object.freeze({
API_RESPONSE: 'Api_Response',
BAILOUT: 'Bailout',
CONFIRMATION_CLICKED: "confirmation clicked",
CONFIRMATION_CLICKED_INSHOP: "inshop confirmation clicked",
CONFIRMATION_CLICKED_MOBILE: "mobile confirmation clicked",

View file

@ -88,8 +88,10 @@ import siteFooter from '@/iss-components/site-footer/site-footer.vue';
import textboxQuestion from '@/digital-components/textbox-question/textbox-question.vue';
import textBlock from '@/digital-components/text-block/text-block.vue';
// Supporting files
import analyticsMixIn from '@/mixins/analytics-mixin.js';
import BaseFormMixin from '@/mixins/base-form-mixin.js';
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
import { GaCategories } from '@/constants/analytics';
import globalRules from '@/constants/global-rules';
import settleAllPromises from '@/helpers/layout-helper';
import { useMainStore } from '@/store';
@ -111,8 +113,17 @@ export default {
Form,
textBlock
},
mixins: [BaseFormMixin],
mixins: [BaseFormMixin, analyticsMixIn],
async beforeRouteEnter(to, from, next) {
const fromPage = from?.query?.issPage || 'external';
// Only log bailout event if user is coming from a different page.
// This ensures that we cannot get stuck in a loop, if the bailout-page ever bails out.
if (fromPage !== issPageValues.BAILOUT_PAGE) {
const bailoutCode = useMainStore().pageData(issPageValues.BAILOUT_PAGE).bailoutCode;
const bailoutString = Object.keys(BailoutCode).find(key => BailoutCode[key] === bailoutCode);
analyticsMixIn.methods.pushEventToGA(GaCategories.BAILOUT, bailoutString, fromPage, true, null, null);
}
// Call APIs
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
// Settle promises and get results

View file

@ -9,7 +9,7 @@ const routerTitles = Object.freeze({
[issPageValues.ADDRESS_LOOKUP]: `Address Lookup ${titleSuffix}`,
[issPageValues.ADDRESS_VEHICLES]: `Address Vehicles ${titleSuffix}`,
[issPageValues.BAILOUT_PAGE]: `Bailout Page ${titleSuffix}`,
[issPageValues.BAILOUT_PAGE]: `Need Help ${titleSuffix}`,
[issPageValues.CAPABILITY_QUESTIONS]: `Capability Questions ${titleSuffix}`,
[issPageValues.CONTACT_CONFIRMATION]: `Contact Confirmation ${titleSuffix}`,
[issPageValues.CONTACT_DETAILS]: `Contact Details ${titleSuffix}`,