analytics-plugin-plausible
Version:
Plausible support for Analytics
36 lines (35 loc) • 859 B
TypeScript
import { AnalyticsInstance } from "analytics";
declare type IPluginProps = {
instance: AnalyticsInstance;
config: IPluginConfig;
};
declare type IPluginConfig = {
apiHost?: string;
domain?: string;
hashMode?: boolean;
trackLocalhost?: boolean;
};
interface IProps {
payload: IPayload;
}
declare type IPayload = {
event: string;
properties: {
readonly [propName: string]: string;
};
};
export default function plausiblePlugin(pluginConfig: IPluginConfig): {
name: string;
config: {
apiHost?: string;
domain?: string;
hashMode?: boolean;
trackLocalhost?: boolean;
enabled: boolean;
};
initialize: ({ config }: IPluginProps) => void;
loaded: () => boolean;
page: ({ payload }: IProps) => void;
track: ({ payload }: IProps) => void;
};
export {};