Added telemetry collection (through jitsu.com)

- Introduced useTelemetry() hook
 - Telemetry events are sent for page_view, booking_confirmed, time_selected, date_selected events
 - Telemetry is configured (and can be disabled) with NEXT_PUBLIC_TELEMETRY_KEY env variable
This commit is contained in:
vklimontovich committed 2021-04-27 17:19:12 +03:00
1 parent 18d1974ae0
commit 2894be8689
8 files changed
+100 -6

No files matched your search

+9 -1
View File
@@ -1,14 +1,22 @@
import Link from 'next/link';
import { useState } from "react";
import {useContext, useEffect, useState} from "react";
import { useRouter } from "next/router";
import { signOut, useSession } from 'next-auth/client';
import { MenuIcon, XIcon } from '@heroicons/react/outline';
import {TelemetryContext, useTelemetry} from "../lib/telemetry";
export default function Shell(props) {
const router = useRouter();
const [ session, loading ] = useSession();
const [ profileDropdownExpanded, setProfileDropdownExpanded ] = useState(false);
const [ mobileMenuExpanded, setMobileMenuExpanded ] = useState(false);
let telemetry = useTelemetry();
useEffect(() => {
telemetry.withJitsu((jitsu) => {
return jitsu.track('page_view', {page_url: router.pathname})
});
}, [telemetry])
const toggleProfileDropdown = () => {
setProfileDropdownExpanded(!profileDropdownExpanded);