UNPKG

admesh-ui-sdk

Version:

Beautiful, modern React components for displaying AI-powered product recommendations with citation-based conversation ads, auto-triggered widgets, floating chat, conversational interfaces, persistent sidebar, and built-in tracking. Includes zero-code SDK

67 lines 2.49 kB
/** * AdMesh Tracker * * Handles MRC-compliant exposure tracking for recommendations * * MRC Viewability Standards: * - Display Ads: 50% of pixels visible for at least 1 continuous second * - Large Display Ads (>242,500 pixels): 30% of pixels visible for at least 1 continuous second */ export interface TrackerConfig { apiKey: string; debug?: boolean; } /** * MRC Viewability threshold configuration */ interface MRCThreshold { visibilityPercentage: number; minimumDurationMs: number; } export declare class AdMeshTracker { private firedExposures; private debug; private mrcThreshold; constructor(config: TrackerConfig); /** * Fire an exposure tracking pixel with MRC viewability compliance * * This method should be called when an ad element becomes viewable according to MRC standards. * The caller is responsible for ensuring the ad meets the MRC threshold before calling this method. * * Prevents duplicate firing for the same ad in the same session. * * @param exposureUrl - The tracking pixel URL to fire * @param adId - The ad ID for deduplication * @param sessionId - The session ID for deduplication */ fireExposure(exposureUrl: string, adId: string, sessionId: string): void; /** * Fire an exposure pixel with MRC viewability verification * * This method monitors an element for MRC viewability compliance before firing the exposure pixel. * It uses Intersection Observer API to track visibility and ensures the ad meets the threshold * (50% visible for 1 continuous second) before firing. * * @param exposureUrl - The tracking pixel URL to fire * @param adId - The ad ID for deduplication * @param sessionId - The session ID for deduplication * @param element - The DOM element to monitor for viewability * @returns Promise that resolves when exposure is fired or timeout occurs */ fireExposureWithMRCCompliance(exposureUrl: string, adId: string, sessionId: string, element: HTMLElement): Promise<void>; /** * Clear fired exposures (useful for testing or session reset) */ clearFiredExposures(): void; /** * Get MRC threshold configuration */ getMRCThreshold(): MRCThreshold; /** * Set custom MRC threshold (for testing or special cases) */ setMRCThreshold(threshold: Partial<MRCThreshold>): void; } export {}; //# sourceMappingURL=AdMeshTracker.d.ts.map