This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//in a common use case, button click. | |
<button data-event-name="search-show-more-results" data-event-params="{currentPage: 4}"/> Sow more </button> | |
//when someone toggle a select dropdown | |
<select data-event-name="search-show-access-filters"> | |
.. | |
</select> | |
//when someone interacts with a custom component | |
<UserProfile> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const pushEvent = (event: IEvent) = { | |
if (typeof window === 'undefined' || !window.dataLayer) { | |
return; | |
} | |
window.dataLayer.push( event: event.name, ...event.properties }); | |
} | |
export const GTM = { | |
pushEvent |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const pushEvent = (event: IEvent) => { | |
if (typeof window === 'undefined' || !(window as any).dataLayer) { | |
return; | |
} | |
window.dataLayer.push({ event: event.name, ...event.properties }); | |
}; | |
export const gtm = { | |
pushEvent |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//somewhere in the code | |
analyticsService.trackEvent(SEARCH_EVENTS.datedSearch, { checkIn, checkOut }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//configuration of all events from multiple root level pages | |
const eventsRegister = { | |
...SEARCH_EVENTS_CONFIG, | |
...LISTING_EVENTS_CONFIG | |
//loads more | |
} | |
// for example, in `src/views/search/events.ts` file | |
export const SEARCH_EVENTS_CONFIG: EventConfigMap = { | |
[SEARCH_EVENTS.datedSearch]: [evtCh.GA, evtCh.KSM, evtCh.FB], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//in on page | |
window.uetq.push({ 'ec': 'listing', 'ea': 'contacted-host', 'ev': 1 }); | |
_kmq.push(['record', 'contact host', { 'user_id': 'UserId' }]); | |
//in another page | |
Scenestealer.trackRequestBooking(`${booking.listingId}`); | |
utils.addGoogleAnalyticsEvent('listing', 'reques-booking', '', 1); | |
utils.recordFacebookEvent('track', 'Lead', { content_name: 'request booking', user_id: 'UserId' }); | |
utils.recordFacebookEvent('trackCustom', 'lead',{ action: 'request booking'}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Timer | |
- utilises animation frames (with a fallback to setTimeout when using the polyfill, below) | |
- returns remaining (or running) time | |
- pass a callback [fn], with an optional duration [ms] and autotart [bool], to the constructor or 'init' method | |
eg. new Timer(foo, 1000) *or* (new Timer()).init(foo, 0, true) | |
- for uniform x-browser support combine with the requestAnimationFrame polyfill from Erik Möller, et. al. | |
[https://github.com/darius/requestAnimationFrame] | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {logger} from 'shared/components/utilities/logger'; | |
export function withSpinner(target, key, descriptor) { | |
let ptr = descriptor.value; | |
descriptor.value = function(...args) { | |
if (this.spinner) { | |
this.spinner.setLoading(true); | |
} | |
return ptr.apply(this, args) | |
.then(() => { |