@adstage/web-sdk 3.0.12 → 3.0.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adstage/web-sdk",
3
- "version": "3.0.12",
3
+ "version": "3.0.14",
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",
@@ -109,8 +109,11 @@ export class AdStage {
109
109
  }
110
110
  }
111
111
 
112
- // 서버에 Attribution 자동 등록 (클릭 ID 있는 경우, 단 URL로 이미 전달된 경우는 생략)
113
- if (!aidFromUrl && trackingParams && TrackingParamsModule.hasClickId()) {
112
+ // 🎯 서버에 Attribution 자동 등록 (클릭 ID 또는 channel이 있는 경우, 단 URL로 이미 전달된 경우는 생략)
113
+ const hasClickId = TrackingParamsModule.hasClickId();
114
+ const hasChannel = !!(trackingParams && trackingParams.channel);
115
+
116
+ if (!aidFromUrl && trackingParams && (hasClickId || hasChannel)) {
114
117
  // Attribution 등록을 Promise로 처리
115
118
  const attributionPromise = (async () => {
116
119
  try {
@@ -51,7 +51,7 @@ export class TrackingParamsModule {
51
51
  // 추출할 파라미터 키 정의
52
52
  private static readonly CLICK_ID_KEYS = ['gclid', 'fbclid', 'ttclid', 'nclid', 'liclid', 'msclkid', 'twclid'];
53
53
 
54
- private static readonly CAMPAIGN_KEYS = ['campaign', 'campaign_id', 'ad_group', 'ad_group_id', 'ad_creative', 'creative_id', 'term'];
54
+ private static readonly CAMPAIGN_KEYS = ['channel', 'campaign', 'campaign_id', 'ad_group', 'ad_group_id', 'ad_creative', 'creative_id', 'term'];
55
55
 
56
56
  private static readonly UTM_KEYS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term'];
57
57
 
@@ -217,7 +217,7 @@ export class TrackingParamsModule {
217
217
 
218
218
  /**
219
219
  * Click 이벤트 자동 전송 여부 확인
220
- * 새로운 클릭 ID 발견되면 true 반환
220
+ * 새로운 클릭 ID 또는 channel 파라미터가 발견되면 true 반환
221
221
  */
222
222
  public static shouldSendClickEvent(): boolean {
223
223
  if (typeof window === 'undefined') {
@@ -225,24 +225,33 @@ export class TrackingParamsModule {
225
225
  }
226
226
 
227
227
  const params = TrackingParamsModule.get();
228
- if (!params || !TrackingParamsModule.hasClickId()) {
228
+ if (!params) {
229
229
  return false;
230
230
  }
231
231
 
232
- // 현재 클릭 ID 추출
233
- const currentClickId =
234
- params.gclid || params.fbclid || params.ttclid || params.nclid || params.liclid || params.msclkid || params.twclid;
232
+ // 클릭 ID 또는 channel 파라미터가 있어야 함
233
+ const hasClickId = TrackingParamsModule.hasClickId();
234
+ const hasChannel = !!params.channel;
235
235
 
236
- if (!currentClickId) {
236
+ if (!hasClickId && !hasChannel) {
237
237
  return false;
238
238
  }
239
239
 
240
- // 이미 처리된 클릭 ID인지 확인 (중복 방지)
240
+ // 현재 식별자 추출 (clickId 우선, 없으면 channel+term 조합)
241
+ const currentIdentifier = hasClickId
242
+ ? (params.gclid || params.fbclid || params.ttclid || params.nclid || params.liclid || params.msclkid || params.twclid)
243
+ : `${params.channel || ''}:${params.term || ''}`;
244
+
245
+ if (!currentIdentifier) {
246
+ return false;
247
+ }
248
+
249
+ // 이미 처리된 식별자인지 확인 (중복 방지)
241
250
  const lastClickId = sessionStorage.getItem('adstage_last_click_id');
242
251
 
243
- // 새로운 클릭 ID면 전송 필요
244
- if (currentClickId !== lastClickId) {
245
- sessionStorage.setItem('adstage_last_click_id', currentClickId);
252
+ // 새로운 식별자면 전송 필요
253
+ if (currentIdentifier !== lastClickId) {
254
+ sessionStorage.setItem('adstage_last_click_id', currentIdentifier);
246
255
  return true;
247
256
  }
248
257