@adstage/react-native-sdk 1.0.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/LICENSE +21 -0
- package/README.md +327 -0
- package/adstage-react-native.podspec +24 -0
- package/android/build.gradle +66 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/io/nbase/adstage/reactnative/AdStageModule.kt +701 -0
- package/android/src/main/java/io/nbase/adstage/reactnative/AdStagePackage.kt +24 -0
- package/ios/AdStageModule.m +70 -0
- package/ios/AdStageModule.swift +457 -0
- package/lib/commonjs/AdStage.js +213 -0
- package/lib/commonjs/AdStage.js.map +1 -0
- package/lib/commonjs/deeplink/AdStageDeepLink.js +235 -0
- package/lib/commonjs/deeplink/AdStageDeepLink.js.map +1 -0
- package/lib/commonjs/event/AdStageEvent.js +689 -0
- package/lib/commonjs/event/AdStageEvent.js.map +1 -0
- package/lib/commonjs/index.js +34 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/promotion/AdStagePromotion.js +158 -0
- package/lib/commonjs/promotion/AdStagePromotion.js.map +1 -0
- package/lib/commonjs/types.js +2 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/AdStage.js +206 -0
- package/lib/module/AdStage.js.map +1 -0
- package/lib/module/deeplink/AdStageDeepLink.js +228 -0
- package/lib/module/deeplink/AdStageDeepLink.js.map +1 -0
- package/lib/module/event/AdStageEvent.js +682 -0
- package/lib/module/event/AdStageEvent.js.map +1 -0
- package/lib/module/index.js +15 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/promotion/AdStagePromotion.js +151 -0
- package/lib/module/promotion/AdStagePromotion.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/src/AdStage.d.ts +124 -0
- package/lib/typescript/src/AdStage.d.ts.map +1 -0
- package/lib/typescript/src/deeplink/AdStageDeepLink.d.ts +154 -0
- package/lib/typescript/src/deeplink/AdStageDeepLink.d.ts.map +1 -0
- package/lib/typescript/src/event/AdStageEvent.d.ts +426 -0
- package/lib/typescript/src/event/AdStageEvent.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +13 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/promotion/AdStagePromotion.d.ts +98 -0
- package/lib/typescript/src/promotion/AdStagePromotion.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +305 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/package.json +105 -0
- package/src/AdStage.ts +212 -0
- package/src/deeplink/AdStageDeepLink.ts +246 -0
- package/src/event/AdStageEvent.ts +844 -0
- package/src/index.ts +48 -0
- package/src/promotion/AdStagePromotion.ts +162 -0
- package/src/types.ts +392 -0
|
@@ -0,0 +1,844 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AdStage Event 모듈
|
|
3
|
+
*
|
|
4
|
+
* 이벤트 트래킹을 담당합니다.
|
|
5
|
+
* Android AdStageEvent, iOS AdStageEventProtocol, Unity AdStageEvent와 동일한 표준 이벤트를 제공합니다.
|
|
6
|
+
*
|
|
7
|
+
* @since 3.0.0
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { NativeModules } from 'react-native';
|
|
11
|
+
import type {
|
|
12
|
+
TrackEventParams,
|
|
13
|
+
TrackEventResult,
|
|
14
|
+
SignUpMethod,
|
|
15
|
+
PaymentMethod,
|
|
16
|
+
EcommerceItem,
|
|
17
|
+
AdPlatform,
|
|
18
|
+
AdFormat,
|
|
19
|
+
GameServerInfo,
|
|
20
|
+
PatchInfo,
|
|
21
|
+
StockTransactionInfo,
|
|
22
|
+
AccountOpenInfo,
|
|
23
|
+
CardApplicationInfo,
|
|
24
|
+
} from '../types';
|
|
25
|
+
|
|
26
|
+
const { AdStageModule } = NativeModules;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* AdStage Event 클래스
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* // 커스텀 이벤트
|
|
34
|
+
* await AdStage.event.track('button_click', { buttonId: 'cta_1' });
|
|
35
|
+
*
|
|
36
|
+
* // 표준 이벤트
|
|
37
|
+
* await AdStage.event.trackPurchase({
|
|
38
|
+
* value: 29.99,
|
|
39
|
+
* currency: 'USD',
|
|
40
|
+
* transactionId: 'TX_123'
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export class AdStageEvent {
|
|
45
|
+
// ============================================
|
|
46
|
+
// Generic Event Tracking
|
|
47
|
+
// ============================================
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* 커스텀 이벤트 전송
|
|
51
|
+
*
|
|
52
|
+
* @param eventName - 이벤트 이름
|
|
53
|
+
* @param params - 이벤트 파라미터 (자유 형식)
|
|
54
|
+
* @returns 전송 결과
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* await AdStage.event.track('button_click', {
|
|
59
|
+
* buttonId: 'cta_purchase',
|
|
60
|
+
* screenName: 'product_detail'
|
|
61
|
+
* });
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
static async track(
|
|
65
|
+
eventName: string,
|
|
66
|
+
params: TrackEventParams = {}
|
|
67
|
+
): Promise<TrackEventResult> {
|
|
68
|
+
if (!AdStageModule) {
|
|
69
|
+
throw new Error('AdStage: Native module is not available');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
try {
|
|
73
|
+
const result = await AdStageModule.trackEvent(eventName, params);
|
|
74
|
+
return {
|
|
75
|
+
success: true,
|
|
76
|
+
eventId: result.eventId,
|
|
77
|
+
};
|
|
78
|
+
} catch (error) {
|
|
79
|
+
return {
|
|
80
|
+
success: false,
|
|
81
|
+
error:
|
|
82
|
+
error instanceof Error ? error.message : 'Unknown error occurred',
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// ============================================
|
|
88
|
+
// 📌 광고 추적 이벤트
|
|
89
|
+
// ============================================
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* 클릭 이벤트
|
|
93
|
+
*/
|
|
94
|
+
static async trackClick(params: TrackEventParams = {}): Promise<TrackEventResult> {
|
|
95
|
+
return this.track('click', params);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* 뷰/노출 이벤트
|
|
100
|
+
*/
|
|
101
|
+
static async trackView(params: TrackEventParams = {}): Promise<TrackEventResult> {
|
|
102
|
+
return this.track('view', params);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* 설치 이벤트 (일반적으로 SDK가 자동 전송)
|
|
107
|
+
*/
|
|
108
|
+
static async trackInstall(params: TrackEventParams = {}): Promise<TrackEventResult> {
|
|
109
|
+
return this.track('install', params);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// ============================================
|
|
113
|
+
// 👤 사용자 라이프사이클
|
|
114
|
+
// ============================================
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* 회원가입 완료 이벤트
|
|
118
|
+
*
|
|
119
|
+
* @param method - 가입 방법
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```typescript
|
|
123
|
+
* await AdStage.event.trackSignUp('google');
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
static async trackSignUp(
|
|
127
|
+
method?: SignUpMethod
|
|
128
|
+
): Promise<TrackEventResult> {
|
|
129
|
+
const params: TrackEventParams = {};
|
|
130
|
+
if (method) params.method = method;
|
|
131
|
+
return this.track('sign_up', params);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* 회원가입 시작 이벤트
|
|
136
|
+
*/
|
|
137
|
+
static async trackSignUpStart(
|
|
138
|
+
params: TrackEventParams = {}
|
|
139
|
+
): Promise<TrackEventResult> {
|
|
140
|
+
return this.track('sign_up_start', params);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* 로그인 이벤트
|
|
145
|
+
*
|
|
146
|
+
* @param method - 로그인 방법
|
|
147
|
+
*/
|
|
148
|
+
static async trackLogin(method?: SignUpMethod): Promise<TrackEventResult> {
|
|
149
|
+
const params: TrackEventParams = {};
|
|
150
|
+
if (method) params.method = method;
|
|
151
|
+
return this.track('login', params);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* 로그아웃 이벤트
|
|
156
|
+
*/
|
|
157
|
+
static async trackLogout(
|
|
158
|
+
params: TrackEventParams = {}
|
|
159
|
+
): Promise<TrackEventResult> {
|
|
160
|
+
return this.track('logout', params);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// ============================================
|
|
164
|
+
// 📄 콘텐츠 조회
|
|
165
|
+
// ============================================
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* 홈 화면 조회 이벤트
|
|
169
|
+
*/
|
|
170
|
+
static async trackHomeView(
|
|
171
|
+
params: TrackEventParams = {}
|
|
172
|
+
): Promise<TrackEventResult> {
|
|
173
|
+
return this.track('home_view', params);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* 상품 목록 조회 이벤트
|
|
178
|
+
*
|
|
179
|
+
* @param itemCategory - 상품 카테고리
|
|
180
|
+
*/
|
|
181
|
+
static async trackProductListView(
|
|
182
|
+
itemCategory?: string
|
|
183
|
+
): Promise<TrackEventResult> {
|
|
184
|
+
const params: TrackEventParams = {};
|
|
185
|
+
if (itemCategory) params.item_category = itemCategory;
|
|
186
|
+
return this.track('product_list_view', params);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* 검색 결과 조회 이벤트
|
|
191
|
+
*
|
|
192
|
+
* @param searchTerm - 검색어
|
|
193
|
+
*/
|
|
194
|
+
static async trackSearchResultView(
|
|
195
|
+
searchTerm?: string
|
|
196
|
+
): Promise<TrackEventResult> {
|
|
197
|
+
const params: TrackEventParams = {};
|
|
198
|
+
if (searchTerm) params.search_term = searchTerm;
|
|
199
|
+
return this.track('search_result_view', params);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* 상품 상세 조회 이벤트
|
|
204
|
+
*/
|
|
205
|
+
static async trackProductDetailsView(options?: {
|
|
206
|
+
itemId?: string;
|
|
207
|
+
itemName?: string;
|
|
208
|
+
}): Promise<TrackEventResult> {
|
|
209
|
+
const params: TrackEventParams = {};
|
|
210
|
+
if (options?.itemId) params.item_id = options.itemId;
|
|
211
|
+
if (options?.itemName) params.item_name = options.itemName;
|
|
212
|
+
return this.track('product_details_view', params);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* 화면 조회 이벤트
|
|
217
|
+
*/
|
|
218
|
+
static async trackScreenView(options?: {
|
|
219
|
+
screenName?: string;
|
|
220
|
+
screenClass?: string;
|
|
221
|
+
}): Promise<TrackEventResult> {
|
|
222
|
+
const params: TrackEventParams = {};
|
|
223
|
+
if (options?.screenName) params.screen_name = options.screenName;
|
|
224
|
+
if (options?.screenClass) params.screen_class = options.screenClass;
|
|
225
|
+
return this.track('screen_view', params);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// ============================================
|
|
229
|
+
// 🛒 전자상거래
|
|
230
|
+
// ============================================
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* 장바구니 추가 이벤트
|
|
234
|
+
*/
|
|
235
|
+
static async trackAddToCart(options: {
|
|
236
|
+
items: EcommerceItem[];
|
|
237
|
+
value?: number;
|
|
238
|
+
currency?: string;
|
|
239
|
+
}): Promise<TrackEventResult> {
|
|
240
|
+
return this.track('add_to_cart', {
|
|
241
|
+
items: options.items,
|
|
242
|
+
value: options.value,
|
|
243
|
+
currency: options.currency,
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* 장바구니 제거 이벤트
|
|
249
|
+
*/
|
|
250
|
+
static async trackRemoveFromCart(options: {
|
|
251
|
+
items: EcommerceItem[];
|
|
252
|
+
value?: number;
|
|
253
|
+
currency?: string;
|
|
254
|
+
}): Promise<TrackEventResult> {
|
|
255
|
+
return this.track('remove_from_cart', {
|
|
256
|
+
items: options.items,
|
|
257
|
+
value: options.value,
|
|
258
|
+
currency: options.currency,
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* 결제 시작 이벤트
|
|
264
|
+
*/
|
|
265
|
+
static async trackBeginCheckout(options?: {
|
|
266
|
+
items?: EcommerceItem[];
|
|
267
|
+
value?: number;
|
|
268
|
+
currency?: string;
|
|
269
|
+
coupon?: string;
|
|
270
|
+
}): Promise<TrackEventResult> {
|
|
271
|
+
return this.track('begin_checkout', options ?? {});
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* 결제 정보 추가 이벤트
|
|
276
|
+
*/
|
|
277
|
+
static async trackAddPaymentInfo(options?: {
|
|
278
|
+
paymentMethod?: PaymentMethod;
|
|
279
|
+
}): Promise<TrackEventResult> {
|
|
280
|
+
const params: TrackEventParams = {};
|
|
281
|
+
if (options?.paymentMethod) params.payment_method = options.paymentMethod;
|
|
282
|
+
return this.track('add_payment_info', params);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* 구매 완료 이벤트
|
|
287
|
+
*
|
|
288
|
+
* @example
|
|
289
|
+
* ```typescript
|
|
290
|
+
* await AdStage.event.trackPurchase({
|
|
291
|
+
* value: 99000,
|
|
292
|
+
* currency: 'KRW',
|
|
293
|
+
* transactionId: 'TX_123456',
|
|
294
|
+
* items: [
|
|
295
|
+
* { itemId: 'SKU_001', itemName: '상품명', price: 99000, quantity: 1 }
|
|
296
|
+
* ]
|
|
297
|
+
* });
|
|
298
|
+
* ```
|
|
299
|
+
*/
|
|
300
|
+
static async trackPurchase(options: {
|
|
301
|
+
value: number;
|
|
302
|
+
currency: string;
|
|
303
|
+
transactionId?: string;
|
|
304
|
+
items?: EcommerceItem[];
|
|
305
|
+
paymentMethod?: PaymentMethod;
|
|
306
|
+
coupon?: string;
|
|
307
|
+
shipping?: number;
|
|
308
|
+
tax?: number;
|
|
309
|
+
}): Promise<TrackEventResult> {
|
|
310
|
+
return this.track('purchase', {
|
|
311
|
+
value: options.value,
|
|
312
|
+
currency: options.currency,
|
|
313
|
+
transaction_id: options.transactionId,
|
|
314
|
+
items: options.items,
|
|
315
|
+
payment_method: options.paymentMethod,
|
|
316
|
+
coupon: options.coupon,
|
|
317
|
+
shipping: options.shipping,
|
|
318
|
+
tax: options.tax,
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* 환불 이벤트
|
|
324
|
+
*/
|
|
325
|
+
static async trackRefund(options: {
|
|
326
|
+
transactionId: string;
|
|
327
|
+
value?: number;
|
|
328
|
+
currency?: string;
|
|
329
|
+
items?: EcommerceItem[];
|
|
330
|
+
}): Promise<TrackEventResult> {
|
|
331
|
+
return this.track('refund', {
|
|
332
|
+
transaction_id: options.transactionId,
|
|
333
|
+
value: options.value,
|
|
334
|
+
currency: options.currency,
|
|
335
|
+
items: options.items,
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// ============================================
|
|
340
|
+
// 🎮 게임 이벤트
|
|
341
|
+
// ============================================
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* 레벨업 이벤트
|
|
345
|
+
*/
|
|
346
|
+
static async trackLevelUp(options: {
|
|
347
|
+
level: number;
|
|
348
|
+
character?: string;
|
|
349
|
+
}): Promise<TrackEventResult> {
|
|
350
|
+
return this.track('level_up', {
|
|
351
|
+
level: options.level,
|
|
352
|
+
character: options.character,
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* 튜토리얼 시작 이벤트
|
|
358
|
+
*/
|
|
359
|
+
static async trackTutorialBegin(
|
|
360
|
+
params: TrackEventParams = {}
|
|
361
|
+
): Promise<TrackEventResult> {
|
|
362
|
+
return this.track('tutorial_begin', params);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* 튜토리얼 완료 이벤트
|
|
367
|
+
*/
|
|
368
|
+
static async trackTutorialComplete(
|
|
369
|
+
params: TrackEventParams = {}
|
|
370
|
+
): Promise<TrackEventResult> {
|
|
371
|
+
return this.track('tutorial_complete', params);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* 업적 달성 이벤트
|
|
376
|
+
*/
|
|
377
|
+
static async trackUnlockAchievement(options: {
|
|
378
|
+
achievementId: string;
|
|
379
|
+
achievementName?: string;
|
|
380
|
+
}): Promise<TrackEventResult> {
|
|
381
|
+
return this.track('unlock_achievement', {
|
|
382
|
+
achievement_id: options.achievementId,
|
|
383
|
+
achievement_name: options.achievementName,
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* 스테이지 클리어 이벤트
|
|
389
|
+
*/
|
|
390
|
+
static async trackStageClear(options: {
|
|
391
|
+
stageName: string;
|
|
392
|
+
stageNumber?: number;
|
|
393
|
+
score?: number;
|
|
394
|
+
duration?: number;
|
|
395
|
+
}): Promise<TrackEventResult> {
|
|
396
|
+
return this.track('stage_clear', {
|
|
397
|
+
stage_name: options.stageName,
|
|
398
|
+
stage_number: options.stageNumber,
|
|
399
|
+
score: options.score,
|
|
400
|
+
duration: options.duration,
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// ============================================
|
|
405
|
+
// 💎 가상화폐
|
|
406
|
+
// ============================================
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* 가상화폐 획득 이벤트
|
|
410
|
+
*/
|
|
411
|
+
static async trackEarnVirtualCurrency(options: {
|
|
412
|
+
virtualCurrencyName: string;
|
|
413
|
+
value: number;
|
|
414
|
+
}): Promise<TrackEventResult> {
|
|
415
|
+
return this.track('earn_virtual_currency', {
|
|
416
|
+
virtual_currency_name: options.virtualCurrencyName,
|
|
417
|
+
value: options.value,
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* 가상화폐 사용 이벤트
|
|
423
|
+
*/
|
|
424
|
+
static async trackSpendVirtualCurrency(options: {
|
|
425
|
+
virtualCurrencyName: string;
|
|
426
|
+
value: number;
|
|
427
|
+
itemName?: string;
|
|
428
|
+
}): Promise<TrackEventResult> {
|
|
429
|
+
return this.track('spend_virtual_currency', {
|
|
430
|
+
virtual_currency_name: options.virtualCurrencyName,
|
|
431
|
+
value: options.value,
|
|
432
|
+
item_name: options.itemName,
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
// ============================================
|
|
437
|
+
// 🔔 기타 이벤트
|
|
438
|
+
// ============================================
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* 공유 이벤트
|
|
442
|
+
*/
|
|
443
|
+
static async trackShare(options: {
|
|
444
|
+
method: string;
|
|
445
|
+
contentType?: string;
|
|
446
|
+
itemId?: string;
|
|
447
|
+
}): Promise<TrackEventResult> {
|
|
448
|
+
return this.track('share', {
|
|
449
|
+
method: options.method,
|
|
450
|
+
content_type: options.contentType,
|
|
451
|
+
item_id: options.itemId,
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* 앱 평가 이벤트
|
|
457
|
+
*/
|
|
458
|
+
static async trackRate(options: {
|
|
459
|
+
rating: number;
|
|
460
|
+
maxRating?: number;
|
|
461
|
+
}): Promise<TrackEventResult> {
|
|
462
|
+
return this.track('rate', {
|
|
463
|
+
rating: options.rating,
|
|
464
|
+
max_rating: options.maxRating ?? 5,
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* 구독 시작 이벤트
|
|
470
|
+
*/
|
|
471
|
+
static async trackSubscribe(options: {
|
|
472
|
+
subscriptionId: string;
|
|
473
|
+
value?: number;
|
|
474
|
+
currency?: string;
|
|
475
|
+
period?: string;
|
|
476
|
+
}): Promise<TrackEventResult> {
|
|
477
|
+
return this.track('subscribe', {
|
|
478
|
+
subscription_id: options.subscriptionId,
|
|
479
|
+
value: options.value,
|
|
480
|
+
currency: options.currency,
|
|
481
|
+
period: options.period,
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* 푸시 알림 클릭 이벤트
|
|
487
|
+
*/
|
|
488
|
+
static async trackNotificationClick(options?: {
|
|
489
|
+
notificationId?: string;
|
|
490
|
+
title?: string;
|
|
491
|
+
body?: string;
|
|
492
|
+
}): Promise<TrackEventResult> {
|
|
493
|
+
return this.track('notification_click', {
|
|
494
|
+
notification_id: options?.notificationId,
|
|
495
|
+
title: options?.title,
|
|
496
|
+
body: options?.body,
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
// ============================================
|
|
501
|
+
// 🆕 Unity 호환 추가 이벤트
|
|
502
|
+
// ============================================
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* 앱 최초 실행 이벤트 (Unity: FirstOpenEvent)
|
|
506
|
+
*/
|
|
507
|
+
static async trackFirstOpen(
|
|
508
|
+
params: TrackEventParams = {}
|
|
509
|
+
): Promise<TrackEventResult> {
|
|
510
|
+
return this.track('first_open', params);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* 페이지 조회 이벤트 (Unity: PageViewEvent) - 웹뷰용
|
|
515
|
+
*/
|
|
516
|
+
static async trackPageView(options?: {
|
|
517
|
+
pageUrl?: string;
|
|
518
|
+
pageTitle?: string;
|
|
519
|
+
pagePath?: string;
|
|
520
|
+
referrer?: string;
|
|
521
|
+
}): Promise<TrackEventResult> {
|
|
522
|
+
return this.track('page_view', {
|
|
523
|
+
page_url: options?.pageUrl,
|
|
524
|
+
page_title: options?.pageTitle,
|
|
525
|
+
page_path: options?.pagePath,
|
|
526
|
+
referrer: options?.referrer,
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* 위시리스트 추가 이벤트 (Unity: AddToWishlistEvent)
|
|
532
|
+
*/
|
|
533
|
+
static async trackAddToWishlist(options?: {
|
|
534
|
+
itemId?: string;
|
|
535
|
+
itemName?: string;
|
|
536
|
+
value?: number;
|
|
537
|
+
currency?: string;
|
|
538
|
+
}): Promise<TrackEventResult> {
|
|
539
|
+
return this.track('add_to_wishlist', {
|
|
540
|
+
item_id: options?.itemId,
|
|
541
|
+
item_name: options?.itemName,
|
|
542
|
+
value: options?.value,
|
|
543
|
+
currency: options?.currency,
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* 체험판 시작 이벤트 (Unity: StartTrialEvent)
|
|
549
|
+
*
|
|
550
|
+
* @example
|
|
551
|
+
* ```typescript
|
|
552
|
+
* await AdStage.event.trackStartTrial({
|
|
553
|
+
* value: 9900.0,
|
|
554
|
+
* currency: 'KRW',
|
|
555
|
+
* trialDays: 14
|
|
556
|
+
* });
|
|
557
|
+
* ```
|
|
558
|
+
*/
|
|
559
|
+
static async trackStartTrial(options?: {
|
|
560
|
+
value?: number;
|
|
561
|
+
currency?: string;
|
|
562
|
+
trialDays?: number;
|
|
563
|
+
}): Promise<TrackEventResult> {
|
|
564
|
+
return this.track('start_trial', {
|
|
565
|
+
value: options?.value,
|
|
566
|
+
currency: options?.currency,
|
|
567
|
+
trial_days: options?.trialDays,
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* 구독 해지 이벤트 (Unity: UnsubscribeEvent)
|
|
573
|
+
*/
|
|
574
|
+
static async trackUnsubscribe(subscriptionId: string): Promise<TrackEventResult> {
|
|
575
|
+
return this.track('unsubscribe', {
|
|
576
|
+
subscription_id: subscriptionId,
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
// ============================================
|
|
581
|
+
// 📢 인앱 광고 이벤트
|
|
582
|
+
// ============================================
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* 인앱 광고 노출 이벤트 (Unity: AdImpressionEvent)
|
|
586
|
+
*/
|
|
587
|
+
static async trackAdImpression(options?: {
|
|
588
|
+
adPlatform?: AdPlatform | string;
|
|
589
|
+
adSource?: string;
|
|
590
|
+
adFormat?: AdFormat | string;
|
|
591
|
+
adUnitName?: string;
|
|
592
|
+
value?: number;
|
|
593
|
+
currency?: string;
|
|
594
|
+
}): Promise<TrackEventResult> {
|
|
595
|
+
return this.track('ad_impression', {
|
|
596
|
+
ad_platform: options?.adPlatform,
|
|
597
|
+
ad_source: options?.adSource,
|
|
598
|
+
ad_format: options?.adFormat,
|
|
599
|
+
ad_unit_name: options?.adUnitName,
|
|
600
|
+
value: options?.value,
|
|
601
|
+
currency: options?.currency,
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* 인앱 광고 클릭 이벤트 (Unity: AdClickEvent)
|
|
607
|
+
*/
|
|
608
|
+
static async trackAdClick(options?: {
|
|
609
|
+
adPlatform?: AdPlatform | string;
|
|
610
|
+
adSource?: string;
|
|
611
|
+
adFormat?: AdFormat | string;
|
|
612
|
+
adUnitName?: string;
|
|
613
|
+
}): Promise<TrackEventResult> {
|
|
614
|
+
return this.track('ad_click', {
|
|
615
|
+
ad_platform: options?.adPlatform,
|
|
616
|
+
ad_source: options?.adSource,
|
|
617
|
+
ad_format: options?.adFormat,
|
|
618
|
+
ad_unit_name: options?.adUnitName,
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
// ============================================
|
|
623
|
+
// 🎮 게임 특화 이벤트
|
|
624
|
+
// ============================================
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* 게임 플레이 이벤트 (Unity: GamePlayEvent)
|
|
628
|
+
*
|
|
629
|
+
* @example
|
|
630
|
+
* ```typescript
|
|
631
|
+
* await AdStage.event.trackGamePlay({
|
|
632
|
+
* level: 10,
|
|
633
|
+
* levelName: "Dragon's Lair",
|
|
634
|
+
* character: 'mage',
|
|
635
|
+
* contentType: 'dungeon'
|
|
636
|
+
* });
|
|
637
|
+
* ```
|
|
638
|
+
*/
|
|
639
|
+
static async trackGamePlay(options?: {
|
|
640
|
+
level?: number;
|
|
641
|
+
levelName?: string;
|
|
642
|
+
character?: string;
|
|
643
|
+
contentType?: string;
|
|
644
|
+
}): Promise<TrackEventResult> {
|
|
645
|
+
return this.track('game_play', {
|
|
646
|
+
level: options?.level,
|
|
647
|
+
level_name: options?.levelName,
|
|
648
|
+
character: options?.character,
|
|
649
|
+
content_type: options?.contentType,
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
/**
|
|
654
|
+
* 보너스 획득 이벤트 (Unity: AcquireBonusEvent)
|
|
655
|
+
*
|
|
656
|
+
* @example
|
|
657
|
+
* ```typescript
|
|
658
|
+
* await AdStage.event.trackAcquireBonus({
|
|
659
|
+
* contentType: 'reward',
|
|
660
|
+
* itemId: 'ITEM_123',
|
|
661
|
+
* itemName: 'Gold Chest',
|
|
662
|
+
* quantity: 1
|
|
663
|
+
* });
|
|
664
|
+
* ```
|
|
665
|
+
*/
|
|
666
|
+
static async trackAcquireBonus(options?: {
|
|
667
|
+
contentType?: string;
|
|
668
|
+
itemId?: string;
|
|
669
|
+
itemName?: string;
|
|
670
|
+
quantity?: number;
|
|
671
|
+
}): Promise<TrackEventResult> {
|
|
672
|
+
return this.track('acquire_bonus', {
|
|
673
|
+
content_type: options?.contentType,
|
|
674
|
+
item_id: options?.itemId,
|
|
675
|
+
item_name: options?.itemName,
|
|
676
|
+
quantity: options?.quantity,
|
|
677
|
+
});
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
/**
|
|
681
|
+
* 게임 서버 선택 이벤트 (Unity: SelectGameServerEvent)
|
|
682
|
+
*
|
|
683
|
+
* @example
|
|
684
|
+
* ```typescript
|
|
685
|
+
* await AdStage.event.trackSelectGameServer({
|
|
686
|
+
* contentId: 'SERVER_01',
|
|
687
|
+
* contentType: 'pvp',
|
|
688
|
+
* itemName: 'Asia Server'
|
|
689
|
+
* });
|
|
690
|
+
* ```
|
|
691
|
+
*/
|
|
692
|
+
static async trackSelectGameServer(
|
|
693
|
+
serverInfo: GameServerInfo
|
|
694
|
+
): Promise<TrackEventResult> {
|
|
695
|
+
return this.track('select_game_server', {
|
|
696
|
+
content_id: serverInfo.contentId,
|
|
697
|
+
content_type: serverInfo.contentType,
|
|
698
|
+
item_name: serverInfo.itemName,
|
|
699
|
+
});
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* 패치 완료 이벤트 (Unity: CompletePatchEvent)
|
|
704
|
+
*
|
|
705
|
+
* @example
|
|
706
|
+
* ```typescript
|
|
707
|
+
* await AdStage.event.trackCompletePatch({
|
|
708
|
+
* contentId: 'PATCH_2.1.0',
|
|
709
|
+
* contentType: 'update'
|
|
710
|
+
* });
|
|
711
|
+
* ```
|
|
712
|
+
*/
|
|
713
|
+
static async trackCompletePatch(patchInfo: PatchInfo): Promise<TrackEventResult> {
|
|
714
|
+
return this.track('complete_patch', {
|
|
715
|
+
content_id: patchInfo.contentId,
|
|
716
|
+
content_type: patchInfo.contentType,
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
// ============================================
|
|
721
|
+
// 💬 상호작용 이벤트
|
|
722
|
+
// ============================================
|
|
723
|
+
|
|
724
|
+
/**
|
|
725
|
+
* 검색 이벤트 (Unity: SearchEvent)
|
|
726
|
+
*/
|
|
727
|
+
static async trackSearch(searchTerm?: string): Promise<TrackEventResult> {
|
|
728
|
+
const params: TrackEventParams = {};
|
|
729
|
+
if (searchTerm) params.search_term = searchTerm;
|
|
730
|
+
return this.track('search', params);
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
/**
|
|
734
|
+
* 콘텐츠 선택 이벤트 (Unity: SelectContentEvent)
|
|
735
|
+
*/
|
|
736
|
+
static async trackSelectContent(options?: {
|
|
737
|
+
contentType?: string;
|
|
738
|
+
contentId?: string;
|
|
739
|
+
}): Promise<TrackEventResult> {
|
|
740
|
+
return this.track('select_content', {
|
|
741
|
+
content_type: options?.contentType,
|
|
742
|
+
content_id: options?.contentId,
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
/**
|
|
747
|
+
* 좋아요 이벤트 (Unity: LikeEvent)
|
|
748
|
+
*/
|
|
749
|
+
static async trackLike(options?: {
|
|
750
|
+
contentType?: string;
|
|
751
|
+
contentId?: string;
|
|
752
|
+
}): Promise<TrackEventResult> {
|
|
753
|
+
return this.track('like', {
|
|
754
|
+
content_type: options?.contentType,
|
|
755
|
+
content_id: options?.contentId,
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
/**
|
|
760
|
+
* 일정 등록 이벤트 (Unity: ScheduleEvent)
|
|
761
|
+
*/
|
|
762
|
+
static async trackSchedule(
|
|
763
|
+
params: TrackEventParams = {}
|
|
764
|
+
): Promise<TrackEventResult> {
|
|
765
|
+
return this.track('schedule', params);
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
/**
|
|
769
|
+
* 크레딧 사용 이벤트 (Unity: SpendCreditsEvent)
|
|
770
|
+
*/
|
|
771
|
+
static async trackSpendCredits(options?: {
|
|
772
|
+
value?: number;
|
|
773
|
+
contentType?: string;
|
|
774
|
+
contentId?: string;
|
|
775
|
+
}): Promise<TrackEventResult> {
|
|
776
|
+
return this.track('spend_credits', {
|
|
777
|
+
value: options?.value,
|
|
778
|
+
content_type: options?.contentType,
|
|
779
|
+
content_id: options?.contentId,
|
|
780
|
+
});
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
// ============================================
|
|
784
|
+
// 💼 금융 특화 이벤트
|
|
785
|
+
// ============================================
|
|
786
|
+
|
|
787
|
+
/**
|
|
788
|
+
* 주식 매도 이벤트 (Unity: SellStockEvent)
|
|
789
|
+
*/
|
|
790
|
+
static async trackSellStock(
|
|
791
|
+
transaction: StockTransactionInfo
|
|
792
|
+
): Promise<TrackEventResult> {
|
|
793
|
+
return this.track('sell_stock', {
|
|
794
|
+
item_id: transaction.itemId,
|
|
795
|
+
item_name: transaction.itemName,
|
|
796
|
+
quantity: transaction.quantity,
|
|
797
|
+
price: transaction.price,
|
|
798
|
+
value: transaction.value,
|
|
799
|
+
currency: transaction.currency,
|
|
800
|
+
});
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
/**
|
|
804
|
+
* 주식 매수 이벤트 (Unity: BuyStockEvent)
|
|
805
|
+
*/
|
|
806
|
+
static async trackBuyStock(
|
|
807
|
+
transaction: StockTransactionInfo
|
|
808
|
+
): Promise<TrackEventResult> {
|
|
809
|
+
return this.track('buy_stock', {
|
|
810
|
+
item_id: transaction.itemId,
|
|
811
|
+
item_name: transaction.itemName,
|
|
812
|
+
quantity: transaction.quantity,
|
|
813
|
+
price: transaction.price,
|
|
814
|
+
value: transaction.value,
|
|
815
|
+
currency: transaction.currency,
|
|
816
|
+
});
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
/**
|
|
820
|
+
* 계좌 개설 완료 이벤트 (Unity: CompleteOpenAccountEvent)
|
|
821
|
+
*/
|
|
822
|
+
static async trackCompleteOpenAccount(
|
|
823
|
+
accountInfo: AccountOpenInfo
|
|
824
|
+
): Promise<TrackEventResult> {
|
|
825
|
+
return this.track('complete_open_account', {
|
|
826
|
+
content_type: accountInfo.contentType,
|
|
827
|
+
content_id: accountInfo.contentId,
|
|
828
|
+
method: accountInfo.method,
|
|
829
|
+
});
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
/**
|
|
833
|
+
* 카드 신청 이벤트 (Unity: ApplyCardEvent)
|
|
834
|
+
*/
|
|
835
|
+
static async trackApplyCard(
|
|
836
|
+
cardInfo: CardApplicationInfo
|
|
837
|
+
): Promise<TrackEventResult> {
|
|
838
|
+
return this.track('apply_card', {
|
|
839
|
+
content_type: cardInfo.contentType,
|
|
840
|
+
item_name: cardInfo.itemName,
|
|
841
|
+
item_id: cardInfo.itemId,
|
|
842
|
+
});
|
|
843
|
+
}
|
|
844
|
+
}
|