Files
o2o-weather/frontend/src/lib/analytics.ts
T
minaChoi dba3d78f14 feat: 오늘 피드 — 사람 글을 묶음 대신 포스트처럼 두 장마다 한 장씩(큰 카드·댓글), 행사는 띠 대신 축제 전부와 팝업·전시·공연 2개씩 포스트로
- 사람 글 큰 카드: 머리줄·4:5 본문(사진, 없으면 글을 크게)·좋아요·댓글·보내기
- 사람 글 댓글: 로그인한 사람만, comment 표에 talk_id, talk.comment_count (init.sql)
- '오늘 내 글'·'동네 사람들'·주제별 묶음, '이번 주 가까운 행사' 띠 제거
- 행사 포스트 자리 최대 40개, 앞쪽 절반에 다 못 들어가면 끝까지 한 장씩 걸러
- GA: feed_item_view(talk·event 노출), talk_comment
2026-10-29 15:25:11 +09:00

59 lines
2.6 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' }
/** index.html 첫 화면 스크립트가 gtag 로 바로 보낸다 */
boot_stuck: { reason: string; seconds: number; tries: number; app_started: boolean }
sheet_open: { sheet: SheetType }
like: { content_type: 'post' | 'comment' | 'talk' | PinnedKey; item_id: number }
comment: { post_id: number }
talk_comment: { talk_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 }
feed_item_view: { item_type: 'talk' | 'event'; position: number }
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 }
saju_input: { with_time: boolean }
saju_view: { scene: string; score: number; strength: string; top_element: string }
game_start: { again: boolean; logged_in: boolean; wind_ms: number }
game_round: { round: number; score: number; logged_in: boolean }
game_over: { round: number; score: number; best: boolean; drops: number }
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)
}