Skip to content

핵심 개념

시스템은 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' },
  }),
};

평가 순서:

  1. when 조건 확인
  2. personalTiers 필터
  3. 쿨다운 검증
  4. maxPerWindow 제한 확인
  5. 모두 통과하면 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 설정은 저장소 서비스를 참고하세요.

다음 단계

Released under the MIT License.