feat: Meta 전환 추적(CAPI) 및 UTM 어트리뷰션 추가

- Meta Conversions API 클라이언트 추가 (app/utils/meta_capi.py)
- 전환 추적 라우터 추가 (/tracking/meta/first-video-created,
  /tracking/meta/complete-registration) 및 main.py 등록
- User 모델에 전환 1회 판정 컬럼(first_video_created_at,
  registration_tracked_at) 및 가입 시점 first-touch UTM 컬럼 5종 추가
- 카카오 콜백 리다이렉트 URL에 is_new_user 파라미터 추가
  (프론트가 신규 가입 시에만 CompleteRegistration 발화하도록)
- MetaConversionSettings 설정 추가 (FACEBOOK_PIXEL_ID,
  FACEBOOK_ACCESS_TOKEN, FACEBOOK_TEST_EVENT_CODE)
- DB 마이그레이션 SQL 2건 추가 (docs/database-schema/)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
skkimandClaude Fable 5 committed 2026-07-24 10:28:37 +09:00
1 parent 6090d500f9
commit 73b05f5cca
8 files changed
+549

No files matched your search

+45
View File
@@ -219,6 +219,51 @@ class User(Base):
comment="마지막 로그인 일시",
)
first_video_created_at: Mapped[Optional[datetime]] = mapped_column(
DateTime,
nullable=True,
comment="첫 영상 생성 완료 일시 (Meta FirstVideoCreated 전환 이벤트 1회 발화 판정용)",
)
registration_tracked_at: Mapped[Optional[datetime]] = mapped_column(
DateTime,
nullable=True,
comment="가입 전환 추적 일시 (Meta CompleteRegistration 전환 이벤트 1회 발화 판정용)",
)
# ==========================================================================
# 광고 유입 경로 (UTM, 가입 시점 first-touch)
# ==========================================================================
utm_source: Mapped[Optional[str]] = mapped_column(
String(255),
nullable=True,
comment="유입 매체 (예: meta, google, naver)",
)
utm_medium: Mapped[Optional[str]] = mapped_column(
String(255),
nullable=True,
comment="유입 방식 (예: paid_social, cpc)",
)
utm_campaign: Mapped[Optional[str]] = mapped_column(
String(255),
nullable=True,
comment="캠페인 이름",
)
utm_content: Mapped[Optional[str]] = mapped_column(
String(255),
nullable=True,
comment="광고 소재 구분 (A/B 테스트용)",
)
utm_term: Mapped[Optional[str]] = mapped_column(
String(255),
nullable=True,
comment="검색 키워드",
)
credits: Mapped[int] = mapped_column(
Integer,
nullable=False,