StageUp
Web SDKEvents

Managing User Properties

By tracking user characteristics and behavior patterns, you can implement personalized services and targeted marketing.

๐Ÿ” User Identification

Identifying Users by Properties

The AdStage Web SDK does not provide a separate user ID setting API. Instead, it records user characteristics through user properties (setUserProperties) for use in segment and funnel analysis:

// ๋กœ๊ทธ์ธ ์‹œ ์‚ฌ์šฉ์ž ์†์„ฑ ์„ค์ •
AdStage.events.setUserProperties({
  gender: 'male',      // 'male' | 'female' | 'other' | 'unknown'
  country: 'KR',       // ISO ๊ตญ๊ฐ€ ์ฝ”๋“œ
  city: 'Seoul',       // ๋„์‹œ๋ช…
  age: '25-34',        // ์—ฐ๋ น๋Œ€
  language: 'ko-KR'    // ์–ธ์–ด ์ฝ”๋“œ
});
 
// ํ˜„์žฌ ์„ค์ •๋œ ์‚ฌ์šฉ์ž ์†์„ฑ ํ™•์ธ
const userProperties = AdStage.events.getUserProperties();
console.log('ํ˜„์žฌ ์‚ฌ์šฉ์ž ์†์„ฑ:', userProperties);

Anonymous User Tracking

Users who are not logged in are also automatically tracked on a session basis:

// ์ต๋ช… ์‚ฌ์šฉ์ž ์ถ”์ ์€ SDK์—์„œ ์ž๋™์œผ๋กœ ๊ด€๋ฆฌ๋ฉ๋‹ˆ๋‹ค
// ๋ณ„๋„ ์„ค์ •์ด๋‚˜ ์กฐํšŒ API๋Š” ์ œ๊ณต๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค
// ์„ธ์…˜ ๊ธฐ๋ฐ˜์œผ๋กœ ์ž๋™์œผ๋กœ ์ถ”์ ๋ฉ๋‹ˆ๋‹ค

๐Ÿ‘ค Setting User Properties

Supported Standard Properties

These are the standard user properties supported by the SDK:

// ์—ฌ๋Ÿฌ ์†์„ฑ ํ•œ๋ฒˆ์— ์„ค์ • (๊ถŒ์žฅ ๋ฐฉ๋ฒ•)
AdStage.events.setUserProperties({
  age: '25',           // ์—ฐ๋ น (๋ฌธ์ž์—ด)
  gender: 'female',    // 'male' | 'female' | 'other' | 'unknown'
  country: 'KR',       // ISO ๊ตญ๊ฐ€ ์ฝ”๋“œ (ISO 3166-1 alpha-2)
  city: 'Seoul',       // ๋„์‹œ๋ช…
  language: 'ko-KR'    // ์–ธ์–ด ์ฝ”๋“œ (BCP 47)
});
 
// ๊ฐœ๋ณ„ ์†์„ฑ ์„ค์ • API๋Š” ํ˜„์žฌ ์ œ๊ณต๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค
// ๋ชจ๋“  ์†์„ฑ์€ setUserProperties()๋ฅผ ํ†ตํ•ด ์„ค์ •ํ•˜์„ธ์š”

Automatically Collected Properties

Information the SDK automatically collects from the browser:

// ๋ธŒ๋ผ์šฐ์ € ์–ธ์–ด ์„ค์ •์—์„œ ์ž๋™ ์ถ”์ถœ
// navigator.language โ†’ language, country ์ž๋™ ์„ค์ •
// ์˜ˆ: 'ko-KR' โ†’ language: 'ko-KR', country: 'KR'
 
// ์ž๋™ ์ˆ˜์ง‘๋œ ์‚ฌ์šฉ์ž ์ •๋ณด ํ™•์ธ
const userInfo = AdStage.events.getUserInfo();
console.log(userInfo);
// { language: 'ko-KR', country: 'KR' }
 
// ํƒ€์ž„์กด ๊ธฐ๋ฐ˜ ์ง€์—ญ ์ถ”์ •์€ ๋‚ด๋ถ€์ ์œผ๋กœ ์ˆ˜ํ–‰๋˜๋ฉฐ
// ๋ณ„๋„ API๋กœ ๋…ธ์ถœ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค

Property Limitations

Currently, the AdStage Web SDK supports standard properties only:

// โœ… ์ง€์›๋˜๋Š” ํ‘œ์ค€ ์†์„ฑ
AdStage.events.setUserProperties({
  gender: 'female',      // 'male' | 'female' | 'other' | 'unknown'
  country: 'KR',         // ISO ๊ตญ๊ฐ€ ์ฝ”๋“œ
  city: 'Seoul',         // ๋„์‹œ๋ช…
  age: '25',             // ์—ฐ๋ น (๋ฌธ์ž์—ด)
  language: 'ko-KR'      // ์–ธ์–ด ์ฝ”๋“œ
});
 
// โŒ ์ปค์Šคํ…€ ์†์„ฑ์€ ์ง€์›ํ•˜์ง€ ์•Š์Œ
// ๋Œ€์‹  ์ด๋ฒคํŠธ ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ์‚ฌ์šฉํ•˜์„ธ์š”
AdStage.events.track('user_profile_updated', {
  subscription_tier: 'premium',    // ์ด๋ฒคํŠธ ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ์ „์†ก
  account_type: 'business',
  last_login: '2024-01-15'
});

๐Ÿ“Š Managing User Properties

Querying and Managing Properties

// ํ˜„์žฌ ์„ค์ •๋œ ์‚ฌ์šฉ์ž ์†์„ฑ ์กฐํšŒ
const currentProperties = AdStage.events.getUserProperties();
console.log('ํ˜„์žฌ ์‚ฌ์šฉ์ž ์†์„ฑ:', currentProperties);
 
// ๊ฐœ๋ณ„ ์†์„ฑ ์กฐํšŒ ๋ฐ ์†์„ฑ ์ดˆ๊ธฐํ™” API๋Š” ํ˜„์žฌ ์ œ๊ณต๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค
// ๋ชจ๋“  ์†์„ฑ์€ getUserProperties()๋ฅผ ํ†ตํ•ด ์ผ๊ด„ ์กฐํšŒํ•˜์„ธ์š”
 
// ์†์„ฑ์„ ์ดˆ๊ธฐํ™”ํ•˜๋ ค๋ฉด ๋นˆ ๊ฐ์ฒด๋กœ ์„ค์ •
AdStage.events.setUserProperties({});

Leveraging Location Information

// ๋ธŒ๋ผ์šฐ์ € ๊ธฐ๋ฐ˜ ์ž๋™ ์ˆ˜์ง‘ ์ •๋ณด ํ™•์ธ
const userInfo = AdStage.events.getUserInfo();
console.log('์ž๋™ ์ˆ˜์ง‘๋œ ์‚ฌ์šฉ์ž ์ •๋ณด:', userInfo);
// { language: 'ko-KR', country: 'KR' }
 
// ์ง€์—ญ ์ •๋ณด๋Š” ๋‚ด๋ถ€์ ์œผ๋กœ ์ž๋™ ์ถ”์ •๋˜์–ด ์„ค์ •๋ฉ๋‹ˆ๋‹ค
// ์ˆ˜๋™์œผ๋กœ ๋” ์ •ํ™•ํ•œ ์ •๋ณด๊ฐ€ ์žˆ๋‹ค๋ฉด ๋ฎ์–ด์“ธ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค
AdStage.events.setUserProperties({
  country: 'KR',
  city: 'Seoul',
  language: 'ko-KR'
});

๐ŸŽฏ Leveraging Personalization

Personalization Based on User Properties

// ์‚ฌ์šฉ์ž ์†์„ฑ ๊ธฐ๋ฐ˜ ์ฝ˜ํ…์ธ  ์ถ”์ฒœ
function personalizeContent() {
  const userProperties = AdStage.events.getUserProperties();
  
  // ์—ฐ๋ น๋Œ€๋ณ„ ์ฝ˜ํ…์ธ 
  if (userProperties.age && parseInt(userProperties.age) < 30) {
    showYoungAdultContent();
  }
  
  // ์ง€์—ญ๋ณ„ ์ฝ˜ํ…์ธ 
  if (userProperties.country === 'KR') {
    showKoreanContent();
  }
  
  // ์–ธ์–ด๋ณ„ ์ฝ˜ํ…์ธ 
  if (userProperties.language?.startsWith('ko')) {
    setKoreanLanguage();
  }
}
 
// ์†์„ฑ ๋ณ€๊ฒฝ ์‹œ ๊ฐœ์ธํ™” ์—…๋ฐ์ดํŠธ
AdStage.events.setUserProperties({
  country: 'KR',
  language: 'ko-KR',
  age: '28'
});
personalizeContent();

Using Properties with Events

// ์‚ฌ์šฉ์ž ์†์„ฑ์€ ๋ชจ๋“  ์ด๋ฒคํŠธ์— ์ž๋™์œผ๋กœ ํฌํ•จ๋ฉ๋‹ˆ๋‹ค
AdStage.events.track('page_view', {
  page: 'product_detail',
  product_id: 'prod_123'
});
// ์„œ๋ฒ„์—์„œ ๋ฐ›๋Š” ๋ฐ์ดํ„ฐ์—๋Š” ์„ค์ •๋œ ์‚ฌ์šฉ์ž ์†์„ฑ์ด ํฌํ•จ๋ฉ๋‹ˆ๋‹ค:
// {
//   eventName: 'page_view',
//   user: {
//     gender: 'female',
//     country: 'KR',
//     city: 'Seoul',
//     age: '28',
//     language: 'ko-KR'
//   },
//   params: { page: 'product_detail', product_id: 'prod_123' }
// }

Table of Contents