Add Umami analytics tracking for key user interactions

Integrates Umami analytics with production-only tracking script and event tracking for user login and location creation actions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Knee Cola
2025-11-26 20:55:05 +01:00
parent 86d3587fb7
commit d898f79ba3
3 changed files with 10 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
import '@/app/ui/global.css';
import { inter } from '@/app/ui/fonts';
import { Metadata } from 'next';
import Script from 'next/script';
export const metadata:Metadata = {
alternates: {
@@ -43,6 +44,13 @@ export default function RootLayout({
}) {
return (
<html lang={locale}>
{process.env.NODE_ENV === 'production' && (
<Script
src="https://umami.rezije.app/script.js"
data-website-id="fcd97697-de4b-4a36-b40a-ddb22761cd06"
strategy="afterInteractive"
/>
)}
<body className={`${inter.className} antialiased`}>{children}</body>
</html>
);

View File

@@ -17,7 +17,7 @@ export const AddLocationButton:React.FC<AddLocationButtonProps> = ({yearMonth})
return(
<div className="card card-compact card-bordered bg-base-100 shadow-s my-1">
<Link href={`/home/location/${ formatYearMonth(yearMonth) }/add`} className="card-body tooltip self-center" data-tip={t("tooltip")}>
<Link href={`/home/location/${ formatYearMonth(yearMonth) }/add`} className="card-body tooltip self-center" data-tip={t("tooltip")} data-umami-event="add-new-location">
<span className='flex self-center'>
<HomeIcon className="h-[1em] w-[1em] cursor-pointer text-4xl" />
<PlusCircleIcon className="h-[1em] w-[1em] cursor-pointer text-xl text-green-500 ml-[-.6em] mt-[-.4em]" />

View File

@@ -21,7 +21,7 @@ export const SignInButton:React.FC<{ provider: {id:string, name:string} }> = ({
const t = useTranslations("login-page");
return(
<button className="btn btn-neutral m-1" onClick={() => signIn(provider.id, { callbackUrl:"/home" }) }>
<button className="btn btn-neutral m-1" onClick={() => signIn(provider.id, { callbackUrl:"/home" }) } data-umami-event="user-login">
<Image alt="Provider Logo" loading="lazy" height="24" width="24" id="provider-logo-dark" src={providerLogo(provider)} />
<span>
{t("sign-in-button")} {provider.name}</span>