@dac-software/analytics-extensions
Advanced tools
Comparing version 1.0.0-Q2-2753-data-layer-for-conversions---con-release.0 to 1.0.0-Q2-2753-data-layer-for-conversions---con-release.1
@@ -5,3 +5,3 @@ import { EventBus } from 'light-event-bus'; | ||
import { searchResultsChoiceSubscriber } from './subscribers/offerEventSubscriber'; | ||
import { phoneFormOpenSubscriber, phoneFormSuccessSubscriber, meetingFormSuccessSubscriber, devisFormSuccessSubscriber, meetingFormOpenSubscriber, devisFormOpenSubscriber } from './subscribers/formEventSubscriber'; | ||
import { phoneFormOpenSubscriber, phoneFormSuccessSubscriber, globalPhoneFormSuccessSubscriber, meetingFormSuccessSubscriber, devisFormSuccessSubscriber, globalDevisFormSuccessSubscriber, meetingFormOpenSubscriber, globalMeetingFormSuccessSubscriber, devisFormOpenSubscriber } from './subscribers/formEventSubscriber'; | ||
const analyticsEventBus = new EventBus(); | ||
@@ -16,4 +16,7 @@ analyticsEventBus.subscribe('search.homepage.search-submit', searchBoxDataSubsciber); | ||
analyticsEventBus.subscribe('forms.offer-page.devis-success', devisFormSuccessSubscriber); | ||
analyticsEventBus.subscribe('forms.page.phone-success', globalPhoneFormSuccessSubscriber); | ||
analyticsEventBus.subscribe('forms.offer-page.meeting-success', globalMeetingFormSuccessSubscriber); | ||
analyticsEventBus.subscribe('forms.offer-page.devis-success', globalDevisFormSuccessSubscriber); | ||
analyticsEventBus.subscribe('search.results-page.choice', searchResultsChoiceSubscriber); | ||
analyticsEventBus.subscribe('phone-number.page.call', phoneNumberCallSubscriber); | ||
export { analyticsEventBus }; |
@@ -1,2 +0,2 @@ | ||
import { isHomepageAction, isMobileViewAction, isOfferPageAction, isEventNotified } from '../utils/sourceCheckers'; | ||
import { isOfferPageAction, isEventNotified } from '../utils/sourceCheckers'; | ||
const phoneFormOpenSubscriber = () => { | ||
@@ -12,10 +12,2 @@ const dataLayer = window.dataLayer; | ||
} | ||
else if (isMobileViewAction()) { | ||
dataLayer.push({ | ||
event: 'mobile.click.freephonecallback', | ||
eventCategory: 'mobile form', | ||
eventAction: 'click', | ||
eventLabel: 'Rappelez-moi' | ||
}); | ||
} | ||
}; | ||
@@ -32,19 +24,12 @@ const phoneFormSuccessSubscriber = () => { | ||
} | ||
else if (isMobileViewAction()) { | ||
dataLayer.push({ | ||
event: 'mobile.click.freephonecallback.success', | ||
eventCategory: 'mobile form', | ||
eventAction: 'submited', | ||
eventLabel: 'Rappelez-moi' | ||
}); | ||
} | ||
else if (isHomepageAction()) { | ||
dataLayer.push({ | ||
event: 'form.freephonecallback.success', | ||
eventCategory: 'form', | ||
eventAction: 'submit', | ||
eventLabel: 'free phone callback' | ||
}); | ||
} | ||
}; | ||
const globalPhoneFormSuccessSubscriber = () => { | ||
const dataLayer = window.dataLayer; | ||
dataLayer.push({ | ||
event: 'form.opened.success', | ||
eventCategory: 'conversion', | ||
eventAction: 'submit', | ||
eventLabel: 'Rappelez-moi' | ||
}); | ||
}; | ||
const devisFormSuccessSubscriber = () => { | ||
@@ -58,2 +43,11 @@ window.dataLayer.push({ | ||
}; | ||
const globalDevisFormSuccessSubscriber = () => { | ||
const dataLayer = window.dataLayer; | ||
dataLayer.push({ | ||
event: 'form.opened.success', | ||
eventCategory: 'conversion', | ||
eventAction: 'submit', | ||
eventLabel: 'Recevoir votre devis' | ||
}); | ||
}; | ||
const meetingFormSuccessSubscriber = () => { | ||
@@ -67,2 +61,11 @@ window.dataLayer.push({ | ||
}; | ||
const globalMeetingFormSuccessSubscriber = () => { | ||
const dataLayer = window.dataLayer; | ||
dataLayer.push({ | ||
event: 'form.opened.success', | ||
eventCategory: 'conversion', | ||
eventAction: 'submit', | ||
eventLabel: 'Prendre rendez-vous' | ||
}); | ||
}; | ||
const devisFormOpenSubscriber = () => { | ||
@@ -88,2 +91,2 @@ if (!isEventNotified('form.productpage.form.opened', 'conversionstep2')) { | ||
}; | ||
export { phoneFormOpenSubscriber, phoneFormSuccessSubscriber, devisFormSuccessSubscriber, meetingFormSuccessSubscriber, devisFormOpenSubscriber, meetingFormOpenSubscriber }; | ||
export { phoneFormOpenSubscriber, phoneFormSuccessSubscriber, globalPhoneFormSuccessSubscriber, devisFormSuccessSubscriber, globalDevisFormSuccessSubscriber, meetingFormSuccessSubscriber, devisFormOpenSubscriber, meetingFormOpenSubscriber, globalMeetingFormSuccessSubscriber }; |
@@ -1,12 +0,20 @@ | ||
import { isMobileViewAction } from '../utils/sourceCheckers'; | ||
const phoneNumberCallSubscriber = () => { | ||
import { isMobileViewAction, isOfferPageAction } from '../utils/sourceCheckers'; | ||
const phoneNumberCallSubscriber = (phoneNumber) => { | ||
if (isMobileViewAction()) { | ||
window.dataLayer.push({ | ||
event: 'mobile.click.call', | ||
eventCategory: 'mobile form', | ||
eventAction: 'click', | ||
eventLabel: 'action call' | ||
eventCategory: 'conversion', | ||
eventAction: 'call', | ||
eventLabel: phoneNumber | ||
}); | ||
if (isOfferPageAction()) { | ||
window.dataLayer.push({ | ||
event: 'productpage.mobile.click.call', | ||
eventCategory: 'conversionstep3', | ||
eventAction: 'call', | ||
eventLabel: phoneNumber | ||
}); | ||
} | ||
} | ||
}; | ||
export { phoneNumberCallSubscriber }; |
@@ -8,5 +8,8 @@ import { EventBus } from 'light-event-bus' | ||
phoneFormSuccessSubscriber, | ||
globalPhoneFormSuccessSubscriber, | ||
meetingFormSuccessSubscriber, | ||
devisFormSuccessSubscriber, | ||
globalDevisFormSuccessSubscriber, | ||
meetingFormOpenSubscriber, | ||
globalMeetingFormSuccessSubscriber, | ||
devisFormOpenSubscriber | ||
@@ -28,2 +31,6 @@ } from './subscribers/formEventSubscriber' | ||
analyticsEventBus.subscribe('forms.page.phone-success', globalPhoneFormSuccessSubscriber) | ||
analyticsEventBus.subscribe('forms.offer-page.meeting-success', globalMeetingFormSuccessSubscriber) | ||
analyticsEventBus.subscribe('forms.offer-page.devis-success', globalDevisFormSuccessSubscriber) | ||
analyticsEventBus.subscribe('search.results-page.choice', searchResultsChoiceSubscriber) | ||
@@ -30,0 +37,0 @@ |
import { ISubscriber } from '../model/eventBusInterface' | ||
import { isHomepageAction, isMobileViewAction, isOfferPageAction, isEventNotified } from '../utils/sourceCheckers' | ||
import { isOfferPageAction, isEventNotified } from '../utils/sourceCheckers' | ||
@@ -13,9 +13,2 @@ const phoneFormOpenSubscriber: ISubscriber = () => { | ||
}) | ||
} else if (isMobileViewAction()) { | ||
dataLayer.push({ | ||
event: 'mobile.click.freephonecallback', | ||
eventCategory: 'mobile form', | ||
eventAction: 'click', | ||
eventLabel: 'Rappelez-moi' | ||
}) | ||
} | ||
@@ -33,19 +26,15 @@ } | ||
}) | ||
} else if (isMobileViewAction()) { | ||
dataLayer.push({ | ||
event: 'mobile.click.freephonecallback.success', | ||
eventCategory: 'mobile form', | ||
eventAction: 'submited', | ||
eventLabel: 'Rappelez-moi' | ||
}) | ||
} else if (isHomepageAction()) { | ||
dataLayer.push({ | ||
event: 'form.freephonecallback.success', | ||
eventCategory: 'form', | ||
eventAction: 'submit', | ||
eventLabel: 'free phone callback' | ||
}) | ||
} | ||
} | ||
const globalPhoneFormSuccessSubscriber: ISubscriber = () => { | ||
const dataLayer = window.dataLayer | ||
dataLayer.push({ | ||
event: 'form.opened.success', | ||
eventCategory: 'conversion', | ||
eventAction: 'submit', | ||
eventLabel: 'Rappelez-moi' | ||
}) | ||
} | ||
const devisFormSuccessSubscriber: ISubscriber = () => { | ||
@@ -60,2 +49,12 @@ window.dataLayer.push({ | ||
const globalDevisFormSuccessSubscriber: ISubscriber = () => { | ||
const dataLayer = window.dataLayer | ||
dataLayer.push({ | ||
event: 'form.opened.success', | ||
eventCategory: 'conversion', | ||
eventAction: 'submit', | ||
eventLabel: 'Recevoir votre devis' | ||
}) | ||
} | ||
const meetingFormSuccessSubscriber: ISubscriber = () => { | ||
@@ -70,2 +69,12 @@ window.dataLayer.push({ | ||
const globalMeetingFormSuccessSubscriber: ISubscriber = () => { | ||
const dataLayer = window.dataLayer | ||
dataLayer.push({ | ||
event: 'form.opened.success', | ||
eventCategory: 'conversion', | ||
eventAction: 'submit', | ||
eventLabel: 'Prendre rendez-vous' | ||
}) | ||
} | ||
const devisFormOpenSubscriber: ISubscriber = () => { | ||
@@ -96,6 +105,9 @@ if (!isEventNotified('form.productpage.form.opened', 'conversionstep2')) { | ||
phoneFormSuccessSubscriber, | ||
globalPhoneFormSuccessSubscriber, | ||
devisFormSuccessSubscriber, | ||
globalDevisFormSuccessSubscriber, | ||
meetingFormSuccessSubscriber, | ||
devisFormOpenSubscriber, | ||
meetingFormOpenSubscriber | ||
meetingFormOpenSubscriber, | ||
globalMeetingFormSuccessSubscriber | ||
} |
import { ISubscriber } from '../model/eventBusInterface' | ||
import { isMobileViewAction } from '../utils/sourceCheckers' | ||
import { isMobileViewAction, isOfferPageAction } from '../utils/sourceCheckers' | ||
const phoneNumberCallSubscriber: ISubscriber = () => { | ||
const phoneNumberCallSubscriber: ISubscriber = (phoneNumber: string) => { | ||
if (isMobileViewAction()) { | ||
window.dataLayer.push({ | ||
event: 'mobile.click.call', | ||
eventCategory: 'mobile form', | ||
eventAction: 'click', | ||
eventLabel: 'action call' | ||
eventCategory: 'conversion', | ||
eventAction: 'call', | ||
eventLabel: phoneNumber | ||
}) | ||
if (isOfferPageAction()) { | ||
window.dataLayer.push({ | ||
event: 'productpage.mobile.click.call', | ||
eventCategory: 'conversionstep3', | ||
eventAction: 'call', | ||
eventLabel: phoneNumber | ||
}) | ||
} | ||
} | ||
@@ -13,0 +21,0 @@ } |
{ | ||
"name": "@dac-software/analytics-extensions", | ||
"version": "1.0.0-Q2-2753-data-layer-for-conversions---con-release.0", | ||
"version": "1.0.0-Q2-2753-data-layer-for-conversions---con-release.1", | ||
"license": "UNLICENSED", | ||
@@ -5,0 +5,0 @@ "main": "dist/esm/analytics-extensions", |
20339
426