StageUp
웹 SDK이벤트

기본 이벤트 추적

사용자의 행동과 상호작용을 추적하여 웹사이트의 성과를 분석하고 개선할 수 있습니다.

🚀 기본 이벤트 추적

// SDK 초기화
AdStage.init({
  apiKey: 'your-api-key'
});
 
// 기본 이벤트 추적
AdStage.events.track('button_click');
 
// 속성과 함께 이벤트 추적
AdStage.events.track('button_click', {
  button_id: 'hero_cta',
  button_text: '지금 시작하기',
  page: '/landing'
});
 
// 페이지 뷰 추적 (SPA에서 수동)
AdStage.events.track('page_view', {
  page_title: '홈페이지',
  page_path: '/',
  referrer: document.referrer
});

📊 일반적인 이벤트 패턴

// 전자상거래 이벤트
AdStage.events.track('view_item', {
  item_id: 'SKU123',
  item_name: '무선 이어폰',
  price: 89000,
  currency: 'KRW'
});
 
AdStage.events.track('add_to_cart', {
  item_id: 'SKU123',
  quantity: 1,
  value: 89000
});
 
AdStage.events.track('purchase', {
  transaction_id: 'T12345',
  value: 178000,
  currency: 'KRW'
});
 
// 참여 이벤트
AdStage.events.track('sign_up', {
  method: 'email',
  source: 'homepage'
});
 
AdStage.events.track('search', {
  search_term: '무선 이어폰',
  results_count: 24
});

🎯 사용자 속성 설정

setUserProperties 지원 속성

속성타입지원 값설명
genderstring'male' | 'female' | 'other' | 'unknown'사용자 성별
countrystring자유 입력 (ISO 3166-1 alpha-2 권장)국가 코드 (예: 'KR', 'US')
citystring자유 입력도시명 (예: 'Seoul', 'New York')
agestring자유 입력나이 또는 연령대 (예: '25', '25-34')
languagestring자유 입력 (ISO 639-1 권장)언어 코드 (예: 'ko-KR', 'en-US')

setDeviceInfo 지원 속성

속성타입지원 값설명
categorystring'mobile' | 'desktop' | 'tablet' | 'other'디바이스 카테고리
platformstring자유 입력플랫폼 이름 (예: 'Windows', 'macOS', 'iOS')
modelstring자유 입력디바이스 모델 (예: 'iPhone 15', 'MacBook Pro')
appVersionstring자유 입력앱 버전 (예: '1.0.0', '2.1.3')
osVersionstring자유 입력운영체제 버전 (예: '14.0', 'macOS 14.1')
// 사용자 ID 설정
AdStage.events.setUserId('user_12345');
 
// 사용자 속성 설정
AdStage.events.setUserProperties({
  gender: 'male',        // 'male' | 'female' | 'other' | 'unknown'
  country: 'KR',         // 국가 코드
  city: 'Seoul',         // 도시명
  age: '25-34',          // 연령대
  language: 'ko-KR'      // 언어 코드
});
 
// 디바이스 정보 설정
AdStage.events.setDeviceInfo({
  category: 'desktop',   // 'mobile' | 'desktop' | 'tablet' | 'other'
  platform: 'Windows',  // 플랫폼 이름
  model: 'Surface Pro', // 디바이스 모델
  appVersion: '1.0.0',  // 앱 버전
  osVersion: 'Windows 11' // OS 버전
});

📝 폼 이벤트 추적

// 폼 요소 가져오기
const form = document.getElementById('contact-form');
 
form.addEventListener('submit', (e) => {
  e.preventDefault();
  
  // 폼 제출 이벤트
  AdStage.events.track('form_submit', {
    form_id: 'contact_form',
    form_type: 'contact',
    success: true
  });
  
  // 실제 폼 제출 로직
  submitForm(new FormData(form));
});
 
// 필드 포커스 추적
document.getElementById('email').addEventListener('focus', () => {
  AdStage.events.track('form_field_focus', {
    form_id: 'contact_form',
    field_name: 'email'
  });
});

다음 단계

더 고급 이벤트 추적 기능을 알아보세요:

목차