UNPKG

v-plausible

Version:
54 lines (53 loc) 1.73 kB
import Plausible from 'plausible-tracker'; import type { PlausibleOptions } from 'plausible-tracker'; import type { App } from 'vue'; export type IPlausible = typeof Plausible; export type ReturnUsePlasuible = Omit<ReturnType<typeof Plausible>, 'enableAutoPageviews' | 'enableAutoOutboundTracking'>; export interface OptionPlugin { /** * Plausible options * @type PlausibleOptions */ init: PlausibleOptions; /** * Plausible Settings * @type InstallOptions */ settings: InstallOptions; /** * Partytown support * @default false * @type boolean * @link https://partytown.builder.io/how-does-partytown-work */ partytown?: boolean; } export interface InstallOptions { /** * Enables automatic page view tracking for SPAs * @default false * @see https://github.com/plausible/plausible-tracker * @type boolean */ enableAutoPageviews?: boolean; /** * Outbound link click tracking * @default false * @see https://plausible.io/docs/outbound-link-click-tracking * @type boolean * */ enableAutoOutboundTracking?: boolean; } export declare function createPlausible(options: OptionPlugin): { install(app: App): void; }; export declare function usePlausible(): { trackEvent: (eventName: string, options?: import("plausible-tracker").EventOptions | undefined, eventData?: PlausibleOptions | undefined) => void; trackPageview: (eventData?: PlausibleOptions | undefined, options?: import("plausible-tracker").EventOptions | undefined) => void; }; declare module '@vue/runtime-core' { interface ComponentCustomProperties { $plausible: ReturnType<typeof Plausible>; } }