@bidkernel/analytics 0.16.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analytics.global.js +1 -1
- package/dist/index.d.mts +65 -56
- package/dist/index.d.ts +65 -56
- package/dist/index.js +1441 -1513
- package/dist/index.mjs +1438 -1513
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -23,21 +23,9 @@ interface BidTrace {
|
|
|
23
23
|
creativeId?: string | undefined;
|
|
24
24
|
}
|
|
25
25
|
declare const BidTrace: MessageFns<BidTrace>;
|
|
26
|
-
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
27
|
-
type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
28
|
-
[K in keyof T]?: DeepPartial<T[K]>;
|
|
29
|
-
} : Partial<T>;
|
|
30
|
-
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
31
|
-
type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
|
32
|
-
[K in keyof P]: Exact<P[K], I[K]>;
|
|
33
|
-
} & {
|
|
34
|
-
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
|
35
|
-
};
|
|
36
26
|
interface MessageFns<T> {
|
|
37
27
|
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
38
28
|
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
39
|
-
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
|
40
|
-
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
|
41
29
|
}
|
|
42
30
|
|
|
43
31
|
interface AnalyticsConfig {
|
|
@@ -83,24 +71,6 @@ interface SlotObserveOptions {
|
|
|
83
71
|
refreshIndex?: number;
|
|
84
72
|
emitRefreshEvent?: boolean;
|
|
85
73
|
}
|
|
86
|
-
interface VideoPlayerOptions {
|
|
87
|
-
/** The ad unit code / slot identifier for analytics reporting */
|
|
88
|
-
adUnitCode?: string;
|
|
89
|
-
slotId?: string;
|
|
90
|
-
auctionId?: string;
|
|
91
|
-
transactionId?: string;
|
|
92
|
-
bid?: any;
|
|
93
|
-
metadata?: Record<string, string>;
|
|
94
|
-
refreshIndex?: number;
|
|
95
|
-
/** Whether to automatically track IAB video viewability (2s continuous >=50% in-view) and Time-in-View. Defaults to true. */
|
|
96
|
-
trackViewability?: boolean;
|
|
97
|
-
/** Custom callback when impression is triggered */
|
|
98
|
-
onImpression?: (slotId: string, details: any) => void;
|
|
99
|
-
/** Custom callback when playback milestone reached (25%, 50%, 75%, 100%) */
|
|
100
|
-
onMilestone?: (milestone: "firstQuartile" | "midpoint" | "thirdQuartile" | "complete", slotId: string) => void;
|
|
101
|
-
/** Custom callback when render / playback error occurs */
|
|
102
|
-
onError?: (error: any) => void;
|
|
103
|
-
}
|
|
104
74
|
interface CachedWinningBid {
|
|
105
75
|
bidTrace: BidTrace;
|
|
106
76
|
auctionId: string;
|
|
@@ -115,6 +85,7 @@ interface SlotViewabilityState {
|
|
|
115
85
|
timeInViewMs: number;
|
|
116
86
|
refreshIndex: number;
|
|
117
87
|
}
|
|
88
|
+
declare const CACHED_BID_TTL_MS: number;
|
|
118
89
|
/**
|
|
119
90
|
* The ingest endpoint decides where auction telemetry -- CPMs, deal IDs,
|
|
120
91
|
* advertiser domains, user and session IDs -- is shipped, and it arrives from
|
|
@@ -154,17 +125,9 @@ declare class PrebidEventDeduper {
|
|
|
154
125
|
private seenKeys;
|
|
155
126
|
isDuplicate(eventName: string, data: any): boolean;
|
|
156
127
|
}
|
|
157
|
-
/**
|
|
158
|
-
* Hooks Google IMA SDK methods to automatically intercept AdsManager creation
|
|
159
|
-
* across active BidkernelPrebidAnalytics instances without requiring manual
|
|
160
|
-
* publisher calls to attachImaAdsManager.
|
|
161
|
-
*/
|
|
162
|
-
declare function hookImaPrototype(ima: any): void;
|
|
163
|
-
declare function initImaInterception(): void;
|
|
164
128
|
declare class BidkernelPrebidAnalytics {
|
|
165
129
|
private static activeInstances;
|
|
166
130
|
static getActiveInstances(): Set<BidkernelPrebidAnalytics>;
|
|
167
|
-
static initImaInterception(): void;
|
|
168
131
|
/**
|
|
169
132
|
* Allows or forbids localStorage writes for every instance on the page.
|
|
170
133
|
* Collection and delivery are unaffected: only the persisted session id,
|
|
@@ -269,11 +232,6 @@ declare class BidkernelPrebidAnalytics {
|
|
|
269
232
|
* consecutively, so eviction takes a whole bid's aliases together.
|
|
270
233
|
*/
|
|
271
234
|
private pruneCachedWinningBids;
|
|
272
|
-
/**
|
|
273
|
-
* Searches cached winning bids for an entry matching the given filters (creativeId,
|
|
274
|
-
* adId, or mediaType), falling back to the most recent winning video bid.
|
|
275
|
-
*/
|
|
276
|
-
private findCachedWinningBid;
|
|
277
235
|
/** Records a dedup key, evicting oldest-first at the cap. */
|
|
278
236
|
private addImpressionKey;
|
|
279
237
|
/**
|
|
@@ -287,18 +245,6 @@ declare class BidkernelPrebidAnalytics {
|
|
|
287
245
|
recordImpression(slotId: string, options?: SlotObserveOptions & {
|
|
288
246
|
bid?: any;
|
|
289
247
|
}): boolean;
|
|
290
|
-
/**
|
|
291
|
-
* Bridges Google IMA SDK AdsManager events to Bidkernel analytics.
|
|
292
|
-
* Defers IMPRESSION emission until AdEvent.STARTED (or IMPRESSION),
|
|
293
|
-
* tracks milestones (FIRST_QUARTILE, MIDPOINT, THIRD_QUARTILE, COMPLETE),
|
|
294
|
-
* and handles AD_ERROR.
|
|
295
|
-
*/
|
|
296
|
-
attachImaAdsManager(adsManager: any, options?: VideoPlayerOptions): () => void;
|
|
297
|
-
/**
|
|
298
|
-
* Attaches render hooks and viewability tracking to a video player.
|
|
299
|
-
* Supports HTML5 <video> elements, container elements, or Google IMA AdsManager.
|
|
300
|
-
*/
|
|
301
|
-
attachVideoPlayer(target: any, options?: VideoPlayerOptions): () => void;
|
|
302
248
|
onTimeInViewThreshold(slotId: string, thresholdMs: number, callback: (slotId: string, durationMs: number) => void): () => void;
|
|
303
249
|
getViewabilityState(slotId: string): SlotViewabilityState | undefined;
|
|
304
250
|
/** The validated ingest endpoint in use, or "" when none passed validation. */
|
|
@@ -336,6 +282,69 @@ declare class BidkernelPrebidAnalytics {
|
|
|
336
282
|
}
|
|
337
283
|
declare function registerPrebidAnalytics(pbjsGlobalName?: string, defaults?: Partial<AnalyticsConfig>): void;
|
|
338
284
|
|
|
285
|
+
/**
|
|
286
|
+
* Video and Google IMA support for the analytics adapter: render-triggered
|
|
287
|
+
* impressions from a video player or an IMA AdsManager, and the automatic
|
|
288
|
+
* IMA interception that hooks every AdsManager the page creates.
|
|
289
|
+
*
|
|
290
|
+
* Importing this module installs attachVideoPlayer and attachImaAdsManager
|
|
291
|
+
* on BidkernelPrebidAnalytics and starts the interception, so the package's
|
|
292
|
+
* public entry (index.ts) and the standalone bundle carry the full API. The
|
|
293
|
+
* display-only SDK imports the core module alone and ships none of this.
|
|
294
|
+
*/
|
|
295
|
+
interface VideoPlayerOptions {
|
|
296
|
+
/** The ad unit code / slot identifier for analytics reporting */
|
|
297
|
+
adUnitCode?: string;
|
|
298
|
+
slotId?: string;
|
|
299
|
+
auctionId?: string;
|
|
300
|
+
transactionId?: string;
|
|
301
|
+
bid?: any;
|
|
302
|
+
metadata?: Record<string, string>;
|
|
303
|
+
refreshIndex?: number;
|
|
304
|
+
/** Whether to automatically track IAB video viewability (2s continuous >=50% in-view) and Time-in-View. Defaults to true. */
|
|
305
|
+
trackViewability?: boolean;
|
|
306
|
+
/** Custom callback when impression is triggered */
|
|
307
|
+
onImpression?: (slotId: string, details: any) => void;
|
|
308
|
+
/** Custom callback when playback milestone reached (25%, 50%, 75%, 100%) */
|
|
309
|
+
onMilestone?: (milestone: "firstQuartile" | "midpoint" | "thirdQuartile" | "complete", slotId: string) => void;
|
|
310
|
+
/** Custom callback when render / playback error occurs */
|
|
311
|
+
onError?: (error: any) => void;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Hooks Google IMA SDK methods to automatically intercept AdsManager creation
|
|
315
|
+
* across active BidkernelPrebidAnalytics instances without requiring manual
|
|
316
|
+
* publisher calls to attachImaAdsManager.
|
|
317
|
+
*/
|
|
318
|
+
declare function hookImaPrototype(ima: any): void;
|
|
319
|
+
declare function initImaInterception(): void;
|
|
320
|
+
/**
|
|
321
|
+
* Bridges Google IMA SDK AdsManager events to Bidkernel analytics.
|
|
322
|
+
* Defers IMPRESSION emission until AdEvent.STARTED (or IMPRESSION),
|
|
323
|
+
* tracks milestones (FIRST_QUARTILE, MIDPOINT, THIRD_QUARTILE, COMPLETE),
|
|
324
|
+
* and handles AD_ERROR.
|
|
325
|
+
*/
|
|
326
|
+
declare function attachImaAdsManager(analytics: BidkernelPrebidAnalytics, adsManager: any, options?: VideoPlayerOptions): () => void;
|
|
327
|
+
/**
|
|
328
|
+
* Attaches render hooks and viewability tracking to a video player.
|
|
329
|
+
* Supports HTML5 <video> elements, container elements, or Google IMA AdsManager.
|
|
330
|
+
*/
|
|
331
|
+
declare function attachVideoPlayer(analytics: BidkernelPrebidAnalytics, target: any, options?: VideoPlayerOptions): () => void;
|
|
332
|
+
declare module "./prebid-analytics" {
|
|
333
|
+
interface BidkernelPrebidAnalytics {
|
|
334
|
+
/**
|
|
335
|
+
* Bridges Google IMA SDK AdsManager events to Bidkernel analytics: the
|
|
336
|
+
* IMPRESSION is deferred until AdEvent.STARTED (or IMPRESSION), quartile
|
|
337
|
+
* milestones are reported, and AD_ERROR becomes an adRenderFailed.
|
|
338
|
+
*/
|
|
339
|
+
attachImaAdsManager(adsManager: any, options?: VideoPlayerOptions): () => void;
|
|
340
|
+
/**
|
|
341
|
+
* Attaches render hooks and viewability tracking to a video player: an
|
|
342
|
+
* HTML5 <video> element, a container element, or an IMA AdsManager.
|
|
343
|
+
*/
|
|
344
|
+
attachVideoPlayer(target: any, options?: VideoPlayerOptions): () => void;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
339
348
|
type SlotSize = [number, number];
|
|
340
349
|
type SlotSizes = SlotSize[];
|
|
341
350
|
interface SizeMapping {
|
|
@@ -402,4 +411,4 @@ interface AdsGlobal {
|
|
|
402
411
|
*/
|
|
403
412
|
declare function getbidkernel(alias?: string): AdsGlobal;
|
|
404
413
|
|
|
405
|
-
export { type AdsGlobal, type AnalyticsConfig, BidkernelPrebidAnalytics, type CachedWinningBid, PrebidEventDeduper, type SizeMapping, type SlotConfig, type SlotObserveOptions, type SlotSize, type SlotSizes, type SlotViewabilityState, type VideoPlayerOptions, getOrCreateSessionId, getPrebidEventKey, getbidkernel, hookImaPrototype, initImaInterception, isTrustedEndpoint, registerPrebidAnalytics };
|
|
414
|
+
export { type AdsGlobal, type AnalyticsConfig, BidkernelPrebidAnalytics, CACHED_BID_TTL_MS, type CachedWinningBid, PrebidEventDeduper, type SizeMapping, type SlotConfig, type SlotObserveOptions, type SlotSize, type SlotSizes, type SlotViewabilityState, type VideoPlayerOptions, attachImaAdsManager, attachVideoPlayer, getOrCreateSessionId, getPrebidEventKey, getbidkernel, hookImaPrototype, initImaInterception, isTrustedEndpoint, registerPrebidAnalytics };
|