@piwikpro/tracking-base-library
Version:
Piwik PRO basic tracking library for the frontend.
33 lines (32 loc) • 1.92 kB
TypeScript
/**
* Scans the entire DOM for content blocks and tracks impressions after all page
* elements load. It does not send duplicates on repeated calls unless
* trackPageView was called in between trackAllContentImpressions invocations
*/
export declare function trackAllContentImpressions(): void;
/**
* Scans DOM for all visible content blocks and tracks impressions
* @param checkOnScroll Whether to scan for visible content on scroll event
* @param watchInterval Delay, in milliseconds, between scans for new visible content. Periodic checks can be disabled by passing 0
*/
export declare function trackVisibleContentImpressions(checkOnScroll?: boolean, watchInterval?: number): void;
export declare function trackContentImpressionsWithinNode(domNode: Node): void;
export declare function trackContentImpression(contentName: string, contentPiece: string, contentTarget: string): void;
/**
* Print all content blocks to the console for debugging purposes
*/
export declare function logAllContentBlocksOnPage(): void;
/**
* Tracks interaction with a block in domNode. Can be called from code placed in onclick attribute
* @param domNode Node marked as content block or containing content blocks. If content block can’t be found, nothing will tracked.
* @param contentInteraction Name of interaction (e.g. "click")
*/
export declare function trackContentInteractionNode(domNode: Node, contentInteraction?: string): void;
/**
* Tracks manual content interaction event
* @param contentInteraction Type of interaction (e.g. "click")
* @param contentName Name of a content block
* @param contentPiece Name of the content that was displayed (e.g. link to an image)
* @param contentTarget Where the content leads to (e.g. URL of some external website)
*/
export declare function trackContentInteraction(contentInteraction: string, contentName: string, contentPiece: string, contentTarget: string): void;