@bidspark/analytics 0.44.0 → 0.46.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/index.js CHANGED
@@ -42,14 +42,15 @@ __export(src_exports, {
42
42
  getPrebidEventKey: () => getPrebidEventKey,
43
43
  idToBytes: () => idToBytes,
44
44
  idToString: () => idToString,
45
+ isAutomatedClient: () => isAutomatedClient,
45
46
  isSessionActive: () => isSessionActive,
46
47
  isTrustedEndpoint: () => isTrustedEndpoint,
47
48
  isVisitorSampled: () => isVisitorSampled,
48
49
  normalizeLogLevel: () => normalizeLogLevel,
49
50
  normalizeSampleRate: () => normalizeSampleRate,
50
51
  onSessionResume: () => onSessionResume,
52
+ parseBidDimensions: () => parseBidDimensions,
51
53
  registerPrebidAnalytics: () => registerPrebidAnalytics,
52
- resetTcfListener: () => resetTcfListener,
53
54
  sendEvents: () => sendEvents,
54
55
  sessionStarted: () => sessionStarted
55
56
  });
@@ -1086,6 +1087,33 @@ function isVisitorSampled(visitorKey, sampleRate) {
1086
1087
  }
1087
1088
  return (hash >>> 0) / 4294967296 < rate;
1088
1089
  }
1090
+ var AUTOMATED_UA_RE = /headless|phantomjs|slimerjs|puppeteer|playwright/i;
1091
+ var DESKTOP_CHROME_UA_RE = /Chrome\/\d+/i;
1092
+ var NON_DESKTOP_CHROME_UA_RE = /Mobile|Android|iPhone|iPad|iPod|CriOS|FxiOS|Edg\/|OPR\/|SamsungBrowser/i;
1093
+ function isAutomatedClient() {
1094
+ const g = typeof globalThis !== "undefined" ? globalThis : void 0;
1095
+ const nav = g && "navigator" in g ? g.navigator : void 0;
1096
+ if (!nav) return false;
1097
+ if (nav.webdriver === true) return true;
1098
+ const ua = typeof nav.userAgent === "string" ? nav.userAgent : "";
1099
+ if (AUTOMATED_UA_RE.test(ua)) return true;
1100
+ const win = g && "window" in g ? g.window : g;
1101
+ let weakSignals = 0;
1102
+ if (win && typeof win.outerWidth === "number" && typeof win.outerHeight === "number" && win.outerWidth === 0 && win.outerHeight === 0) {
1103
+ weakSignals++;
1104
+ }
1105
+ if (Array.isArray(nav.languages) && nav.languages.length === 0) {
1106
+ weakSignals++;
1107
+ }
1108
+ if (DESKTOP_CHROME_UA_RE.test(ua) && !NON_DESKTOP_CHROME_UA_RE.test(ua)) {
1109
+ if (win && !win.chrome) weakSignals++;
1110
+ const plugins = nav.plugins;
1111
+ if (plugins !== void 0 && plugins !== null && plugins.length === 0) {
1112
+ weakSignals++;
1113
+ }
1114
+ }
1115
+ return weakSignals >= 2;
1116
+ }
1089
1117
 
1090
1118
  // ../../protogen/usage_event.ts
1091
1119
  var usage_event_exports = {};
@@ -1252,7 +1280,7 @@ function sendEvents(opts) {
1252
1280
  bidderOutcomes: []
1253
1281
  }));
1254
1282
  const nav = g && "navigator" in g ? g.navigator : void 0;
1255
- const automated = Boolean(nav && nav.webdriver === true);
1283
+ const automated = isAutomatedClient();
1256
1284
  const batch = {
1257
1285
  propertyId: idToBytes(opts.propertyId),
1258
1286
  pageviewId: idToBytes(pageviewId),
@@ -1490,9 +1518,11 @@ var CLICK_DEDUP_MS = 1e3;
1490
1518
  var SESSION_KEY = "ads_session";
1491
1519
  var SESSION_TS_KEY = "ads_session_ts";
1492
1520
  var THIRTY_MINUTES_MS = 30 * 60 * 1e3;
1521
+ var PAGE_EVENT_NAME_RE = /^[a-zA-Z0-9:_.-]{1,64}$/;
1493
1522
  var inMemorySessionId = null;
1494
1523
  var inMemorySessionTs = 0;
1495
1524
  var sessionStartedHere = false;
1525
+ var announcedSessionId = "";
1496
1526
  var storageAllowed = true;
1497
1527
  function generateUUID2() {
1498
1528
  if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
@@ -1556,6 +1586,15 @@ function sameEndpointOrigin(a, b) {
1556
1586
  return false;
1557
1587
  }
1558
1588
  }
1589
+ function normalizePageUrl(raw) {
1590
+ if (!raw) return "";
1591
+ try {
1592
+ const u = new URL(raw);
1593
+ return u.origin + u.pathname;
1594
+ } catch {
1595
+ return raw;
1596
+ }
1597
+ }
1559
1598
  var SESSION_PERSIST_INTERVAL_MS = 60 * 1e3;
1560
1599
  var persistedSessionTs = 0;
1561
1600
  var ACTIVITY_EVENTS = ["pointerdown", "pointermove", "keydown", "scroll", "wheel", "touchstart"];
@@ -1665,7 +1704,7 @@ function getOrCreateUserId() {
1665
1704
  if (storageAllowed && typeof localStorage !== "undefined") {
1666
1705
  const stored = localStorage.getItem(USER_ID_KEY);
1667
1706
  if (stored) return stored;
1668
- const newId = generateUUID2();
1707
+ const newId = inMemorySessionId || generateUUID2();
1669
1708
  localStorage.setItem(USER_ID_KEY, newId);
1670
1709
  return newId;
1671
1710
  }
@@ -1699,6 +1738,16 @@ function tcDataToConsentRecord(tcData) {
1699
1738
  purposesConsented: purposes
1700
1739
  };
1701
1740
  }
1741
+ function resolveTcfStorageAllowed(tcData, success) {
1742
+ if (!success || !tcData) return void 0;
1743
+ if (tcData.eventStatus === "cmpuishown" && !tcData.tcString) return false;
1744
+ const allowed = storageAllowedBy(tcDataToConsentRecord(tcData));
1745
+ if (!allowed) {
1746
+ clearStoredSession();
1747
+ clearStoredUserId();
1748
+ }
1749
+ return allowed;
1750
+ }
1702
1751
  function probeTcfStorageAllowed() {
1703
1752
  if (typeof window === "undefined") return void 0;
1704
1753
  const win = window;
@@ -1706,27 +1755,22 @@ function probeTcfStorageAllowed() {
1706
1755
  let allowed = void 0;
1707
1756
  try {
1708
1757
  win.__tcfapi("getTCData", 2, (tcData, success) => {
1709
- if (success && tcData) {
1710
- allowed = storageAllowedBy(tcDataToConsentRecord(tcData));
1711
- }
1758
+ allowed = resolveTcfStorageAllowed(tcData, success);
1712
1759
  });
1713
1760
  } catch {
1714
1761
  }
1715
1762
  return allowed !== void 0 ? allowed : false;
1716
1763
  }
1717
- var tcfListenerAttached = false;
1718
- function resetTcfListener() {
1719
- tcfListenerAttached = false;
1720
- }
1764
+ var attachedTcfApi = null;
1721
1765
  function attachTcfListener() {
1722
- if (tcfListenerAttached || typeof window === "undefined") return;
1766
+ if (typeof window === "undefined") return;
1723
1767
  const win = window;
1724
- if (typeof win.__tcfapi !== "function") return;
1725
- tcfListenerAttached = true;
1768
+ if (typeof win.__tcfapi !== "function" || attachedTcfApi === win.__tcfapi) return;
1769
+ attachedTcfApi = win.__tcfapi;
1726
1770
  try {
1727
1771
  win.__tcfapi("addEventListener", 2, (tcData, success) => {
1728
- if (!success || !tcData) return;
1729
- BidsparkPrebidAnalytics.setStorageAllowed(storageAllowedBy(tcDataToConsentRecord(tcData)));
1772
+ const allowed = resolveTcfStorageAllowed(tcData, success);
1773
+ if (allowed !== void 0) BidsparkPrebidAnalytics.setStorageAllowed(allowed);
1730
1774
  });
1731
1775
  } catch {
1732
1776
  }
@@ -1817,19 +1861,31 @@ var PrebidEventDeduper = class {
1817
1861
  }
1818
1862
  };
1819
1863
  function parseBidDimensions(bid) {
1820
- if (Number.isFinite(bid?.width) && Number.isFinite(bid?.height)) {
1864
+ if (Number.isFinite(bid?.width) && bid.width > 0 && Number.isFinite(bid?.height) && bid.height > 0) {
1821
1865
  return { width: bid.width, height: bid.height };
1822
1866
  }
1867
+ if (Number.isFinite(bid?.w) && bid.w > 0 && Number.isFinite(bid?.h) && bid.h > 0) {
1868
+ return { width: bid.w, height: bid.h };
1869
+ }
1870
+ if (Number.isFinite(bid?.playerWidth) && bid.playerWidth > 0 && Number.isFinite(bid?.playerHeight) && bid.playerHeight > 0) {
1871
+ return { width: bid.playerWidth, height: bid.playerHeight };
1872
+ }
1873
+ const ps = bid?.mediaTypes?.video?.playerSize;
1874
+ if (Array.isArray(ps) && ps.length > 0) {
1875
+ const tuple = Array.isArray(ps[0]) ? ps[0] : ps;
1876
+ if (Number.isFinite(tuple[0]) && tuple[0] > 0 && Number.isFinite(tuple[1]) && tuple[1] > 0) {
1877
+ return { width: tuple[0], height: tuple[1] };
1878
+ }
1879
+ }
1823
1880
  if (typeof bid?.size === "string") {
1824
1881
  const match = bid.size.match(/^(\d+)x(\d+)$/);
1825
1882
  if (match) {
1826
1883
  return { width: Number(match[1]), height: Number(match[2]) };
1827
1884
  }
1828
1885
  }
1829
- return {
1830
- width: Number.isFinite(bid?.width) ? bid.width : 0,
1831
- height: Number.isFinite(bid?.height) ? bid.height : 0
1832
- };
1886
+ const w = Number.isFinite(bid?.width) ? bid.width : Number.isFinite(bid?.w) ? bid.w : Number.isFinite(bid?.playerWidth) ? bid.playerWidth : 0;
1887
+ const h = Number.isFinite(bid?.height) ? bid.height : Number.isFinite(bid?.h) ? bid.h : Number.isFinite(bid?.playerHeight) ? bid.playerHeight : 0;
1888
+ return { width: w, height: h };
1833
1889
  }
1834
1890
  function resolveBidPricing(bid, fallback) {
1835
1891
  if (Number.isFinite(bid?.cpm)) {
@@ -1874,14 +1930,7 @@ var BidsparkPrebidAnalytics = class _BidsparkPrebidAnalytics {
1874
1930
  storageAllowed = allowed;
1875
1931
  persistedSessionTs = 0;
1876
1932
  for (const inst of _BidsparkPrebidAnalytics.allInstances) {
1877
- inst.config.storageAllowed = allowed;
1878
- if (!allowed) {
1879
- inst.config.userId = "";
1880
- inst.config.visitorId = inst.config.visitorId || inst.config.pageviewId;
1881
- } else if (!inst.config.userId) {
1882
- inst.config.userId = getOrCreateUserId();
1883
- inst.config.visitorId = inst.config.visitorId || inst.config.userId || inst.config.pageviewId;
1884
- }
1933
+ inst.applyStorageAllowed(allowed);
1885
1934
  }
1886
1935
  }
1887
1936
  static isStorageAllowed() {
@@ -1928,10 +1977,16 @@ var BidsparkPrebidAnalytics = class _BidsparkPrebidAnalytics {
1928
1977
  recordedConsentKeys = /* @__PURE__ */ new Set();
1929
1978
  consentCount = 0;
1930
1979
  cmpDetach = null;
1980
+ sessionResumeUnsub = null;
1931
1981
  pageviewEmitted = false;
1932
1982
  logger;
1933
1983
  // True when managing session lifecycle internally; false if caller supplied fixed sessionId.
1934
1984
  managesSessionId;
1985
+ configuredUserId;
1986
+ // True when visitor sampling key is derived internally from storage/session rather than caller config.
1987
+ managesVisitorId;
1988
+ // True once visitorId is settled (storage read, caller-supplied, or first batch drained).
1989
+ visitorKeyLocked;
1935
1990
  constructor(config) {
1936
1991
  const tcfStorage = probeTcfStorageAllowed();
1937
1992
  if (typeof window !== "undefined" && typeof window.__tcfapi === "function") {
@@ -1945,32 +2000,33 @@ var BidsparkPrebidAnalytics = class _BidsparkPrebidAnalytics {
1945
2000
  const requestedEndpoint = config.endpoint || "";
1946
2001
  const endpoint = !requestedEndpoint || isTrustedEndpoint(requestedEndpoint) ? requestedEndpoint : "";
1947
2002
  const pageviewId = config.pageviewId || generateUUID2();
2003
+ recordActivity();
2004
+ this.managesSessionId = !config.sessionId;
2005
+ const sessionId = config.sessionId || getOrCreateSessionId();
2006
+ this.configuredUserId = config.userId || "";
1948
2007
  let initialUserId = "";
1949
- let initialVisitorId = "";
1950
2008
  if (isStorageOn) {
1951
- initialUserId = config.userId || getOrCreateUserId();
1952
- if (config.userId) {
2009
+ initialUserId = this.configuredUserId || getOrCreateUserId();
2010
+ if (this.configuredUserId) {
1953
2011
  try {
1954
2012
  if (typeof localStorage !== "undefined") {
1955
- localStorage.setItem(USER_ID_KEY, config.userId);
2013
+ localStorage.setItem(USER_ID_KEY, this.configuredUserId);
1956
2014
  }
1957
2015
  } catch {
1958
2016
  }
1959
2017
  }
1960
- initialVisitorId = config.visitorId || initialUserId || pageviewId;
1961
- } else {
1962
- initialUserId = "";
1963
- initialVisitorId = config.visitorId || pageviewId;
1964
2018
  }
2019
+ this.managesVisitorId = !config.visitorId && !config.userId && !config.sessionId;
2020
+ this.visitorKeyLocked = isStorageOn || !this.managesVisitorId;
1965
2021
  const usageEndpoint = config.usageEndpoint || "";
1966
2022
  this.config = {
1967
2023
  endpoint,
1968
2024
  usageEndpoint,
1969
2025
  propertyId: config.propertyId || "",
1970
2026
  pageviewId,
1971
- sessionId: config.sessionId || "",
2027
+ sessionId,
1972
2028
  userId: initialUserId,
1973
- visitorId: initialVisitorId,
2029
+ visitorId: config.visitorId || this.configuredUserId || initialUserId || sessionId,
1974
2030
  deviceType: config.deviceType || "desktop",
1975
2031
  country: config.country || "",
1976
2032
  region: config.region || "",
@@ -1983,16 +2039,14 @@ var BidsparkPrebidAnalytics = class _BidsparkPrebidAnalytics {
1983
2039
  pbjsGlobalName: config.pbjsGlobalName || "pbjs",
1984
2040
  attachPbjsListeners: config.attachPbjsListeners ?? true,
1985
2041
  revenueFlushDelayMs: Number.isFinite(config.revenueFlushDelayMs) && config.revenueFlushDelayMs >= 0 ? config.revenueFlushDelayMs : REVENUE_FLUSH_DELAY_MS,
1986
- alias: config.alias || DEFAULT_ALIAS
2042
+ alias: config.alias || DEFAULT_ALIAS,
2043
+ events: config.events || {}
1987
2044
  };
1988
2045
  _BidsparkPrebidAnalytics.allInstances.add(this);
1989
2046
  this.logger = createLogger({
1990
2047
  prefix: "[analytics]",
1991
2048
  logLevel: this.config.logLevel
1992
2049
  });
1993
- recordActivity();
1994
- this.managesSessionId = !config.sessionId;
1995
- if (this.managesSessionId) this.config.sessionId = getOrCreateSessionId();
1996
2050
  if (requestedEndpoint && !endpoint) {
1997
2051
  this.log(
1998
2052
  "ERROR",
@@ -2005,6 +2059,31 @@ var BidsparkPrebidAnalytics = class _BidsparkPrebidAnalytics {
2005
2059
  };
2006
2060
  this.boundVisibilityChange = () => this.handleVisibilityChange();
2007
2061
  }
2062
+ applyStorageAllowed(allowed) {
2063
+ this.config.storageAllowed = allowed;
2064
+ if (!allowed) {
2065
+ this.config.userId = "";
2066
+ return;
2067
+ }
2068
+ this.syncSessionId();
2069
+ if (!this.config.userId) {
2070
+ this.config.userId = this.configuredUserId || getOrCreateUserId();
2071
+ }
2072
+ if (this.managesVisitorId && !this.visitorKeyLocked) {
2073
+ this.config.visitorId = this.config.userId || this.config.sessionId;
2074
+ this.visitorKeyLocked = true;
2075
+ if (!this.isSampledVisitor()) {
2076
+ this.queue = [];
2077
+ if (this.revenueFlushTimer) {
2078
+ clearTimeout(this.revenueFlushTimer);
2079
+ this.revenueFlushTimer = null;
2080
+ }
2081
+ }
2082
+ }
2083
+ if (this.isEnabled) {
2084
+ this.resendPersistedBatches();
2085
+ }
2086
+ }
2008
2087
  setLogLevel(level) {
2009
2088
  const norm = normalizeLogLevel(level);
2010
2089
  this.config.logLevel = norm;
@@ -2018,6 +2097,7 @@ var BidsparkPrebidAnalytics = class _BidsparkPrebidAnalytics {
2018
2097
  if (this.isEnabled) return;
2019
2098
  this.isEnabled = true;
2020
2099
  _BidsparkPrebidAnalytics.activeInstances.add(this);
2100
+ _BidsparkPrebidAnalytics.allInstances.add(this);
2021
2101
  this.logger.setLevel(this.config.logLevel);
2022
2102
  if (this.config.attachPbjsListeners && this.config.usageEndpoint && !this.usageRecorder) {
2023
2103
  this.usageRecorder = new UsageRecorder({
@@ -2047,20 +2127,18 @@ var BidsparkPrebidAnalytics = class _BidsparkPrebidAnalytics {
2047
2127
  this.cmpDetach = this.attachCmp();
2048
2128
  if (typeof window !== "undefined") {
2049
2129
  if (!this.pageUrl) {
2050
- try {
2051
- const u = new URL(window.location.href);
2052
- this.pageUrl = u.origin + u.pathname;
2053
- } catch {
2054
- this.pageUrl = window.location.href;
2055
- }
2130
+ this.pageUrl = normalizePageUrl(window.location.href);
2056
2131
  }
2057
2132
  window.addEventListener("pagehide", this.boundFlushBeacon);
2058
2133
  if (typeof document !== "undefined") {
2059
2134
  document.addEventListener("visibilitychange", this.boundVisibilityChange);
2060
2135
  }
2061
2136
  bindActivityListeners();
2137
+ this.sessionResumeUnsub = onSessionResume(() => this.syncSessionAndRotateVisitor());
2138
+ this.syncSessionId();
2062
2139
  if (!this.pageviewEmitted) {
2063
2140
  this.pageviewEmitted = true;
2141
+ this.emitPageEvent("pageview");
2064
2142
  this.enqueue(TraceEventType.PAGEVIEW, "pageview", {});
2065
2143
  }
2066
2144
  this.flushTimer = setInterval(() => this.flush(), FLUSH_INTERVAL_MS);
@@ -2202,6 +2280,8 @@ var BidsparkPrebidAnalytics = class _BidsparkPrebidAnalytics {
2202
2280
  }
2203
2281
  this.cmpDetach = null;
2204
2282
  }
2283
+ this.sessionResumeUnsub?.();
2284
+ this.sessionResumeUnsub = null;
2205
2285
  this.flush();
2206
2286
  }
2207
2287
  handleVisibilityChange() {
@@ -2670,7 +2750,15 @@ var BidsparkPrebidAnalytics = class _BidsparkPrebidAnalytics {
2670
2750
  hasImpressionEmitted(slotId, refreshIndex, auctionId, creativeId, adId) {
2671
2751
  const rIndex = refreshIndex ?? this.slotRefreshIndices.get(slotId) ?? 0;
2672
2752
  const baseSlotKey = `${escapeKeyPart(slotId)}:${rIndex}`;
2753
+ if (auctionId ? this.slotEmittedImpressionKeys.has(`${baseSlotKey}:auc:${escapeKeyPart(auctionId)}`) : this.slotEmittedImpressionKeys.has(baseSlotKey)) {
2754
+ return true;
2755
+ }
2673
2756
  if (adId) {
2757
+ if (auctionId && this.slotEmittedImpressionKeys.has(
2758
+ `${baseSlotKey}:auc:${escapeKeyPart(auctionId)}:render`
2759
+ ) || this.slotEmittedImpressionKeys.has(`${baseSlotKey}:render`)) {
2760
+ return true;
2761
+ }
2674
2762
  if (auctionId) {
2675
2763
  if (this.slotEmittedImpressionKeys.has(
2676
2764
  `${baseSlotKey}:auc:${escapeKeyPart(auctionId)}:ad:${escapeKeyPart(adId)}`
@@ -2693,6 +2781,11 @@ var BidsparkPrebidAnalytics = class _BidsparkPrebidAnalytics {
2693
2781
  }
2694
2782
  return false;
2695
2783
  }
2784
+ if (auctionId && this.slotEmittedImpressionKeys.has(
2785
+ `${baseSlotKey}:auc:${escapeKeyPart(auctionId)}:ad-emitted`
2786
+ ) || this.slotEmittedImpressionKeys.has(`${baseSlotKey}:ad-emitted`)) {
2787
+ return true;
2788
+ }
2696
2789
  if (creativeId) {
2697
2790
  if (auctionId) {
2698
2791
  return this.slotEmittedImpressionKeys.has(
@@ -2701,10 +2794,10 @@ var BidsparkPrebidAnalytics = class _BidsparkPrebidAnalytics {
2701
2794
  }
2702
2795
  return this.slotEmittedImpressionKeys.has(`${baseSlotKey}:${escapeKeyPart(creativeId)}`);
2703
2796
  }
2704
- if (auctionId) {
2705
- return this.slotEmittedImpressionKeys.has(`${baseSlotKey}:auc:${escapeKeyPart(auctionId)}`);
2797
+ if (auctionId && this.slotEmittedImpressionKeys.has(`${baseSlotKey}:auc:${escapeKeyPart(auctionId)}:any`)) {
2798
+ return true;
2706
2799
  }
2707
- return this.slotEmittedImpressionKeys.has(baseSlotKey);
2800
+ return false;
2708
2801
  }
2709
2802
  markImpressionEmitted(slotId, refreshIndex, auctionId, creativeId, adId) {
2710
2803
  const baseSlotKey = `${escapeKeyPart(slotId)}:${refreshIndex}`;
@@ -2712,10 +2805,13 @@ var BidsparkPrebidAnalytics = class _BidsparkPrebidAnalytics {
2712
2805
  if (hasIdentity) {
2713
2806
  if (adId) {
2714
2807
  this.addImpressionKey(`${baseSlotKey}:ad:${escapeKeyPart(adId)}`);
2808
+ this.addImpressionKey(`${baseSlotKey}:ad-emitted`);
2715
2809
  if (auctionId) {
2716
2810
  this.addImpressionKey(
2717
2811
  `${baseSlotKey}:auc:${escapeKeyPart(auctionId)}:ad:${escapeKeyPart(adId)}`
2718
2812
  );
2813
+ this.addImpressionKey(`${baseSlotKey}:auc:${escapeKeyPart(auctionId)}:any`);
2814
+ this.addImpressionKey(`${baseSlotKey}:auc:${escapeKeyPart(auctionId)}:ad-emitted`);
2719
2815
  }
2720
2816
  }
2721
2817
  if (creativeId && creativeId !== adId) {
@@ -2724,15 +2820,21 @@ var BidsparkPrebidAnalytics = class _BidsparkPrebidAnalytics {
2724
2820
  this.addImpressionKey(
2725
2821
  `${baseSlotKey}:auc:${escapeKeyPart(auctionId)}:${escapeKeyPart(creativeId)}`
2726
2822
  );
2823
+ this.addImpressionKey(`${baseSlotKey}:auc:${escapeKeyPart(auctionId)}:any`);
2727
2824
  }
2728
2825
  }
2729
- if (auctionId) {
2730
- this.addImpressionKey(`${baseSlotKey}:auc:${escapeKeyPart(auctionId)}`);
2826
+ if (!adId) {
2827
+ this.addImpressionKey(`${baseSlotKey}:render`);
2828
+ if (auctionId) {
2829
+ this.addImpressionKey(`${baseSlotKey}:auc:${escapeKeyPart(auctionId)}:render`);
2830
+ }
2731
2831
  }
2732
2832
  } else {
2733
2833
  this.addImpressionKey(baseSlotKey);
2834
+ this.addImpressionKey(`${baseSlotKey}:render`);
2734
2835
  if (auctionId) {
2735
2836
  this.addImpressionKey(`${baseSlotKey}:auc:${escapeKeyPart(auctionId)}`);
2837
+ this.addImpressionKey(`${baseSlotKey}:auc:${escapeKeyPart(auctionId)}:render`);
2736
2838
  }
2737
2839
  }
2738
2840
  }
@@ -2759,8 +2861,8 @@ var BidsparkPrebidAnalytics = class _BidsparkPrebidAnalytics {
2759
2861
  ...parseBidDimensions(rawBid).width ? parseBidDimensions(rawBid) : cached?.bidTrace ? { width: cached.bidTrace.width, height: cached.bidTrace.height } : parseBidDimensions(rawBid),
2760
2862
  dealId: rawBid.dealId || cached?.bidTrace?.dealId || "",
2761
2863
  mediaType,
2762
- latencyMs: Number.isFinite(rawBid.timeToRespond) ? rawBid.timeToRespond : cached?.bidTrace?.latencyMs ?? 0,
2763
- advertiserDomain: rawBid.meta?.advertiserDomains?.[0] || cached?.bidTrace?.advertiserDomain || "",
2864
+ latencyMs: Number.isFinite(rawBid.timeToRespond) ? rawBid.timeToRespond : Number.isFinite(rawBid.latencyMs) ? rawBid.latencyMs : cached?.bidTrace?.latencyMs ?? 0,
2865
+ advertiserDomain: rawBid.advertiserDomain || rawBid.meta?.advertiserDomains?.[0] || (Array.isArray(rawBid.adomain) ? rawBid.adomain[0] : "") || cached?.bidTrace?.advertiserDomain || "",
2764
2866
  creativeId: rawBid.creativeId || cached?.bidTrace?.creativeId || ""
2765
2867
  };
2766
2868
  if (isDifferentAuction && targetSlot) {
@@ -2931,16 +3033,16 @@ var BidsparkPrebidAnalytics = class _BidsparkPrebidAnalytics {
2931
3033
  const handler = (evt) => {
2932
3034
  const detail = evt.detail;
2933
3035
  if (detail) {
2934
- this.recordConsent(detail);
2935
3036
  this.followConsent(detail);
3037
+ this.recordConsent(detail);
2936
3038
  }
2937
3039
  };
2938
3040
  document.addEventListener("ads:consent", handler);
2939
3041
  const win = typeof window !== "undefined" ? window : {};
2940
3042
  const existingRecord = win[this.config.alias]?.consent?.getRecord?.() || null;
2941
3043
  if (existingRecord) {
2942
- this.recordConsent(existingRecord);
2943
3044
  this.followConsent(existingRecord);
3045
+ this.recordConsent(existingRecord);
2944
3046
  }
2945
3047
  let detached = false;
2946
3048
  return () => {
@@ -2949,15 +3051,23 @@ var BidsparkPrebidAnalytics = class _BidsparkPrebidAnalytics {
2949
3051
  document.removeEventListener("ads:consent", handler);
2950
3052
  };
2951
3053
  }
2952
- /** Device storage follows the decision; a refusal also drops the stored session. */
3054
+ /** Device storage follows the decision; a refusal also drops stored session and user IDs. */
2953
3055
  followConsent(record) {
2954
3056
  const allowed = storageAllowedBy(record);
2955
- if (!allowed) clearStoredSession();
3057
+ if (!allowed) {
3058
+ clearStoredSession();
3059
+ clearStoredUserId();
3060
+ }
2956
3061
  _BidsparkPrebidAnalytics.setStorageAllowed(allowed);
2957
3062
  }
2958
3063
  setUserId(userId) {
3064
+ this.configuredUserId = userId;
2959
3065
  this.config.userId = userId;
2960
- if (userId) this.config.visitorId = userId;
3066
+ if (userId) {
3067
+ this.config.visitorId = userId;
3068
+ this.managesVisitorId = false;
3069
+ this.visitorKeyLocked = true;
3070
+ }
2961
3071
  if (this.config.storageAllowed && typeof localStorage !== "undefined") {
2962
3072
  try {
2963
3073
  if (userId) {
@@ -2971,16 +3081,46 @@ var BidsparkPrebidAnalytics = class _BidsparkPrebidAnalytics {
2971
3081
  }
2972
3082
  setVisitorId(visitorId) {
2973
3083
  this.config.visitorId = visitorId;
3084
+ this.managesVisitorId = !visitorId;
3085
+ if (visitorId) this.visitorKeyLocked = true;
2974
3086
  }
2975
3087
  setSampleRate(sampleRate) {
2976
3088
  this.config.sampleRate = normalizeSampleRate(sampleRate);
2977
3089
  }
3090
+ setEvents(events) {
3091
+ this.config.events = events || {};
3092
+ }
2978
3093
  setSessionId(sessionId) {
2979
3094
  this.config.sessionId = sessionId;
2980
3095
  this.managesSessionId = !sessionId;
2981
3096
  if (this.managesSessionId) this.config.sessionId = getOrCreateSessionId();
2982
3097
  }
2983
- navigate(pageviewId, pageUrl) {
3098
+ getSessionId() {
3099
+ this.syncSessionId();
3100
+ return this.config.sessionId;
3101
+ }
3102
+ getPageviewId() {
3103
+ return this.config.pageviewId;
3104
+ }
3105
+ getContext() {
3106
+ return { pageviewId: this.getPageviewId(), sessionId: this.getSessionId() };
3107
+ }
3108
+ /**
3109
+ * Continues the pageview of the instance this one replaces: re-registering on
3110
+ * the same page must not count a second pageview or replay Prebid's history.
3111
+ */
3112
+ continuePageview(previous) {
3113
+ this.config.pageviewId = previous.config.pageviewId;
3114
+ this.pageviewEmitted = previous.pageviewEmitted;
3115
+ this.deduper = previous.deduper;
3116
+ this.replayedEventCount = previous.replayedEventCount;
3117
+ }
3118
+ navigate(pageviewId, pageUrl = "") {
3119
+ const nextPageUrl = normalizePageUrl(pageUrl);
3120
+ if (this.isEnabled && this.pageviewEmitted && pageviewId !== "" && pageviewId === this.config.pageviewId && (!nextPageUrl || nextPageUrl === this.pageUrl)) {
3121
+ recordActivity();
3122
+ return;
3123
+ }
2984
3124
  this.disable();
2985
3125
  this.slotRefreshIndices.clear();
2986
3126
  this.slotNames.clear();
@@ -2990,26 +3130,18 @@ var BidsparkPrebidAnalytics = class _BidsparkPrebidAnalytics {
2990
3130
  this.consentCount = 0;
2991
3131
  this.pageviewEmitted = false;
2992
3132
  this.config.pageviewId = pageviewId || generateUUID2();
2993
- this.config.visitorId = this.config.userId || this.config.pageviewId;
2994
- if (pageUrl) {
2995
- try {
2996
- const u = new URL(pageUrl);
2997
- this.pageUrl = u.origin + u.pathname;
2998
- } catch {
2999
- this.pageUrl = pageUrl;
3000
- }
3001
- } else {
3002
- this.pageUrl = "";
3003
- }
3133
+ this.pageUrl = nextPageUrl;
3004
3134
  this.logger.resetTiming();
3005
3135
  recordActivity();
3136
+ this.syncSessionAndRotateVisitor();
3006
3137
  this.enable();
3007
3138
  }
3008
- recordAuctionStart(auctionId, adUnitCode = "", bidderCount) {
3139
+ recordAuctionStart(auctionId, adUnitCode = "", bidderCount, mediaType) {
3009
3140
  if (!this.isEnabled || !this.config.auctionEnabled) return;
3010
3141
  this.enqueue(TraceEventType.AUCTION_START, "auctionStart", {
3011
3142
  auctionId,
3012
3143
  adUnitCode,
3144
+ ...mediaType ? { bid: { mediaType } } : {},
3013
3145
  ...typeof bidderCount === "number" ? { metadata: { bidderCount: String(bidderCount) } } : {}
3014
3146
  });
3015
3147
  }
@@ -3069,7 +3201,7 @@ var BidsparkPrebidAnalytics = class _BidsparkPrebidAnalytics {
3069
3201
  data.bids.forEach((bid) => {
3070
3202
  const adUnitCode = bid.adUnitCode || "";
3071
3203
  const mediaTypes = Object.keys(bid.mediaTypes || {});
3072
- const mediaType = mediaTypes.length > 0 ? mediaTypes[0] : bid.mediaType || "banner";
3204
+ const mediaType = bid.mediaType || (bid.mediaTypes?.video ? "video" : mediaTypes.length > 0 ? mediaTypes[0] : "banner");
3073
3205
  const key = `${bidder}:${adUnitCode}`;
3074
3206
  if (!auctionMap.has(key)) {
3075
3207
  auctionMap.set(key, {
@@ -3271,35 +3403,28 @@ var BidsparkPrebidAnalytics = class _BidsparkPrebidAnalytics {
3271
3403
  }
3272
3404
  }
3273
3405
  const currentRefreshIndex = adUnitCode ? this.slotRefreshIndices.get(adUnitCode) ?? (record ? record.refreshIndex : 0) : 0;
3274
- if (!isVideo) {
3275
- const alreadyEmitted = adUnitCode ? this.hasImpressionEmitted(
3276
- adUnitCode,
3277
- currentRefreshIndex,
3278
- resolvedAuctionId,
3279
- bidTrace.creativeId
3280
- ) : false;
3281
- if (!alreadyEmitted) {
3282
- if (adUnitCode) {
3283
- this.markImpressionEmitted(
3284
- adUnitCode,
3285
- currentRefreshIndex,
3286
- resolvedAuctionId,
3287
- bidTrace.creativeId
3288
- );
3289
- }
3290
- this.enqueue(TraceEventType.IMPRESSION, "impression", {
3291
- auctionId: resolvedAuctionId,
3292
- transactionId: resolvedTransactionId,
3406
+ const alreadyEmitted = adUnitCode ? this.hasImpressionEmitted(
3407
+ adUnitCode,
3408
+ currentRefreshIndex,
3409
+ resolvedAuctionId,
3410
+ bidTrace.creativeId
3411
+ ) : false;
3412
+ if (!alreadyEmitted) {
3413
+ if (adUnitCode) {
3414
+ this.markImpressionEmitted(
3293
3415
  adUnitCode,
3294
- bid: bidTrace,
3295
- metadata: { refresh_index: String(currentRefreshIndex) }
3296
- });
3416
+ currentRefreshIndex,
3417
+ resolvedAuctionId,
3418
+ bidTrace.creativeId
3419
+ );
3297
3420
  }
3298
- } else {
3299
- this.log(
3300
- "DEBUG",
3301
- `adRenderSucceeded received for video ad unit ${adUnitCode || "unknown"}: suppressing IMPRESSION until verified video lifecycle event`
3302
- );
3421
+ this.enqueue(TraceEventType.IMPRESSION, "impression", {
3422
+ auctionId: resolvedAuctionId,
3423
+ transactionId: resolvedTransactionId,
3424
+ adUnitCode,
3425
+ bid: bidTrace,
3426
+ metadata: { refresh_index: String(currentRefreshIndex) }
3427
+ });
3303
3428
  }
3304
3429
  if (this.config.viewabilityEnabled && typeof document !== "undefined") {
3305
3430
  let el = adUnitCode && this.slotElements.get(adUnitCode) || null;
@@ -3353,9 +3478,7 @@ var BidsparkPrebidAnalytics = class _BidsparkPrebidAnalytics {
3353
3478
  enqueue(type, eventName, data) {
3354
3479
  if (!this.isEnabled) return;
3355
3480
  if (!this.shouldSample(type)) return;
3356
- if (this.managesSessionId && sessionNeedsSync()) {
3357
- this.config.sessionId = getOrCreateSessionId();
3358
- }
3481
+ this.syncSessionId();
3359
3482
  const protoEvent = {
3360
3483
  eventId: idToBytes(generateUUID2()),
3361
3484
  timestampMs: Date.now(),
@@ -3369,19 +3492,20 @@ var BidsparkPrebidAnalytics = class _BidsparkPrebidAnalytics {
3369
3492
  namespace: data.ns || data.namespace || ""
3370
3493
  };
3371
3494
  if (data.bid) {
3495
+ const dims = parseBidDimensions(data.bid);
3372
3496
  protoEvent.bid = {
3373
- bidder: data.bid.bidder || "",
3497
+ bidder: data.bid.bidder || data.bid.bidderCode || "",
3374
3498
  cpm: Number.isFinite(data.bid.cpm) ? data.bid.cpm : 0,
3375
3499
  // No defaults here: handlers with a priced bid (bidWon, impression)
3376
3500
  // set currency/mediaType themselves. Defaulting for the rest would
3377
3501
  // stamp fake "USD"/"banner" on rows that carried no bid.
3378
3502
  currency: data.bid.currency || "",
3379
- width: Number.isFinite(data.bid.width) ? data.bid.width : 0,
3380
- height: Number.isFinite(data.bid.height) ? data.bid.height : 0,
3503
+ width: dims.width,
3504
+ height: dims.height,
3381
3505
  dealId: data.bid.dealId || "",
3382
3506
  mediaType: data.bid.mediaType || "",
3383
- latencyMs: Number.isFinite(data.bid.latencyMs) ? data.bid.latencyMs : 0,
3384
- advertiserDomain: data.bid.advertiserDomain || "",
3507
+ latencyMs: Number.isFinite(data.bid.latencyMs) ? data.bid.latencyMs : Number.isFinite(data.bid.timeToRespond) ? data.bid.timeToRespond : 0,
3508
+ advertiserDomain: data.bid.advertiserDomain || data.bid.meta?.advertiserDomains?.[0] || (Array.isArray(data.bid.adomain) ? data.bid.adomain[0] : "") || "",
3385
3509
  creativeId: data.bid.creativeId || ""
3386
3510
  };
3387
3511
  }
@@ -3446,12 +3570,68 @@ var BidsparkPrebidAnalytics = class _BidsparkPrebidAnalytics {
3446
3570
  }, this.config.revenueFlushDelayMs);
3447
3571
  }
3448
3572
  }
3573
+ // Follows the page's session, which consent or a lapse can move after this
3574
+ // instance took its ID. A settled session is read as is: only a pageview or
3575
+ // visitor input may start a new one, never a flush.
3576
+ syncSessionId() {
3577
+ if (!this.managesSessionId) return;
3578
+ this.config.sessionId = sessionNeedsSync() ? getOrCreateSessionId() : inMemorySessionId;
3579
+ this.announceSession();
3580
+ }
3581
+ syncSessionAndRotateVisitor() {
3582
+ const prevSessionId = this.config.sessionId;
3583
+ this.syncSessionId();
3584
+ if (!this.config.visitorId || this.config.sessionId !== prevSessionId && this.config.visitorId === prevSessionId) {
3585
+ this.config.visitorId = this.config.userId || this.config.sessionId;
3586
+ }
3587
+ }
3588
+ announceSession() {
3589
+ if (!this.isEnabled || !this.managesSessionId || !sessionStartedHere || this.config.sessionId === announcedSessionId) {
3590
+ return;
3591
+ }
3592
+ announcedSessionId = this.config.sessionId;
3593
+ this.emitPageEvent("session");
3594
+ }
3595
+ emitPageEvent(key) {
3596
+ const detail = {
3597
+ pageviewId: this.config.pageviewId,
3598
+ sessionId: this.config.sessionId
3599
+ };
3600
+ const configured = this.config.events?.[key];
3601
+ if (typeof configured === "function") {
3602
+ try {
3603
+ configured(detail);
3604
+ } catch (e) {
3605
+ this.log("ERROR", `Error in ${key} event handler`, e);
3606
+ }
3607
+ return;
3608
+ }
3609
+ const defaultName = `${this.config.alias}:${key}`;
3610
+ let eventName = defaultName;
3611
+ const trimmed = typeof configured === "string" ? configured.trim() : "";
3612
+ if (trimmed) {
3613
+ if (PAGE_EVENT_NAME_RE.test(trimmed) && (!trimmed.startsWith("ads:") || trimmed === defaultName)) {
3614
+ eventName = trimmed;
3615
+ } else {
3616
+ this.log(
3617
+ "WARN",
3618
+ `Invalid ${key} event name "${configured}"; falling back to "${defaultName}".`
3619
+ );
3620
+ }
3621
+ }
3622
+ if (typeof window === "undefined" || typeof window.dispatchEvent !== "function") return;
3623
+ try {
3624
+ window.dispatchEvent(new CustomEvent(eventName, { detail }));
3625
+ } catch (e) {
3626
+ this.log("ERROR", `Failed to dispatch ${eventName} event`, e);
3627
+ }
3628
+ }
3449
3629
  isSampledVisitor() {
3450
- const key = this.config.visitorId || this.config.userId || this.config.pageviewId;
3630
+ const key = this.config.visitorId || this.config.sessionId;
3451
3631
  return isVisitorSampled(key, this.config.sampleRate);
3452
3632
  }
3453
3633
  shouldSample(type) {
3454
- if (!this.isSampledVisitor()) {
3634
+ if (this.visitorKeyLocked && !this.isSampledVisitor()) {
3455
3635
  return false;
3456
3636
  }
3457
3637
  if (type === TraceEventType.ERROR) {
@@ -3478,9 +3658,15 @@ var BidsparkPrebidAnalytics = class _BidsparkPrebidAnalytics {
3478
3658
  // Shared by flush() and flushBeacon().
3479
3659
  drainBatch() {
3480
3660
  if (this.queue.length === 0 || !this.config.endpoint) return null;
3661
+ this.syncSessionId();
3662
+ this.visitorKeyLocked = true;
3663
+ if (!this.isSampledVisitor()) {
3664
+ this.queue = [];
3665
+ return null;
3666
+ }
3481
3667
  const domain = typeof window !== "undefined" ? window.location.hostname : "";
3482
3668
  const sampleRate = normalizeSampleRate(this.config.sampleRate);
3483
- const automated = typeof navigator !== "undefined" && navigator.webdriver === true;
3669
+ const automated = isAutomatedClient();
3484
3670
  const buildBatch = (evts) => ({
3485
3671
  propertyId: idToBytes(this.config.propertyId),
3486
3672
  pageviewId: idToBytes(this.config.pageviewId),
@@ -3683,7 +3869,7 @@ var BidsparkPrebidAnalytics = class _BidsparkPrebidAnalytics {
3683
3869
  // event timestamps, so late rows attribute correctly.
3684
3870
  resendPersistedBatches() {
3685
3871
  try {
3686
- if (typeof localStorage === "undefined" || !this.config.endpoint) return;
3872
+ if (!storageAllowed || typeof localStorage === "undefined" || !this.config.endpoint) return;
3687
3873
  if (!this.config.propertyId) return;
3688
3874
  const ownPrefix = this.pendingKeyPrefix();
3689
3875
  const keys = [];
@@ -3801,6 +3987,7 @@ function registerPrebidAnalytics(pbjsGlobalName = "pbjs", defaults) {
3801
3987
  }
3802
3988
  }
3803
3989
  const analytics = new BidsparkPrebidAnalytics(merged);
3990
+ if (previous && !merged.pageviewId) analytics.continuePageview(previous);
3804
3991
  analytics.enable();
3805
3992
  win._bidsparkPrebidAnalytics = analytics;
3806
3993
  return analytics;
@@ -4241,8 +4428,8 @@ function attachImaAdsManager(analytics, adsManager, options) {
4241
4428
  }
4242
4429
  const slotId = options?.slotId || options?.adUnitCode || "video";
4243
4430
  const adUnitCode = options?.adUnitCode || slotId;
4244
- const auctionId = options?.auctionId || "";
4245
- const transactionId = options?.transactionId || "";
4431
+ const auctionId = options?.auctionId || options?.bid?.auctionId || "";
4432
+ const transactionId = options?.transactionId || options?.bid?.transactionId || "";
4246
4433
  const getWinningBid = (adData) => {
4247
4434
  let cached = (auctionId ? self.getCachedBid(`${auctionId}:${adUnitCode}`) : void 0) || (auctionId && slotId !== adUnitCode ? self.getCachedBid(`${auctionId}:${slotId}`) : void 0) || (adUnitCode !== "video" ? self.getCachedBid(adUnitCode) : void 0) || (slotId !== adUnitCode && slotId !== "video" ? self.getCachedBid(slotId) : void 0);
4248
4435
  if (!cached) {
@@ -4305,11 +4492,7 @@ function attachImaAdsManager(analytics, adsManager, options) {
4305
4492
  const resolvedTransactionId = transactionId || cached?.transactionId || "";
4306
4493
  const creativeId = session.creativeId || adData.creativeId || cached?.bidTrace?.creativeId || options?.bid?.creativeId || "";
4307
4494
  const stableAdIdentity = session.adId || adData.adId || creativeId || session.sessionId;
4308
- const mergedBid = {
4309
- ...cached?.rawBid || options?.bid,
4310
- mediaType: "video",
4311
- creativeId
4312
- };
4495
+ const mergedBid = resolveMergedBid(cached, creativeId);
4313
4496
  const emitted = self.recordImpression(resolvedSlotId, {
4314
4497
  adUnitCode: resolvedAdUnitCode,
4315
4498
  auctionId: resolvedAuctionId,
@@ -4342,6 +4525,19 @@ function attachImaAdsManager(analytics, adsManager, options) {
4342
4525
  }
4343
4526
  }
4344
4527
  };
4528
+ const resolveMergedBid = (cached, extraCreativeId) => {
4529
+ const rawDims = parseBidDimensions(cached?.rawBid);
4530
+ const optDims = parseBidDimensions(options?.bid);
4531
+ const creativeId = extraCreativeId || options?.bid?.creativeId || cached?.bidTrace?.creativeId || "";
4532
+ return {
4533
+ ...cached?.rawBid,
4534
+ ...options?.bid,
4535
+ ...options?.bid?.bidder || options?.bid?.bidderCode ? { bidderCode: options.bid.bidderCode || options.bid.bidder } : {},
4536
+ ...optDims.width > 0 && optDims.height > 0 ? optDims : rawDims,
4537
+ mediaType: "video",
4538
+ ...creativeId ? { creativeId } : {}
4539
+ };
4540
+ };
4345
4541
  const onMilestone = (milestone) => {
4346
4542
  self.log("DEBUG", `IMA AdEvent milestone: ${milestone}`);
4347
4543
  if (options?.onMilestone) {
@@ -4360,7 +4556,7 @@ function attachImaAdsManager(analytics, adsManager, options) {
4360
4556
  auctionId: auctionId || cached?.auctionId,
4361
4557
  transactionId: transactionId || cached?.transactionId,
4362
4558
  adUnitCode: resolvedAdUnitCode,
4363
- bid: cached?.bidTrace || options?.bid,
4559
+ bid: cached || options?.bid ? resolveMergedBid(cached) : void 0,
4364
4560
  metadata: {
4365
4561
  ...options?.metadata,
4366
4562
  media_type: "video"
@@ -4376,7 +4572,7 @@ function attachImaAdsManager(analytics, adsManager, options) {
4376
4572
  adUnitCode: resolvedAdUnitCode,
4377
4573
  auctionId: auctionId || cached?.auctionId,
4378
4574
  transactionId: transactionId || cached?.transactionId,
4379
- bid: cached?.bidTrace || options?.bid,
4575
+ bid: cached || options?.bid ? resolveMergedBid(cached) : void 0,
4380
4576
  metadata: options?.metadata
4381
4577
  });
4382
4578
  if (options?.onError) {
@@ -4788,6 +4984,24 @@ function getAdsGlobal(alias = DEFAULT_ALIAS) {
4788
4984
  const win = window;
4789
4985
  win[alias] = win[alias] || { q: [] };
4790
4986
  const sdk = win[alias];
4987
+ if (!sdk.getContext) {
4988
+ sdk.getContext = () => {
4989
+ const inst = win._bidsparkPrebidAnalytics;
4990
+ return inst?.getContext ? inst.getContext() : { pageviewId: inst?.getPageviewId?.() || "", sessionId: getOrCreateSessionId() };
4991
+ };
4992
+ }
4993
+ if (!sdk.getSessionId) {
4994
+ sdk.getSessionId = () => {
4995
+ const inst = win._bidsparkPrebidAnalytics;
4996
+ return inst?.getSessionId ? inst.getSessionId() : getOrCreateSessionId();
4997
+ };
4998
+ }
4999
+ if (!sdk.getPageviewId) {
5000
+ sdk.getPageviewId = () => {
5001
+ const inst = win._bidsparkPrebidAnalytics;
5002
+ return inst?.getPageviewId ? inst.getPageviewId() : "";
5003
+ };
5004
+ }
4791
5005
  if (!sdk.attachVideoPlayer) {
4792
5006
  sdk.attachVideoPlayer = (target, options) => {
4793
5007
  const inst = win._bidsparkPrebidAnalytics;
@@ -4834,14 +5048,15 @@ function getAdsGlobal(alias = DEFAULT_ALIAS) {
4834
5048
  getPrebidEventKey,
4835
5049
  idToBytes,
4836
5050
  idToString,
5051
+ isAutomatedClient,
4837
5052
  isSessionActive,
4838
5053
  isTrustedEndpoint,
4839
5054
  isVisitorSampled,
4840
5055
  normalizeLogLevel,
4841
5056
  normalizeSampleRate,
4842
5057
  onSessionResume,
5058
+ parseBidDimensions,
4843
5059
  registerPrebidAnalytics,
4844
- resetTcfListener,
4845
5060
  sendEvents,
4846
5061
  sessionStarted
4847
5062
  });