StageUp
Web SDKEvents

Basic Event Tracking

By tracking user behavior and interactions, you can analyze and improve your website's performance.

๐Ÿš€ Basic Event Tracking

// 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
});

๐Ÿ“Š Common Event Patterns

// ์ „์ž์ƒ๊ฑฐ๋ž˜ ์ด๋ฒคํŠธ
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
});

๐ŸŽฏ Setting User Properties

setUserProperties Supported Properties

PropertyTypeSupported ValuesDescription
genderstring'male' | 'female' | 'other' | 'unknown'User gender
countrystringFree input (ISO 3166-1 alpha-2 recommended)Country code (e.g., 'KR', 'US')
citystringFree inputCity name (e.g., 'Seoul', 'New York')
agestringFree inputAge or age range (e.g., '25', '25-34')
languagestringFree input (ISO 639-1 recommended)Language code (e.g., 'ko-KR', 'en-US')

setDeviceInfo Supported Properties

PropertyTypeSupported ValuesDescription
categorystring'mobile' | 'desktop' | 'tablet' | 'other'Device category
platformstringFree inputPlatform name (e.g., 'Windows', 'macOS', 'iOS')
modelstringFree inputDevice model (e.g., 'iPhone 15', 'MacBook Pro')
appVersionstringFree inputApp version (e.g., '1.0.0', '2.1.3')
osVersionstringFree inputOperating system version (e.g., '14.0', 'macOS 14.1')
// ์‚ฌ์šฉ์ž ์†์„ฑ ์„ค์ •
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 ๋ฒ„์ „
});

๐Ÿ“ Form Event Tracking

// ํผ ์š”์†Œ ๊ฐ€์ ธ์˜ค๊ธฐ
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'
  });
});

Next Steps

Learn about more advanced event tracking features:

Table of Contents