@bidspark/analytics 0.43.1 → 0.45.2
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 +40 -10
- package/dist/index.d.ts +40 -10
- package/dist/index.js +331 -131
- package/dist/index.mjs +329 -130
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -44,6 +44,8 @@ declare const TraceEventType: {
|
|
|
44
44
|
* signals (bitmask), sdk_loaded, device (mobile|desktop), browser, forced ("1" on forced show).
|
|
45
45
|
*/
|
|
46
46
|
readonly RECOVERY: 20;
|
|
47
|
+
/** PAGEVIEW - Pageview start (once per initial load or SPA navigate()). */
|
|
48
|
+
readonly PAGEVIEW: 21;
|
|
47
49
|
readonly UNRECOGNIZED: -1;
|
|
48
50
|
};
|
|
49
51
|
type TraceEventType = typeof TraceEventType[keyof typeof TraceEventType];
|
|
@@ -63,14 +65,15 @@ declare namespace TraceEventType {
|
|
|
63
65
|
type WARN = typeof TraceEventType.WARN;
|
|
64
66
|
type CONSENT = typeof TraceEventType.CONSENT;
|
|
65
67
|
type RECOVERY = typeof TraceEventType.RECOVERY;
|
|
68
|
+
type PAGEVIEW = typeof TraceEventType.PAGEVIEW;
|
|
66
69
|
type UNRECOGNIZED = typeof TraceEventType.UNRECOGNIZED;
|
|
67
70
|
}
|
|
68
71
|
/** Per-bid metrics for reporting warehouse. CPM is gross value reported by bidder. */
|
|
69
72
|
interface BidTrace {
|
|
70
73
|
bidder?: string | undefined;
|
|
71
|
-
/**
|
|
74
|
+
/** Prebid-converted CPM; falls back to originalCpm if absent */
|
|
72
75
|
cpm?: number | undefined;
|
|
73
|
-
/**
|
|
76
|
+
/** Prebid-converted currency; falls back to originalCurrency (default "USD") */
|
|
74
77
|
currency?: string | undefined;
|
|
75
78
|
width?: number | undefined;
|
|
76
79
|
height?: number | undefined;
|
|
@@ -108,6 +111,11 @@ declare function normalizeSampleRate(rate?: number): number;
|
|
|
108
111
|
* The same visitor key maps to the same uniform bucket across pageviews and sessions.
|
|
109
112
|
*/
|
|
110
113
|
declare function isVisitorSampled(visitorKey: string, sampleRate?: number): boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Detects client-side browser automation or headless environments via strong
|
|
116
|
+
* automation flags/UA tokens or >=2 concurrent weak headless anomalies.
|
|
117
|
+
*/
|
|
118
|
+
declare function isAutomatedClient(): boolean;
|
|
111
119
|
|
|
112
120
|
interface AnalyticsConfig {
|
|
113
121
|
endpoint: string;
|
|
@@ -229,11 +237,8 @@ declare function sessionStarted(): boolean;
|
|
|
229
237
|
declare function clearStoredSession(): void;
|
|
230
238
|
declare function getOrCreateUserId(): string;
|
|
231
239
|
declare function clearStoredUserId(): void;
|
|
232
|
-
declare function resetTcfListener(): void;
|
|
233
240
|
/**
|
|
234
|
-
* Canonical duplicate-detection key for a Prebid event.
|
|
235
|
-
* and the diagnostic extension so the two can never drift apart. Covers the
|
|
236
|
-
* events the adapter forwards plus display-only events the extension shows.
|
|
241
|
+
* Canonical duplicate-detection key for a Prebid event.
|
|
237
242
|
*/
|
|
238
243
|
declare function getPrebidEventKey(eventName: string, data: any): string;
|
|
239
244
|
/**
|
|
@@ -244,6 +249,10 @@ declare class PrebidEventDeduper {
|
|
|
244
249
|
private seenKeys;
|
|
245
250
|
isDuplicate(eventName: string, data: any): boolean;
|
|
246
251
|
}
|
|
252
|
+
declare function parseBidDimensions(bid: any): {
|
|
253
|
+
width: number;
|
|
254
|
+
height: number;
|
|
255
|
+
};
|
|
247
256
|
declare class BidsparkPrebidAnalytics {
|
|
248
257
|
private static activeInstances;
|
|
249
258
|
private static allInstances;
|
|
@@ -290,9 +299,14 @@ declare class BidsparkPrebidAnalytics {
|
|
|
290
299
|
private recordedConsentKeys;
|
|
291
300
|
private consentCount;
|
|
292
301
|
private cmpDetach;
|
|
302
|
+
private pageviewEmitted;
|
|
293
303
|
private logger;
|
|
294
304
|
private managesSessionId;
|
|
305
|
+
private configuredUserId;
|
|
306
|
+
private managesVisitorId;
|
|
307
|
+
private visitorKeyLocked;
|
|
295
308
|
constructor(config: AnalyticsConfig);
|
|
309
|
+
private applyStorageAllowed;
|
|
296
310
|
setLogLevel(level: LogLevel | string): void;
|
|
297
311
|
getLogLevel(): LogLevel;
|
|
298
312
|
enable(): void;
|
|
@@ -395,14 +409,25 @@ declare class BidsparkPrebidAnalytics {
|
|
|
395
409
|
* is available from the configured alias. Returns a detach function.
|
|
396
410
|
*/
|
|
397
411
|
attachCmp(): () => void;
|
|
398
|
-
/** Device storage follows the decision; a refusal also drops
|
|
412
|
+
/** Device storage follows the decision; a refusal also drops stored session and user IDs. */
|
|
399
413
|
private followConsent;
|
|
400
414
|
setUserId(userId: string): void;
|
|
401
415
|
setVisitorId(visitorId: string): void;
|
|
402
416
|
setSampleRate(sampleRate?: number): void;
|
|
403
417
|
setSessionId(sessionId: string): void;
|
|
404
|
-
|
|
405
|
-
|
|
418
|
+
getSessionId(): string;
|
|
419
|
+
getPageviewId(): string;
|
|
420
|
+
getContext(): {
|
|
421
|
+
pageviewId: string;
|
|
422
|
+
sessionId: string;
|
|
423
|
+
};
|
|
424
|
+
/**
|
|
425
|
+
* Continues the pageview of the instance this one replaces: re-registering on
|
|
426
|
+
* the same page must not count a second pageview or replay Prebid's history.
|
|
427
|
+
*/
|
|
428
|
+
continuePageview(previous: BidsparkPrebidAnalytics): void;
|
|
429
|
+
navigate(pageviewId: string, pageUrl?: string): void;
|
|
430
|
+
recordAuctionStart(auctionId: string, adUnitCode?: string, bidderCount?: number, mediaType?: string): void;
|
|
406
431
|
private handleAuctionInit;
|
|
407
432
|
private handleAuctionEnd;
|
|
408
433
|
/**
|
|
@@ -423,6 +448,7 @@ declare class BidsparkPrebidAnalytics {
|
|
|
423
448
|
private handleAdRenderSucceeded;
|
|
424
449
|
private isDuplicate;
|
|
425
450
|
private enqueue;
|
|
451
|
+
private syncSessionId;
|
|
426
452
|
private isSampledVisitor;
|
|
427
453
|
private shouldSample;
|
|
428
454
|
private requeue;
|
|
@@ -634,6 +660,10 @@ interface AdsGlobal {
|
|
|
634
660
|
pageviewId: string;
|
|
635
661
|
sessionId: string;
|
|
636
662
|
};
|
|
663
|
+
/** Returns current session ID. */
|
|
664
|
+
getSessionId?: () => string;
|
|
665
|
+
/** Returns current pageview ID. */
|
|
666
|
+
getPageviewId?: () => string;
|
|
637
667
|
/** Registers slot from CSS selector; reads element dimensions if config omitted. */
|
|
638
668
|
defineSlot?: (selector: string, config?: Partial<SlotConfig>) => void;
|
|
639
669
|
/** Tears down single slot by element ID. */
|
|
@@ -658,4 +688,4 @@ interface AdsGlobal {
|
|
|
658
688
|
*/
|
|
659
689
|
declare function getAdsGlobal(alias?: string): AdsGlobal;
|
|
660
690
|
|
|
661
|
-
export { type AdsGlobal, type AnalyticsConfig, type BeaconEvent, BidsparkPrebidAnalytics, CACHED_BID_TTL_MS, type CachedWinningBid, type ConsentRecord, DEFAULT_ALIAS, type FloorDecision, ImaAdsManagerStub, LogLevel, MAX_USAGE_BATCH_SIZE, PrebidEventDeduper, SAFE_CONTENT_TYPE, type SendEventsOptions, type SizeMapping, type SlotConfig, type SlotObserveOptions, type SlotSize, type SlotSizes, type SlotViewabilityState, USAGE_FLUSH_INTERVAL_MS, usage_event as UsageProto, UsageRecorder, type UsageRecorderOptions, type VideoPlayerOptions, attachImaAdsManager, attachVideoPlayer, clearStoredSession, clearStoredUserId, generateUUID, getAdsGlobal, getOrCreateSessionId, getOrCreateUserId, getPrebidEventKey, idToBytes, idToString, isSessionActive, isTrustedEndpoint, isVisitorSampled, normalizeLogLevel, normalizeSampleRate, onSessionResume,
|
|
691
|
+
export { type AdsGlobal, type AnalyticsConfig, type BeaconEvent, BidsparkPrebidAnalytics, CACHED_BID_TTL_MS, type CachedWinningBid, type ConsentRecord, DEFAULT_ALIAS, type FloorDecision, ImaAdsManagerStub, LogLevel, MAX_USAGE_BATCH_SIZE, PrebidEventDeduper, SAFE_CONTENT_TYPE, type SendEventsOptions, type SizeMapping, type SlotConfig, type SlotObserveOptions, type SlotSize, type SlotSizes, type SlotViewabilityState, USAGE_FLUSH_INTERVAL_MS, usage_event as UsageProto, UsageRecorder, type UsageRecorderOptions, type VideoPlayerOptions, attachImaAdsManager, attachVideoPlayer, clearStoredSession, clearStoredUserId, generateUUID, getAdsGlobal, getOrCreateSessionId, getOrCreateUserId, getPrebidEventKey, idToBytes, idToString, isAutomatedClient, isSessionActive, isTrustedEndpoint, isVisitorSampled, normalizeLogLevel, normalizeSampleRate, onSessionResume, parseBidDimensions, registerPrebidAnalytics, sendEvents, sessionStarted };
|