UNPKG

@yeskunall/astro-umami

Version:

Add Umami Analytics to your Astro website

52 lines (49 loc) 1.71 kB
import { AstroIntegration } from 'astro'; type OptionalExceptFor<T, K extends keyof T> = { [P in keyof T]: P extends K ? T[P] : T[P] | undefined; } & Pick<T, K>; interface UmamiOptions { /** * Umami tracks all events and pageviews for you automatically. Override this behavior if you plan on using [tracker functions](https://umami.is/docs/tracker-functions). * @default true */ autotrack?: boolean; /** * If you want the tracker to only run on specific domains, add them to this list. * * @example ["mywebsite.com", "mywebsite2.com"] */ domains?: string[]; /** * * The endpoint where your Umami instance is located. * @default https://cloud.umami.is * @example https://umami-on.fly.dev */ endpointUrl?: string; /** * Override the location where your analytics data is sent. */ hostUrl?: string; /** * The unique ID of your [website](https://umami.is/docs/add-a-website). */ id: string; /** * Assign a custom name to the tracker script. * * @default script.js * @see [https://umami.is/docs/environment-variables](https://umami.is/docs/environment-variables) */ trackerScriptName?: string; } interface Options extends UmamiOptions { /** * Serve the tracking script using [Partytown](https://partytown.qwik.dev/). * * @see [https://docs.astro.build/en/guides/integrations-guide/partytown/](https://docs.astro.build/en/guides/integrations-guide/partytown/) */ withPartytown?: boolean; } declare function umamiIntegration(options: OptionalExceptFor<Options, "id">): AstroIntegration; export { umamiIntegration as default };