UNPKG

@piwikpro/tracking-base-library

Version:

Piwik PRO basic tracking library for the frontend.

61 lines (60 loc) 2.56 kB
import { Dimensions } from './../../interfaces/utils'; /** * Manually tracks outlink or download event with provided values */ export declare function trackLink(url: string, linkType: string, dimensions?: Dimensions, callback?: () => void): void; /** * Enables automatic link tracking. If called with `true`, left, right and * middle clicks on links will be treated as opening a link. Opening a links to * an external site (different domain) creates an outlink event. Opening a link * to a downloadable file creates a download event */ export declare function enableLinkTracking(trackAlsoMiddleAndRightClicks?: boolean): void; /** * Sets a list of class names that indicate whether a link is an outlink and not download */ export declare function setLinkClasses(classes: string[]): void; /** * Overwrites the list of file extensions indicating that a link is a download */ export declare function setDownloadExtensions(extensions: string[]): void; /** * Adds new extensions to the download extensions list */ export declare function addDownloadExtensions(extensions: string[]): void; /** * Removes extensions from the download extensions list */ export declare function removeDownloadExtensions(extensions: string[]): void; /** * When a visitor produces an events and closes the page immediately afterwards, * e.g. when opening a link, the request might get cancelled. To avoid loosing * the last event this way, JavaScript Tracking Client will lock the page for a * fraction of a second (if wait time hasn’t passed), giving the request time to * reach the Collecting & Processing Pipeline */ export declare function setLinkTrackingTimer(time: number): void; /** * Returns lock/wait time after a request set by setLinkTrackingTimer */ export declare function getLinkTrackingTimer(): Promise<number>; /** * Set a list of class names that indicate a link should not be tracked */ export declare function setIgnoreClasses(classes: string[]): void; /** * Returns list of download classes (CSS classes that indicate a link is a download) */ export declare function getDownloadClasses(): Promise<string[]>; /** * Sets a list of class names that indicate whether a list is a download and not an outlink */ export declare function setDownloadClasses(classes: string[]): void; /** * Adds new classes to the download classes list */ export declare function addDownloadClasses(classes: string[]): void; /** * Removes classes from the download classes list */ export declare function removeDownloadClasses(classes: string[]): void;