@bidspark/analytics 0.45.2 → 0.46.1
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/README.md +29 -0
- package/dist/analytics.global.js +1 -1
- package/dist/index.d.mts +20 -5
- package/dist/index.d.ts +20 -5
- package/dist/index.js +136 -159
- package/dist/index.mjs +135 -159
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -117,6 +117,15 @@ declare function isVisitorSampled(visitorKey: string, sampleRate?: number): bool
|
|
|
117
117
|
*/
|
|
118
118
|
declare function isAutomatedClient(): boolean;
|
|
119
119
|
|
|
120
|
+
interface PageEventDetail {
|
|
121
|
+
pageviewId: string;
|
|
122
|
+
sessionId: string;
|
|
123
|
+
}
|
|
124
|
+
type PageEventHandler = (detail: PageEventDetail) => void;
|
|
125
|
+
interface PageEventsConfig {
|
|
126
|
+
pageview?: string | PageEventHandler;
|
|
127
|
+
session?: string | PageEventHandler;
|
|
128
|
+
}
|
|
120
129
|
interface AnalyticsConfig {
|
|
121
130
|
endpoint: string;
|
|
122
131
|
/** Usage endpoint origin (e.g. "https://by.bidspark.io/u"). */
|
|
@@ -154,6 +163,8 @@ interface AnalyticsConfig {
|
|
|
154
163
|
revenueFlushDelayMs?: number;
|
|
155
164
|
/** Window global alias for CMP instance. Defaults to "ads". */
|
|
156
165
|
alias?: string;
|
|
166
|
+
/** Custom DOM event names or callback handlers for pageview and session start. */
|
|
167
|
+
events?: PageEventsConfig;
|
|
157
168
|
}
|
|
158
169
|
/** Canonical consent record shape from CMP. */
|
|
159
170
|
interface ConsentRecord {
|
|
@@ -299,6 +310,7 @@ declare class BidsparkPrebidAnalytics {
|
|
|
299
310
|
private recordedConsentKeys;
|
|
300
311
|
private consentCount;
|
|
301
312
|
private cmpDetach;
|
|
313
|
+
private sessionResumeUnsub;
|
|
302
314
|
private pageviewEmitted;
|
|
303
315
|
private logger;
|
|
304
316
|
private managesSessionId;
|
|
@@ -414,13 +426,11 @@ declare class BidsparkPrebidAnalytics {
|
|
|
414
426
|
setUserId(userId: string): void;
|
|
415
427
|
setVisitorId(visitorId: string): void;
|
|
416
428
|
setSampleRate(sampleRate?: number): void;
|
|
429
|
+
setEvents(events?: PageEventsConfig): void;
|
|
417
430
|
setSessionId(sessionId: string): void;
|
|
418
431
|
getSessionId(): string;
|
|
419
432
|
getPageviewId(): string;
|
|
420
|
-
getContext():
|
|
421
|
-
pageviewId: string;
|
|
422
|
-
sessionId: string;
|
|
423
|
-
};
|
|
433
|
+
getContext(): PageEventDetail;
|
|
424
434
|
/**
|
|
425
435
|
* Continues the pageview of the instance this one replaces: re-registering on
|
|
426
436
|
* the same page must not count a second pageview or replay Prebid's history.
|
|
@@ -449,6 +459,9 @@ declare class BidsparkPrebidAnalytics {
|
|
|
449
459
|
private isDuplicate;
|
|
450
460
|
private enqueue;
|
|
451
461
|
private syncSessionId;
|
|
462
|
+
private syncSessionAndRotateVisitor;
|
|
463
|
+
private announceSession;
|
|
464
|
+
private emitPageEvent;
|
|
452
465
|
private isSampledVisitor;
|
|
453
466
|
private shouldSample;
|
|
454
467
|
private requeue;
|
|
@@ -509,6 +522,8 @@ declare module "./prebid-analytics" {
|
|
|
509
522
|
attachVideoPlayer(target: any, options?: VideoPlayerOptions): () => void;
|
|
510
523
|
}
|
|
511
524
|
}
|
|
525
|
+
/** Installs automatic parent-window Google IMA interception for standalone/npm adapter builds. */
|
|
526
|
+
declare function installImaAutoInterception(): void;
|
|
512
527
|
/**
|
|
513
528
|
* Test double implementing Google IMA AdsManager event surface.
|
|
514
529
|
* Relays outstream events into analytics adapters with IMA-shaped objects.
|
|
@@ -688,4 +703,4 @@ interface AdsGlobal {
|
|
|
688
703
|
*/
|
|
689
704
|
declare function getAdsGlobal(alias?: string): AdsGlobal;
|
|
690
705
|
|
|
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 };
|
|
706
|
+
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, type PageEventDetail, type PageEventHandler, type PageEventsConfig, 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, installImaAutoInterception, isAutomatedClient, isSessionActive, isTrustedEndpoint, isVisitorSampled, normalizeLogLevel, normalizeSampleRate, onSessionResume, parseBidDimensions, registerPrebidAnalytics, sendEvents, sessionStarted };
|
package/dist/index.d.ts
CHANGED
|
@@ -117,6 +117,15 @@ declare function isVisitorSampled(visitorKey: string, sampleRate?: number): bool
|
|
|
117
117
|
*/
|
|
118
118
|
declare function isAutomatedClient(): boolean;
|
|
119
119
|
|
|
120
|
+
interface PageEventDetail {
|
|
121
|
+
pageviewId: string;
|
|
122
|
+
sessionId: string;
|
|
123
|
+
}
|
|
124
|
+
type PageEventHandler = (detail: PageEventDetail) => void;
|
|
125
|
+
interface PageEventsConfig {
|
|
126
|
+
pageview?: string | PageEventHandler;
|
|
127
|
+
session?: string | PageEventHandler;
|
|
128
|
+
}
|
|
120
129
|
interface AnalyticsConfig {
|
|
121
130
|
endpoint: string;
|
|
122
131
|
/** Usage endpoint origin (e.g. "https://by.bidspark.io/u"). */
|
|
@@ -154,6 +163,8 @@ interface AnalyticsConfig {
|
|
|
154
163
|
revenueFlushDelayMs?: number;
|
|
155
164
|
/** Window global alias for CMP instance. Defaults to "ads". */
|
|
156
165
|
alias?: string;
|
|
166
|
+
/** Custom DOM event names or callback handlers for pageview and session start. */
|
|
167
|
+
events?: PageEventsConfig;
|
|
157
168
|
}
|
|
158
169
|
/** Canonical consent record shape from CMP. */
|
|
159
170
|
interface ConsentRecord {
|
|
@@ -299,6 +310,7 @@ declare class BidsparkPrebidAnalytics {
|
|
|
299
310
|
private recordedConsentKeys;
|
|
300
311
|
private consentCount;
|
|
301
312
|
private cmpDetach;
|
|
313
|
+
private sessionResumeUnsub;
|
|
302
314
|
private pageviewEmitted;
|
|
303
315
|
private logger;
|
|
304
316
|
private managesSessionId;
|
|
@@ -414,13 +426,11 @@ declare class BidsparkPrebidAnalytics {
|
|
|
414
426
|
setUserId(userId: string): void;
|
|
415
427
|
setVisitorId(visitorId: string): void;
|
|
416
428
|
setSampleRate(sampleRate?: number): void;
|
|
429
|
+
setEvents(events?: PageEventsConfig): void;
|
|
417
430
|
setSessionId(sessionId: string): void;
|
|
418
431
|
getSessionId(): string;
|
|
419
432
|
getPageviewId(): string;
|
|
420
|
-
getContext():
|
|
421
|
-
pageviewId: string;
|
|
422
|
-
sessionId: string;
|
|
423
|
-
};
|
|
433
|
+
getContext(): PageEventDetail;
|
|
424
434
|
/**
|
|
425
435
|
* Continues the pageview of the instance this one replaces: re-registering on
|
|
426
436
|
* the same page must not count a second pageview or replay Prebid's history.
|
|
@@ -449,6 +459,9 @@ declare class BidsparkPrebidAnalytics {
|
|
|
449
459
|
private isDuplicate;
|
|
450
460
|
private enqueue;
|
|
451
461
|
private syncSessionId;
|
|
462
|
+
private syncSessionAndRotateVisitor;
|
|
463
|
+
private announceSession;
|
|
464
|
+
private emitPageEvent;
|
|
452
465
|
private isSampledVisitor;
|
|
453
466
|
private shouldSample;
|
|
454
467
|
private requeue;
|
|
@@ -509,6 +522,8 @@ declare module "./prebid-analytics" {
|
|
|
509
522
|
attachVideoPlayer(target: any, options?: VideoPlayerOptions): () => void;
|
|
510
523
|
}
|
|
511
524
|
}
|
|
525
|
+
/** Installs automatic parent-window Google IMA interception for standalone/npm adapter builds. */
|
|
526
|
+
declare function installImaAutoInterception(): void;
|
|
512
527
|
/**
|
|
513
528
|
* Test double implementing Google IMA AdsManager event surface.
|
|
514
529
|
* Relays outstream events into analytics adapters with IMA-shaped objects.
|
|
@@ -688,4 +703,4 @@ interface AdsGlobal {
|
|
|
688
703
|
*/
|
|
689
704
|
declare function getAdsGlobal(alias?: string): AdsGlobal;
|
|
690
705
|
|
|
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 };
|
|
706
|
+
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, type PageEventDetail, type PageEventHandler, type PageEventsConfig, 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, installImaAutoInterception, isAutomatedClient, isSessionActive, isTrustedEndpoint, isVisitorSampled, normalizeLogLevel, normalizeSampleRate, onSessionResume, parseBidDimensions, registerPrebidAnalytics, sendEvents, sessionStarted };
|