fix(site): track the install copy button with data-umami-event

Every other homepage link is tracked declaratively; the copy button
called window.umami directly, and only on success, so failed copies never
showed up in the stats.
This commit is contained in:
Valentin Maerten
2026-08-30 14:23:07 +02:00
parent a0b39ca549
commit 9e9c5dc767

View File

@@ -43,19 +43,11 @@ async function copyInstallCommand() {
try {
await navigator.clipboard.writeText(installCommand);
copyState.value = 'copied';
track('home-install-copy');
} catch {
copyState.value = 'failed';
}
resetCopyState();
}
function track(event: string) {
const analytics = (
window as Window & { umami?: { track: (name: string) => void } }
).umami;
analytics?.track(event);
}
</script>
<template>
@@ -76,6 +68,7 @@ function track(event: string) {
<button
type="button"
:aria-label="copyAriaLabel"
data-umami-event="home-install-copy"
@click="copyInstallCommand"
>
{{ copyLabel }}