From 144dff7f85bcc303d27c1e9f6ed0dbe5702bffeb Mon Sep 17 00:00:00 2001 From: oskar Date: Wed, 24 Jun 2026 17:58:24 +0200 Subject: [PATCH] Track Umami goal 'umow-rozmowe' on successful contact submit Fire window.umami?.track('umow-rozmowe') right after the mailer returns 200 (status -> 'success'), so the conversion goal counts only real sends, not validation errors, network failures, or button clicks. Optional-chain guard keeps it a no-op on dev/localhost where the tracker isn't loaded. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/components/CTASection.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/components/CTASection.tsx b/src/components/CTASection.tsx index b768f1d..cd1fe86 100644 --- a/src/components/CTASection.tsx +++ b/src/components/CTASection.tsx @@ -3,6 +3,13 @@ import { motion } from 'framer-motion'; import { Mail, MessageSquare } from 'lucide-react'; import { useT } from '../i18n'; +declare global { + interface Window { + // Injected by the Umami script (production builds only — see vite.config.ts). + umami?: { track: (event: string) => void }; + } +} + type Status = 'idle' | 'sending' | 'success' | 'error'; const CTASection = () => { @@ -72,6 +79,9 @@ const CTASection = () => { return; } setStatus('success'); + // Fire the Umami conversion goal only after a real 200 from the mailer. + // Guarded: the tracker is absent on dev/localhost, so this must not throw. + window.umami?.track('umow-rozmowe'); } catch { setErrorMsg(t.contact.errors.generic); setStatus('error');