collect pageview for pages not wrapped in Shell

pull/172/head
vklimontovich 2021-05-07 20:07:36 +03:00
parent 3739d7752d
commit db05c587a3
1 changed files with 8 additions and 4 deletions

View File

@ -17,7 +17,7 @@ dayjs.extend(utc);
dayjs.extend(timezone); dayjs.extend(timezone);
import getSlots from '../../lib/slots'; import getSlots from '../../lib/slots';
import {useTelemetry} from "../../lib/telemetry"; import {collectPageParameters, telemetryEventTypes, useTelemetry} from "../../lib/telemetry";
function classNames(...classes) { function classNames(...classes) {
return classes.filter(Boolean).join(' ') return classes.filter(Boolean).join(' ')
@ -44,6 +44,10 @@ export default function Type(props) {
setSelectedTimeZone(dayjs.tz.guess()) setSelectedTimeZone(dayjs.tz.guess())
}, []) }, [])
useEffect(() => {
telemetry.withJitsu((jitsu) => jitsu.track(telemetryEventTypes.pageView, collectPageParameters()))
})
// Get router variables // Get router variables
const router = useRouter(); const router = useRouter();
@ -91,7 +95,7 @@ export default function Type(props) {
// Combine placeholder days with actual days // Combine placeholder days with actual days
const calendar = [...emptyDays, ...days.map((day) => const calendar = [...emptyDays, ...days.map((day) =>
<button key={day} onClick={(e) => { <button key={day} onClick={(e) => {
telemetry.withJitsu((jitsu) => jitsu.track('date_selected', {page_title: "", source_ip: ""})) telemetry.withJitsu((jitsu) => jitsu.track(telemetryEventTypes.dateSelected, collectPageParameters()))
setSelectedDate(dayjs().tz(selectedTimeZone).month(selectedMonth).date(day)) setSelectedDate(dayjs().tz(selectedTimeZone).month(selectedMonth).date(day))
}} disabled={selectedMonth < parseInt(dayjs().format('MM')) && dayjs().month(selectedMonth).format("D") > day} className={"text-center w-10 h-10 rounded-full mx-auto " + (dayjs().isSameOrBefore(dayjs().date(day).month(selectedMonth)) ? 'bg-blue-50 text-blue-600 font-medium' : 'text-gray-400 font-light') + (dayjs(selectedDate).month(selectedMonth).format("D") == day ? ' bg-blue-600 text-white-important' : '')}> }} disabled={selectedMonth < parseInt(dayjs().format('MM')) && dayjs().month(selectedMonth).format("D") > day} className={"text-center w-10 h-10 rounded-full mx-auto " + (dayjs().isSameOrBefore(dayjs().date(day).month(selectedMonth)) ? 'bg-blue-50 text-blue-600 font-medium' : 'text-gray-400 font-light') + (dayjs(selectedDate).month(selectedMonth).format("D") == day ? ' bg-blue-600 text-white-important' : '')}>
{day} {day}