capture bailout dataLayer event

Includes Reason and Page from
This commit is contained in:
Bill Richardson 2026-04-21 14:35:43 -04:00
parent f9d0f29a1c
commit e168a25787
2 changed files with 13 additions and 1 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