Merge pull request #1194 from Safelite/feature/richardson/INSR-8885
capture bailout dataLayer event
This commit is contained in:
commit
f23e97ab91
3 changed files with 14 additions and 2 deletions
|
|
@ -14,6 +14,7 @@ const GaEvents = Object.freeze({
|
||||||
|
|
||||||
const GaCategories = Object.freeze({
|
const GaCategories = Object.freeze({
|
||||||
API_RESPONSE: 'Api_Response',
|
API_RESPONSE: 'Api_Response',
|
||||||
|
BAILOUT: 'Bailout',
|
||||||
CONFIRMATION_CLICKED: "confirmation clicked",
|
CONFIRMATION_CLICKED: "confirmation clicked",
|
||||||
CONFIRMATION_CLICKED_INSHOP: "inshop confirmation clicked",
|
CONFIRMATION_CLICKED_INSHOP: "inshop confirmation clicked",
|
||||||
CONFIRMATION_CLICKED_MOBILE: "mobile confirmation clicked",
|
CONFIRMATION_CLICKED_MOBILE: "mobile confirmation clicked",
|
||||||
|
|
|
||||||
|
|
@ -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 textboxQuestion from '@/digital-components/textbox-question/textbox-question.vue';
|
||||||
import textBlock from '@/digital-components/text-block/text-block.vue';
|
import textBlock from '@/digital-components/text-block/text-block.vue';
|
||||||
// Supporting files
|
// Supporting files
|
||||||
|
import analyticsMixIn from '@/mixins/analytics-mixin.js';
|
||||||
import BaseFormMixin from '@/mixins/base-form-mixin.js';
|
import BaseFormMixin from '@/mixins/base-form-mixin.js';
|
||||||
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
||||||
|
import { GaCategories } from '@/constants/analytics';
|
||||||
import globalRules from '@/constants/global-rules';
|
import globalRules from '@/constants/global-rules';
|
||||||
import settleAllPromises from '@/helpers/layout-helper';
|
import settleAllPromises from '@/helpers/layout-helper';
|
||||||
import { useMainStore } from '@/store';
|
import { useMainStore } from '@/store';
|
||||||
|
|
@ -111,8 +113,17 @@ export default {
|
||||||
Form,
|
Form,
|
||||||
textBlock
|
textBlock
|
||||||
},
|
},
|
||||||
mixins: [BaseFormMixin],
|
mixins: [BaseFormMixin, analyticsMixIn],
|
||||||
async beforeRouteEnter(to, from, next) {
|
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
|
// Call APIs
|
||||||
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
|
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
|
||||||
// Settle promises and get results
|
// Settle promises and get results
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ const routerTitles = Object.freeze({
|
||||||
|
|
||||||
[issPageValues.ADDRESS_LOOKUP]: `Address Lookup ${titleSuffix}`,
|
[issPageValues.ADDRESS_LOOKUP]: `Address Lookup ${titleSuffix}`,
|
||||||
[issPageValues.ADDRESS_VEHICLES]: `Address Vehicles ${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.CAPABILITY_QUESTIONS]: `Capability Questions ${titleSuffix}`,
|
||||||
[issPageValues.CONTACT_CONFIRMATION]: `Contact Confirmation ${titleSuffix}`,
|
[issPageValues.CONTACT_CONFIRMATION]: `Contact Confirmation ${titleSuffix}`,
|
||||||
[issPageValues.CONTACT_DETAILS]: `Contact Details ${titleSuffix}`,
|
[issPageValues.CONTACT_DETAILS]: `Contact Details ${titleSuffix}`,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue