@bidspark/analytics 0.44.0 → 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/index.d.ts CHANGED
@@ -111,6 +111,11 @@ declare function normalizeSampleRate(rate?: number): number;
111
111
  * The same visitor key maps to the same uniform bucket across pageviews and sessions.
112
112
  */
113
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;
114
119
 
115
120
  interface AnalyticsConfig {
116
121
  endpoint: string;
@@ -232,7 +237,6 @@ declare function sessionStarted(): boolean;
232
237
  declare function clearStoredSession(): void;
233
238
  declare function getOrCreateUserId(): string;
234
239
  declare function clearStoredUserId(): void;
235
- declare function resetTcfListener(): void;
236
240
  /**
237
241
  * Canonical duplicate-detection key for a Prebid event.
238
242
  */
@@ -245,6 +249,10 @@ declare class PrebidEventDeduper {
245
249
  private seenKeys;
246
250
  isDuplicate(eventName: string, data: any): boolean;
247
251
  }
252
+ declare function parseBidDimensions(bid: any): {
253
+ width: number;
254
+ height: number;
255
+ };
248
256
  declare class BidsparkPrebidAnalytics {
249
257
  private static activeInstances;
250
258
  private static allInstances;
@@ -294,7 +302,11 @@ declare class BidsparkPrebidAnalytics {
294
302
  private pageviewEmitted;
295
303
  private logger;
296
304
  private managesSessionId;
305
+ private configuredUserId;
306
+ private managesVisitorId;
307
+ private visitorKeyLocked;
297
308
  constructor(config: AnalyticsConfig);
309
+ private applyStorageAllowed;
298
310
  setLogLevel(level: LogLevel | string): void;
299
311
  getLogLevel(): LogLevel;
300
312
  enable(): void;
@@ -397,14 +409,25 @@ declare class BidsparkPrebidAnalytics {
397
409
  * is available from the configured alias. Returns a detach function.
398
410
  */
399
411
  attachCmp(): () => void;
400
- /** Device storage follows the decision; a refusal also drops the stored session. */
412
+ /** Device storage follows the decision; a refusal also drops stored session and user IDs. */
401
413
  private followConsent;
402
414
  setUserId(userId: string): void;
403
415
  setVisitorId(visitorId: string): void;
404
416
  setSampleRate(sampleRate?: number): void;
405
417
  setSessionId(sessionId: string): void;
406
- navigate(pageviewId: string, pageUrl: string): void;
407
- recordAuctionStart(auctionId: string, adUnitCode?: string, bidderCount?: number): void;
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;
408
431
  private handleAuctionInit;
409
432
  private handleAuctionEnd;
410
433
  /**
@@ -425,6 +448,7 @@ declare class BidsparkPrebidAnalytics {
425
448
  private handleAdRenderSucceeded;
426
449
  private isDuplicate;
427
450
  private enqueue;
451
+ private syncSessionId;
428
452
  private isSampledVisitor;
429
453
  private shouldSample;
430
454
  private requeue;
@@ -636,6 +660,10 @@ interface AdsGlobal {
636
660
  pageviewId: string;
637
661
  sessionId: string;
638
662
  };
663
+ /** Returns current session ID. */
664
+ getSessionId?: () => string;
665
+ /** Returns current pageview ID. */
666
+ getPageviewId?: () => string;
639
667
  /** Registers slot from CSS selector; reads element dimensions if config omitted. */
640
668
  defineSlot?: (selector: string, config?: Partial<SlotConfig>) => void;
641
669
  /** Tears down single slot by element ID. */
@@ -660,4 +688,4 @@ interface AdsGlobal {
660
688
  */
661
689
  declare function getAdsGlobal(alias?: string): AdsGlobal;
662
690
 
663
- 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, registerPrebidAnalytics, resetTcfListener, sendEvents, sessionStarted };
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 };