@adstage/web-sdk 2.3.4 → 2.3.6

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.cjs.js CHANGED
@@ -1405,6 +1405,9 @@ class ViewableEventTracker {
1405
1405
  // viewable 이벤트 시점 기록 (메모리 + 세션 스토리지)
1406
1406
  ViewableEventTracker.viewableTracker.set(key, now);
1407
1407
  sessionStorage.setItem(sessionKey, now.toString());
1408
+ if (debug) {
1409
+ console.log(`🎯 New viewable event allowed for ad ${adId} in slot ${slotId}`);
1410
+ }
1408
1411
  // 오래된 세션 스토리지 데이터 정리 (선택적)
1409
1412
  ViewableEventTracker.cleanupOldViewables();
1410
1413
  return false;
@@ -1444,7 +1447,7 @@ class ViewableEventTracker {
1444
1447
  }
1445
1448
  }
1446
1449
  ViewableEventTracker.viewableTracker = new Map();
1447
- ViewableEventTracker.VIEWABLE_COOLDOWN = 300000; // 5분 쿨다운
1450
+ ViewableEventTracker.VIEWABLE_COOLDOWN = 30000; // 30초 쿨다운 (테스트용으로 단축)
1448
1451
 
1449
1452
  /**
1450
1453
  * 디바이스 정보 수집 클래스
@@ -1599,12 +1602,7 @@ class AdvertisementEventTracker {
1599
1602
  */
1600
1603
  async trackAdvertisementEvent(adId, slotId, eventType, additionalData) {
1601
1604
  try {
1602
- // VIEWABLE 이벤트의 경우 중복 확인
1603
- if (eventType === AdEventType.VIEWABLE) {
1604
- if (ViewableEventTracker.isDuplicateViewable(adId, slotId, this.debug)) {
1605
- return; // 중복 viewable 이벤트이므로 추적하지 않음
1606
- }
1607
- }
1605
+ // 중복 확인은 AdsModule에서 이미 수행됨 - 여기서는 제거
1608
1606
  // 현재 슬롯 정보 가져오기
1609
1607
  const slot = this.slots.get(slotId);
1610
1608
  // 디바이스 정보 수집
@@ -2868,6 +2866,13 @@ class AdsModule {
2868
2866
  // 기존 내용 제거하고 슬라이더 추가
2869
2867
  container.innerHTML = '';
2870
2868
  container.appendChild(sliderElement);
2869
+ // ✅ 신규: 슬라이더에서도 첫 번째 광고에 대해 ViewabilityTracker 시작
2870
+ if (advertisements.length > 0) {
2871
+ this.startBasicViewabilityTracking(slot, advertisements[0]);
2872
+ if (this._config?.debug) {
2873
+ console.log(`🎯 Viewability tracking started for first ad in slider: ${slot.id}`);
2874
+ }
2875
+ }
2871
2876
  }
2872
2877
  /**
2873
2878
  * 광고 렌더링 (단일 광고용)
package/dist/index.esm.js CHANGED
@@ -1403,6 +1403,9 @@ class ViewableEventTracker {
1403
1403
  // viewable 이벤트 시점 기록 (메모리 + 세션 스토리지)
1404
1404
  ViewableEventTracker.viewableTracker.set(key, now);
1405
1405
  sessionStorage.setItem(sessionKey, now.toString());
1406
+ if (debug) {
1407
+ console.log(`🎯 New viewable event allowed for ad ${adId} in slot ${slotId}`);
1408
+ }
1406
1409
  // 오래된 세션 스토리지 데이터 정리 (선택적)
1407
1410
  ViewableEventTracker.cleanupOldViewables();
1408
1411
  return false;
@@ -1442,7 +1445,7 @@ class ViewableEventTracker {
1442
1445
  }
1443
1446
  }
1444
1447
  ViewableEventTracker.viewableTracker = new Map();
1445
- ViewableEventTracker.VIEWABLE_COOLDOWN = 300000; // 5분 쿨다운
1448
+ ViewableEventTracker.VIEWABLE_COOLDOWN = 30000; // 30초 쿨다운 (테스트용으로 단축)
1446
1449
 
1447
1450
  /**
1448
1451
  * 디바이스 정보 수집 클래스
@@ -1597,12 +1600,7 @@ class AdvertisementEventTracker {
1597
1600
  */
1598
1601
  async trackAdvertisementEvent(adId, slotId, eventType, additionalData) {
1599
1602
  try {
1600
- // VIEWABLE 이벤트의 경우 중복 확인
1601
- if (eventType === AdEventType.VIEWABLE) {
1602
- if (ViewableEventTracker.isDuplicateViewable(adId, slotId, this.debug)) {
1603
- return; // 중복 viewable 이벤트이므로 추적하지 않음
1604
- }
1605
- }
1603
+ // 중복 확인은 AdsModule에서 이미 수행됨 - 여기서는 제거
1606
1604
  // 현재 슬롯 정보 가져오기
1607
1605
  const slot = this.slots.get(slotId);
1608
1606
  // 디바이스 정보 수집
@@ -2866,6 +2864,13 @@ class AdsModule {
2866
2864
  // 기존 내용 제거하고 슬라이더 추가
2867
2865
  container.innerHTML = '';
2868
2866
  container.appendChild(sliderElement);
2867
+ // ✅ 신규: 슬라이더에서도 첫 번째 광고에 대해 ViewabilityTracker 시작
2868
+ if (advertisements.length > 0) {
2869
+ this.startBasicViewabilityTracking(slot, advertisements[0]);
2870
+ if (this._config?.debug) {
2871
+ console.log(`🎯 Viewability tracking started for first ad in slider: ${slot.id}`);
2872
+ }
2873
+ }
2869
2874
  }
2870
2875
  /**
2871
2876
  * 광고 렌더링 (단일 광고용)
@@ -1400,6 +1400,9 @@ class ViewableEventTracker {
1400
1400
  // viewable 이벤트 시점 기록 (메모리 + 세션 스토리지)
1401
1401
  ViewableEventTracker.viewableTracker.set(key, now);
1402
1402
  sessionStorage.setItem(sessionKey, now.toString());
1403
+ if (debug) {
1404
+ console.log(`🎯 New viewable event allowed for ad ${adId} in slot ${slotId}`);
1405
+ }
1403
1406
  // 오래된 세션 스토리지 데이터 정리 (선택적)
1404
1407
  ViewableEventTracker.cleanupOldViewables();
1405
1408
  return false;
@@ -1439,7 +1442,7 @@ class ViewableEventTracker {
1439
1442
  }
1440
1443
  }
1441
1444
  ViewableEventTracker.viewableTracker = new Map();
1442
- ViewableEventTracker.VIEWABLE_COOLDOWN = 300000; // 5분 쿨다운
1445
+ ViewableEventTracker.VIEWABLE_COOLDOWN = 30000; // 30초 쿨다운 (테스트용으로 단축)
1443
1446
 
1444
1447
  /**
1445
1448
  * 디바이스 정보 수집 클래스
@@ -1594,12 +1597,7 @@ class AdvertisementEventTracker {
1594
1597
  */
1595
1598
  async trackAdvertisementEvent(adId, slotId, eventType, additionalData) {
1596
1599
  try {
1597
- // VIEWABLE 이벤트의 경우 중복 확인
1598
- if (eventType === AdEventType.VIEWABLE) {
1599
- if (ViewableEventTracker.isDuplicateViewable(adId, slotId, this.debug)) {
1600
- return; // 중복 viewable 이벤트이므로 추적하지 않음
1601
- }
1602
- }
1600
+ // 중복 확인은 AdsModule에서 이미 수행됨 - 여기서는 제거
1603
1601
  // 현재 슬롯 정보 가져오기
1604
1602
  const slot = this.slots.get(slotId);
1605
1603
  // 디바이스 정보 수집
@@ -2863,6 +2861,13 @@ class AdsModule {
2863
2861
  // 기존 내용 제거하고 슬라이더 추가
2864
2862
  container.innerHTML = '';
2865
2863
  container.appendChild(sliderElement);
2864
+ // ✅ 신규: 슬라이더에서도 첫 번째 광고에 대해 ViewabilityTracker 시작
2865
+ if (advertisements.length > 0) {
2866
+ this.startBasicViewabilityTracking(slot, advertisements[0]);
2867
+ if (this._config?.debug) {
2868
+ console.log(`🎯 Viewability tracking started for first ad in slider: ${slot.id}`);
2869
+ }
2870
+ }
2866
2871
  }
2867
2872
  /**
2868
2873
  * 광고 렌더링 (단일 광고용)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adstage/web-sdk",
3
- "version": "2.3.4",
3
+ "version": "2.3.6",
4
4
  "description": "AdStage Web SDK - Production-ready marketing platform SDK with React Provider support for seamless integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs.js",
@@ -40,12 +40,7 @@ export class AdvertisementEventTracker {
40
40
  }
41
41
  ): Promise<void> {
42
42
  try {
43
- // VIEWABLE 이벤트의 경우 중복 확인
44
- if (eventType === AdEventType.VIEWABLE) {
45
- if (ViewableEventTracker.isDuplicateViewable(adId, slotId, this.debug)) {
46
- return; // 중복 viewable 이벤트이므로 추적하지 않음
47
- }
48
- }
43
+ // 중복 확인은 AdsModule에서 이미 수행됨 - 여기서는 제거
49
44
 
50
45
  // 현재 슬롯 정보 가져오기
51
46
  const slot = this.slots.get(slotId);
@@ -7,7 +7,7 @@
7
7
  */
8
8
  export class ViewableEventTracker {
9
9
  private static viewableTracker = new Map<string, number>();
10
- private static readonly VIEWABLE_COOLDOWN = 300000; // 5분 쿨다운
10
+ private static readonly VIEWABLE_COOLDOWN = 30000; // 30초 쿨다운 (테스트용으로 단축)
11
11
 
12
12
  /**
13
13
  * 중복 viewable 이벤트 여부 확인
@@ -44,6 +44,10 @@ export class ViewableEventTracker {
44
44
  ViewableEventTracker.viewableTracker.set(key, now);
45
45
  sessionStorage.setItem(sessionKey, now.toString());
46
46
 
47
+ if (debug) {
48
+ console.log(`🎯 New viewable event allowed for ad ${adId} in slot ${slotId}`);
49
+ }
50
+
47
51
  // 오래된 세션 스토리지 데이터 정리 (선택적)
48
52
  ViewableEventTracker.cleanupOldViewables();
49
53
 
@@ -1004,6 +1004,15 @@ export class AdsModule implements BaseModule {
1004
1004
  // 기존 내용 제거하고 슬라이더 추가
1005
1005
  container.innerHTML = '';
1006
1006
  container.appendChild(sliderElement);
1007
+
1008
+ // ✅ 신규: 슬라이더에서도 첫 번째 광고에 대해 ViewabilityTracker 시작
1009
+ if (advertisements.length > 0) {
1010
+ this.startBasicViewabilityTracking(slot, advertisements[0]);
1011
+
1012
+ if (this._config?.debug) {
1013
+ console.log(`🎯 Viewability tracking started for first ad in slider: ${slot.id}`);
1014
+ }
1015
+ }
1007
1016
  }
1008
1017
 
1009
1018
  /**