@lukulent/svelte-umami
Version:
[](https://madewithsvelte.com/p/svelte-umami/shield-link)
44 lines (43 loc) • 2.38 kB
TypeScript
import type { EventData, OptionalTrackedProperties } from './types';
import type { UmamiTrackerConfiguration } from './types';
/**
* Track a page view with and without custom properties
* @param properties
* @returns
*/
export declare function trackPageView(properties?: OptionalTrackedProperties): Promise<string>;
/**
* Track an event with a given name
* @param eventName Note: event names will be truncated past 50 characters
* @param eventData Note: Event Data Limits
Event Data can work with any JSON data. There are a few rules in place to maintain performance.
- Numbers have a max precision of 4.
- Strings have a max length of 500.
- Arrays are converted to a String, with the same max length of 500.
- Objects have a max of 50 properties. Arrays are considered 1 property.
- When tracking events, the default properties are included in the payload.
* @returns
*/
export declare function trackEvent(eventName: string, eventData?: EventData): Promise<string>;
/**
* Track an event with a given name and custom properties
* @param eventName Note: event names will be truncated past 50 characters
* @param properties the default properties you want to overwrite
* @param eventData Note: Event Data Limits
Event Data can work with any JSON data. There are a few rules in place to maintain performance.
- Numbers have a max precision of 4.
- Strings have a max length of 500.
- Arrays are converted to a String, with the same max length of 500.
- Objects have a max of 50 properties. Arrays are considered 1 property.
- When tracking events, the default properties are included in the payload.
* @returns
*/
export declare function trackEventWithProperties(eventName: string, properties: OptionalTrackedProperties, eventData?: EventData): Promise<string>;
export declare function registerUmami(websiteID: string, srcURL: string, configuration: UmamiTrackerConfiguration): Promise<void>;
/**
* Svelte Event Handler, which tracks the event within UmamiAnalytics
* @param e: Event
*/
export declare function handleEvent(e: Event & {
currentTarget: HTMLElement;
}): void;