mirror of
https://github.com/go-task/task.git
synced 2026-09-02 12:16:04 +02:00
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:
@@ -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 }}
|
||||
|
||||
Reference in New Issue
Block a user