핵심 개념
시스템은 4개의 연결된 컴포넌트로 동작합니다:
Event → Funnel → Rule → Action이벤트
이벤트 시스템을 통해 추적되는 사용자 행동입니다.
typescript
tracker.track('make_chat', { duration: 120 });
tracker.track('click_icon_to_main_view');이벤트 구조:
name: 이벤트 식별자userId: 사용자 식별자sessionId: 세션 식별자ts: 타임스탬프properties: 선택적 메타데이터
퍼널
스코프 기반 경계가 있는 순차 단계 추적입니다.
typescript
const funnel = {
funnelId: 'paywall--exiting-thread',
scopes: ['session'],
steps: [(e) => e.name === 'make_chat', (e) => e.name === 'click_icon_to_main_view'],
};스코프 타입:
'session': 현재 세션 내 추적'rollingWindow': 시간 윈도우 내 추적 (예: 7일)
모든 단계를 순서대로 완료하면 funnel_completed 트리거가 발생합니다.
규칙
노출 제한 및 타겟팅이 포함된 조건부 로직입니다.
typescript
const rule = {
nudgeId: 'paywall',
when: (t) => t.type === 'funnel_completed' && t.funnelId === 'paywall--exiting-thread',
cooldownDuration: '3d',
maxPerWindow: 3,
windowDuration: '3d',
personalTiers: ['free'],
buildAction: () => ({
type: 'paywall',
data: { entryType: 'exiting_thread' },
}),
};평가 순서:
when조건 확인personalTiers필터- 쿨다운 검증
maxPerWindow제한 확인- 모두 통과하면
buildAction()실행
액션
트리거된 규칙에 대한 핸들러 실행입니다.
typescript
const runner = {
run: async (action) => {
if (action.type === 'paywall') {
showPaywall(action.data);
}
},
};노출 제한
과다 노출을 방지하는 3가지 자동 제어:
| 제어 | 목적 | 예시 |
|---|---|---|
| Cooldown | 최소 대기 시간 | cooldownDuration: '3d' |
| Max Per Window | 기간 내 최대 횟수 | maxPerWindow: 3 |
| Window Duration | 기간 경계 | windowDuration: '3d' |
저장소
쿨다운 및 노출 추적을 위한 영속성:
typescript
const cooldownStorage = new NudgeCooldownStorage({ storage: localStorage });
const exposureStorage = new NudgeExposureLogStorage({ storage: localStorage });React Native 설정은 저장소 서비스를 참고하세요.
다음 단계
- 예제 - React 및 React Native 구현
- 커스텀 액션 - 타입 안전한 정의
- Coordinator API - 전체 API 레퍼런스