Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
"@radix-ui/react-toggle": "^1.1.9",
"@radix-ui/react-toggle-group": "^1.1.10",
"@radix-ui/react-tooltip": "^1.2.7",
"@vercel/analytics": "^1.6.1",
"@vercel/speed-insights": "^1.3.1",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"cmdk": "^1.1.1",
Expand Down
4 changes: 4 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { Extras } from "@/components/sections/Extras";
import { Contact } from "@/components/sections/Contact";
import { ThemeProvider } from "@/contexts/ThemeContext";
import { MixerPanel } from "@/components/MixerPanel";
import { Analytics } from "@vercel/analytics/react";
import { SpeedInsights } from "@vercel/speed-insights/react";

const App = () => {
const [currentPage, setCurrentPage] = useState<string>("about");
Expand Down Expand Up @@ -53,6 +55,8 @@ const App = () => {
<Layout currentPage={currentPage} onNavigate={handleNavigate}>
{renderPage()}
</Layout>
<Analytics />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Vercel Analytics requires manual page view tracking for Single-Page Applications that are not Next.js, Gatsby, or Remix. Without this, only the initial page load is tracked, and subsequent client-side navigations will be missed, making the analytics data incomplete.

You should import track from @vercel/analytics and call it within your handleHashChange function to record page views on navigation.

Example:

import { track } from '@vercel/analytics';

//... inside useEffect
const handleHashChange = () => {
    const newPage = getRoute();
    setCurrentPage(newPage);
    track('Pageview', { path: window.location.pathname + window.location.hash });
    window.scrollTo({ top: 0, behavior: 'auto' });
};

<SpeedInsights />
</TooltipProvider>
</ThemeProvider>
);
Expand Down