diff --git a/src/runtime/directives/v-posthog-capture.ts b/src/runtime/directives/v-posthog-capture.ts index 791a10d..e248f04 100644 --- a/src/runtime/directives/v-posthog-capture.ts +++ b/src/runtime/directives/v-posthog-capture.ts @@ -4,6 +4,10 @@ import type { ObjectDirective, FunctionDirective } from 'vue'; const directive: FunctionDirective = (el, { value, arg }) => { const { $clientPosthog } = useNuxtApp(); + if (el.hasAttribute('posthog-listener')) return; + + el.setAttribute('posthog-listener', 'true'); + el.addEventListener(arg ?? 'click', () => { if (!$clientPosthog) return;