import type { PinnedKey } from '../b/pinnedLike' import type { SheetState } from '../b/sheetContext' /** GA4로 보내는 이벤트와 값. 목록은 docs/이벤트_추적.md */ type Events = { view_gak: { index_id: number; gak_name: string; score: number; rank: number } select_content: { content_type: 'article'; item_id: number; category: string } share: { content_type: 'image'; item_id: string; method: 'share_sheet' | 'download'; ratio: string } login: { method: 'id' | 'google' | 'toss' } sign_up: { method: 'id' } region_change: { region_name: string; method: 'list' | 'location' } install_banner_view: Record install_click: { from: 'banner' | 'menu'; method: 'prompt' | 'guide' } install_choice: { outcome: 'accepted' | 'dismissed' } install_done: Record app_launch: { mode: 'standalone' } sheet_open: { sheet: SheetType } like: { content_type: 'post' | 'comment' | 'talk' | PinnedKey; item_id: number } comment: { post_id: number } report: { content_type: 'comment' | 'talk'; reason: number } block: { content_type: 'comment' | 'talk' } terms_agree: Record talk_post: { topic: number; with_image: boolean } hero_day_switch: { day: 'today' | 'tomorrow' } shorts_open: { video_id: string } shorts_view: { video_id: string; index: number } shorts_sound: { on: boolean } foliage_open: Record foliage_spot: { spot_name: string; from: 'page' | 'card' } my_gak_save: { gak_name: string } fortune_draw: { card: string } day_log: { mood: number; went_out: boolean; card_hit: boolean | null } today_icon: { icon: string } toss_intro_start: Record install_banner_close: Record } type SheetType = Exclude['type'] declare global { interface Window { gtag?: (command: 'event', name: string, params: Record) => void } } export function track(event: E, params: Events[E]) { if (import.meta.env.DEV) return window.gtag?.('event', event, params) }