- 오늘 한 장 칸을 오늘 타로 창으로 옮김. 안 뽑았으면 빨간 점, 뽑았으면 n일째 (로그인 안 하면 기기 기록으로 계산) - 오늘 코디: 오늘 피드에 올린 코디 카드를 창으로 (GET /v1/card/latest?template=ootd), 오늘 처음 보면 빨간 점 - 단풍 지도 아이콘은 단풍철에만, 아이콘 4개 추가 (Fluent 3D) - GA4 today_icon
50 lines
2.0 KiB
TypeScript
50 lines
2.0 KiB
TypeScript
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<string, never>
|
|
install_click: { from: 'banner' | 'menu'; method: 'prompt' | 'guide' }
|
|
install_choice: { outcome: 'accepted' | 'dismissed' }
|
|
install_done: Record<string, never>
|
|
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<string, never>
|
|
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<string, never>
|
|
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<string, never>
|
|
install_banner_close: Record<string, never>
|
|
}
|
|
|
|
type SheetType = Exclude<SheetState, null>['type']
|
|
|
|
declare global {
|
|
interface Window {
|
|
gtag?: (command: 'event', name: string, params: Record<string, unknown>) => void
|
|
}
|
|
}
|
|
|
|
export function track<E extends keyof Events>(event: E, params: Events[E]) {
|
|
if (import.meta.env.DEV) return
|
|
window.gtag?.('event', event, params)
|
|
}
|