@adstage/web-sdk 1.3.0 → 1.3.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/dist/index.cjs.js CHANGED
@@ -1546,6 +1546,46 @@ class EventTracker {
1546
1546
  }
1547
1547
  return 0; // 기본값
1548
1548
  }
1549
+ /**
1550
+ * 커스텀 이벤트 추적
1551
+ */
1552
+ async trackCustomEvent(eventName, params) {
1553
+ try {
1554
+ // 디바이스 정보 수집
1555
+ const deviceInfo = DeviceInfoCollector.collectDeviceInfo();
1556
+ // 커스텀 이벤트 데이터 구성
1557
+ const eventData = {
1558
+ eventName,
1559
+ params: params || {},
1560
+ // 기본 메타데이터
1561
+ userAgent: deviceInfo.userAgent,
1562
+ platform: deviceInfo.platform,
1563
+ screenWidth: deviceInfo.screenWidth,
1564
+ screenHeight: deviceInfo.screenHeight,
1565
+ deviceId: deviceInfo.deviceId,
1566
+ sessionId: deviceInfo.sessionId,
1567
+ timestamp: new Date().toISOString(),
1568
+ // SDK 정보
1569
+ sdkVersion: '1.3.1',
1570
+ eventTimestamp: Date.now(),
1571
+ };
1572
+ // 커스텀 이벤트 API 엔드포인트로 전송
1573
+ await fetch(`${this.baseUrl}/events/custom`, {
1574
+ method: 'POST',
1575
+ headers: {
1576
+ 'x-api-key': this.apiKey,
1577
+ 'Content-Type': 'application/json',
1578
+ },
1579
+ body: JSON.stringify(eventData),
1580
+ });
1581
+ if (this.debug) {
1582
+ console.log(`📊 커스텀 이벤트 추적: ${eventName}`, eventData);
1583
+ }
1584
+ }
1585
+ catch (error) {
1586
+ console.error('커스텀 이벤트 추적 실패:', error);
1587
+ }
1588
+ }
1549
1589
  }
1550
1590
 
1551
1591
  /**
@@ -1752,7 +1792,7 @@ function trackEvent(eventName, params) {
1752
1792
  return;
1753
1793
  }
1754
1794
  try {
1755
- globalSDKInstance.trackEvent(eventName, {
1795
+ globalSDKInstance.trackCustomEvent(eventName, {
1756
1796
  timestamp: new Date().toISOString(),
1757
1797
  ...params
1758
1798
  });
@@ -2020,6 +2060,23 @@ class AdStageSDK {
2020
2060
  getAllSlots() {
2021
2061
  return new Map(this.slots);
2022
2062
  }
2063
+ /**
2064
+ * 커스텀 이벤트 추적
2065
+ */
2066
+ trackCustomEvent(eventName, params) {
2067
+ try {
2068
+ this.eventTracker.trackCustomEvent(eventName, {
2069
+ timestamp: new Date().toISOString(),
2070
+ ...params
2071
+ });
2072
+ if (this.config.debug) {
2073
+ console.log(`📊 커스텀 이벤트 추적: ${eventName}`, params);
2074
+ }
2075
+ }
2076
+ catch (error) {
2077
+ console.error('커스텀 이벤트 추적 실패:', error);
2078
+ }
2079
+ }
2023
2080
  }
2024
2081
  AdStageSDK.instance = null;
2025
2082
  async function autoInit() {
package/dist/index.d.ts CHANGED
@@ -292,6 +292,10 @@ declare class AdStageSDK {
292
292
  * 모든 슬롯 정보 가져오기
293
293
  */
294
294
  getAllSlots(): Map<string, AdSlot>;
295
+ /**
296
+ * 커스텀 이벤트 추적
297
+ */
298
+ trackCustomEvent(eventName: string, params?: Record<string, any>): void;
295
299
  }
296
300
 
297
301
  export { AdEventType, AdSlot, AdStageConfig, AdStageSDK, AdType, Advertisement, SimpleAdStageConfig, createBanner, createTextAd, createVideoAd, AdStageSDK as default, destroyAdStage, getAdStageInstance, initAdStage, isAdStageReady, trackEvent };
package/dist/index.esm.js CHANGED
@@ -1542,6 +1542,46 @@ class EventTracker {
1542
1542
  }
1543
1543
  return 0; // 기본값
1544
1544
  }
1545
+ /**
1546
+ * 커스텀 이벤트 추적
1547
+ */
1548
+ async trackCustomEvent(eventName, params) {
1549
+ try {
1550
+ // 디바이스 정보 수집
1551
+ const deviceInfo = DeviceInfoCollector.collectDeviceInfo();
1552
+ // 커스텀 이벤트 데이터 구성
1553
+ const eventData = {
1554
+ eventName,
1555
+ params: params || {},
1556
+ // 기본 메타데이터
1557
+ userAgent: deviceInfo.userAgent,
1558
+ platform: deviceInfo.platform,
1559
+ screenWidth: deviceInfo.screenWidth,
1560
+ screenHeight: deviceInfo.screenHeight,
1561
+ deviceId: deviceInfo.deviceId,
1562
+ sessionId: deviceInfo.sessionId,
1563
+ timestamp: new Date().toISOString(),
1564
+ // SDK 정보
1565
+ sdkVersion: '1.3.1',
1566
+ eventTimestamp: Date.now(),
1567
+ };
1568
+ // 커스텀 이벤트 API 엔드포인트로 전송
1569
+ await fetch(`${this.baseUrl}/events/custom`, {
1570
+ method: 'POST',
1571
+ headers: {
1572
+ 'x-api-key': this.apiKey,
1573
+ 'Content-Type': 'application/json',
1574
+ },
1575
+ body: JSON.stringify(eventData),
1576
+ });
1577
+ if (this.debug) {
1578
+ console.log(`📊 커스텀 이벤트 추적: ${eventName}`, eventData);
1579
+ }
1580
+ }
1581
+ catch (error) {
1582
+ console.error('커스텀 이벤트 추적 실패:', error);
1583
+ }
1584
+ }
1545
1585
  }
1546
1586
 
1547
1587
  /**
@@ -1748,7 +1788,7 @@ function trackEvent(eventName, params) {
1748
1788
  return;
1749
1789
  }
1750
1790
  try {
1751
- globalSDKInstance.trackEvent(eventName, {
1791
+ globalSDKInstance.trackCustomEvent(eventName, {
1752
1792
  timestamp: new Date().toISOString(),
1753
1793
  ...params
1754
1794
  });
@@ -2016,6 +2056,23 @@ class AdStageSDK {
2016
2056
  getAllSlots() {
2017
2057
  return new Map(this.slots);
2018
2058
  }
2059
+ /**
2060
+ * 커스텀 이벤트 추적
2061
+ */
2062
+ trackCustomEvent(eventName, params) {
2063
+ try {
2064
+ this.eventTracker.trackCustomEvent(eventName, {
2065
+ timestamp: new Date().toISOString(),
2066
+ ...params
2067
+ });
2068
+ if (this.config.debug) {
2069
+ console.log(`📊 커스텀 이벤트 추적: ${eventName}`, params);
2070
+ }
2071
+ }
2072
+ catch (error) {
2073
+ console.error('커스텀 이벤트 추적 실패:', error);
2074
+ }
2075
+ }
2019
2076
  }
2020
2077
  AdStageSDK.instance = null;
2021
2078
  async function autoInit() {
@@ -1542,6 +1542,46 @@ class EventTracker {
1542
1542
  }
1543
1543
  return 0; // 기본값
1544
1544
  }
1545
+ /**
1546
+ * 커스텀 이벤트 추적
1547
+ */
1548
+ async trackCustomEvent(eventName, params) {
1549
+ try {
1550
+ // 디바이스 정보 수집
1551
+ const deviceInfo = DeviceInfoCollector.collectDeviceInfo();
1552
+ // 커스텀 이벤트 데이터 구성
1553
+ const eventData = {
1554
+ eventName,
1555
+ params: params || {},
1556
+ // 기본 메타데이터
1557
+ userAgent: deviceInfo.userAgent,
1558
+ platform: deviceInfo.platform,
1559
+ screenWidth: deviceInfo.screenWidth,
1560
+ screenHeight: deviceInfo.screenHeight,
1561
+ deviceId: deviceInfo.deviceId,
1562
+ sessionId: deviceInfo.sessionId,
1563
+ timestamp: new Date().toISOString(),
1564
+ // SDK 정보
1565
+ sdkVersion: '1.3.1',
1566
+ eventTimestamp: Date.now(),
1567
+ };
1568
+ // 커스텀 이벤트 API 엔드포인트로 전송
1569
+ await fetch(`${this.baseUrl}/events/custom`, {
1570
+ method: 'POST',
1571
+ headers: {
1572
+ 'x-api-key': this.apiKey,
1573
+ 'Content-Type': 'application/json',
1574
+ },
1575
+ body: JSON.stringify(eventData),
1576
+ });
1577
+ if (this.debug) {
1578
+ console.log(`📊 커스텀 이벤트 추적: ${eventName}`, eventData);
1579
+ }
1580
+ }
1581
+ catch (error) {
1582
+ console.error('커스텀 이벤트 추적 실패:', error);
1583
+ }
1584
+ }
1545
1585
  }
1546
1586
 
1547
1587
  /**
@@ -1748,7 +1788,7 @@ function trackEvent(eventName, params) {
1748
1788
  return;
1749
1789
  }
1750
1790
  try {
1751
- globalSDKInstance.trackEvent(eventName, {
1791
+ globalSDKInstance.trackCustomEvent(eventName, {
1752
1792
  timestamp: new Date().toISOString(),
1753
1793
  ...params
1754
1794
  });
@@ -2016,6 +2056,23 @@ class AdStageSDK {
2016
2056
  getAllSlots() {
2017
2057
  return new Map(this.slots);
2018
2058
  }
2059
+ /**
2060
+ * 커스텀 이벤트 추적
2061
+ */
2062
+ trackCustomEvent(eventName, params) {
2063
+ try {
2064
+ this.eventTracker.trackCustomEvent(eventName, {
2065
+ timestamp: new Date().toISOString(),
2066
+ ...params
2067
+ });
2068
+ if (this.config.debug) {
2069
+ console.log(`📊 커스텀 이벤트 추적: ${eventName}`, params);
2070
+ }
2071
+ }
2072
+ catch (error) {
2073
+ console.error('커스텀 이벤트 추적 실패:', error);
2074
+ }
2075
+ }
2019
2076
  }
2020
2077
  AdStageSDK.instance = null;
2021
2078
  async function autoInit() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adstage/web-sdk",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "AdStage Web SDK for displaying advertisements",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs.js",
package/src/index.ts CHANGED
@@ -314,6 +314,23 @@ export class AdStageSDK {
314
314
  getAllSlots(): Map<string, AdSlot> {
315
315
  return new Map(this.slots);
316
316
  }
317
+
318
+ /**
319
+ * 커스텀 이벤트 추적
320
+ */
321
+ trackCustomEvent(eventName: string, params?: Record<string, any>): void {
322
+ try {
323
+ this.eventTracker.trackCustomEvent(eventName, {
324
+ timestamp: new Date().toISOString(),
325
+ ...params
326
+ });
327
+ if (this.config.debug) {
328
+ console.log(`📊 커스텀 이벤트 추적: ${eventName}`, params);
329
+ }
330
+ } catch (error) {
331
+ console.error('커스텀 이벤트 추적 실패:', error);
332
+ }
333
+ }
317
334
  }
318
335
 
319
336
  async function autoInit() {
@@ -128,4 +128,52 @@ export class EventTracker {
128
128
 
129
129
  return 0; // 기본값
130
130
  }
131
+
132
+ /**
133
+ * 커스텀 이벤트 추적
134
+ */
135
+ async trackCustomEvent(eventName: string, params?: Record<string, any>): Promise<void> {
136
+ try {
137
+ // 디바이스 정보 수집
138
+ const deviceInfo = DeviceInfoCollector.collectDeviceInfo();
139
+
140
+ // 커스텀 이벤트 데이터 구성
141
+ const eventData = {
142
+ eventName,
143
+ params: params || {},
144
+
145
+ // 기본 메타데이터
146
+ userAgent: deviceInfo.userAgent,
147
+ platform: deviceInfo.platform,
148
+ screenWidth: deviceInfo.screenWidth,
149
+ screenHeight: deviceInfo.screenHeight,
150
+ deviceId: deviceInfo.deviceId,
151
+ sessionId: deviceInfo.sessionId,
152
+ timestamp: new Date().toISOString(),
153
+
154
+ // SDK 정보
155
+ sdkVersion: '1.3.1',
156
+ eventTimestamp: Date.now(),
157
+ };
158
+
159
+ // 커스텀 이벤트 API 엔드포인트로 전송
160
+ await fetch(
161
+ `${this.baseUrl}/events/custom`,
162
+ {
163
+ method: 'POST',
164
+ headers: {
165
+ 'x-api-key': this.apiKey,
166
+ 'Content-Type': 'application/json',
167
+ },
168
+ body: JSON.stringify(eventData),
169
+ }
170
+ );
171
+
172
+ if (this.debug) {
173
+ console.log(`📊 커스텀 이벤트 추적: ${eventName}`, eventData);
174
+ }
175
+ } catch (error) {
176
+ console.error('커스텀 이벤트 추적 실패:', error);
177
+ }
178
+ }
131
179
  }
@@ -131,7 +131,7 @@ export function trackEvent(eventName: string, params?: Record<string, any>): voi
131
131
  }
132
132
 
133
133
  try {
134
- globalSDKInstance.trackEvent(eventName, {
134
+ globalSDKInstance.trackCustomEvent(eventName, {
135
135
  timestamp: new Date().toISOString(),
136
136
  ...params
137
137
  });