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);
import getSlots from '../../lib/slots';
import {useTelemetry} from "../../lib/telemetry";
import {collectPageParameters, telemetryEventTypes, useTelemetry} from "../../lib/telemetry";
function classNames(...classes) {
return classes.filter(Boolean).join(' ')
@ -34,7 +34,7 @@ export default function Type(props) {
const telemetry = useTelemetry();
const [selectedTimeZone, setSelectedTimeZone] = useState('');
function toggleTimeOptions() {
setIsTimeOptionsOpen(!isTimeOptionsOpen);
}
@ -44,6 +44,10 @@ export default function Type(props) {
setSelectedTimeZone(dayjs.tz.guess())
}, [])
useEffect(() => {
telemetry.withJitsu((jitsu) => jitsu.track(telemetryEventTypes.pageView, collectPageParameters()))
})
// Get router variables
const router = useRouter();
@ -91,7 +95,7 @@ export default function Type(props) {
// Combine placeholder days with actual days
const calendar = [...emptyDays, ...days.map((day) =>
<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))
}} 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}
@ -175,7 +179,7 @@ export default function Type(props) {
{selectedTimeZone}
<ChevronDownIcon className="inline-block w-4 h-4 ml-1 -mt-1" />
</button>
{isTimeOptionsOpen &&
{isTimeOptionsOpen &&
<div className="w-full rounded shadow border bg-white px-4 py-2">
<div className="flex mb-4">
<div className="w-1/2 font-medium">Time Options</div>