import WebsiteSelect from 'components/input/WebsiteSelect'; import Page from 'components/layout/Page'; import PageHeader from 'components/layout/PageHeader'; import EventsChart from 'components/metrics/EventsChart'; import WebsiteChart from 'components/metrics/WebsiteChart'; import useApi from 'hooks/useApi'; import Head from 'next/head'; import Link from 'next/link'; import { useRouter } from 'next/router'; import Script from 'next/script'; import { Button, Column, Row } from 'react-basics'; import styles from './TestConsole.module.css'; export function TestConsole() { const { get, useQuery } = useApi(); const { data, isLoading, error } = useQuery(['websites:me'], () => get('/me/websites')); const router = useRouter(); const { basePath, query: { id }, } = router; function handleChange(value) { router.push(`/console/${value}`); } function handleClick() { window.umami.track({ url: '/page-view', referrer: 'https://www.google.com' }); window.umami.track('track-event-no-data'); window.umami.track('track-event-with-data', { test: 'test-data', boolean: true, booleanError: 'true', time: new Date(), number: 1, time2: new Date().toISOString(), nested: { test: 'test-data', number: 1, object: { test: 'test-data', }, }, array: [1, 2, 3], }); } function handleIdentifyClick() { window.umami.identify({ userId: 123, name: 'brian', number: Math.random() * 100, test: 'test-data', boolean: true, booleanError: 'true', time: new Date(), time2: new Date().toISOString(), nested: { test: 'test-data', number: 1, object: { test: 'test-data', }, }, array: [1, 2, 3], }); } if (!data) { return null; } const [websiteId] = id || []; const website = data.find(({ id }) => websiteId === id); return ( {website ? `${website.name} | Umami Console` : 'Umami Console'} {website && ( <>