Merge branch 'feat/seo-ctr-copy' — 지역 페이지 절반에 검색 결과 새 문구, 클릭률 비교

# Conflicts:
#	docs/이벤트_추적.md
#	frontend/src/lib/analytics.ts
This commit is contained in:
minaChoi committed 2026-10-30 15:01:31 +09:00
commit afa83d8b79
7 files changed
+463 -14

No files matched your search

+12
View File
@@ -2,6 +2,7 @@ import { createContext, use } from 'react'
import { useLocation } from 'react-router'
import type { RegionData } from '@nalssigak/shared/api/client/types.gen'
import regionPages from '../../seo/region.json'
import { track } from '../lib/analytics'
export type LocateStatus = 'idle' | 'locating' | 'denied' | 'error'
@@ -21,6 +22,17 @@ export function pageOf(pathname: string) {
/** 지역 페이지로 들어오면 서버가 채운 소개 글(#root 안)을 앱이 덮기 전에 잡아 둔다. 구글은 JS 실행 뒤 화면으로 색인한다 */
const landingAbout = pageOf(location.pathname) ? { path: location.pathname, html: document.querySelector('#root > main')?.innerHTML ?? '' } : null
// 구글·네이버 검색으로 지역 페이지에 들어옴: 검색 결과 문구(새·예전, 서버가 못 채웠으면 none)별 유입을 견준다
const searchEngine = document.referrer ? new URL(document.referrer).hostname.match(/(?:^|\.)(google|naver)\./)?.[1] : undefined
if (landingAbout && (searchEngine === 'google' || searchEngine === 'naver')) {
const copy = document.querySelector<HTMLMetaElement>('meta[name="seo-copy"]')?.content
track('search_landing', {
page: location.pathname.startsWith('/tomorrow/') ? 'tomorrow' : 'today',
engine: searchEngine,
copy: copy === 'new' || copy === 'old' ? copy : 'none',
})
}
/** 들어온 지역 페이지에 그대로 있을 때만 그 소개 글 */
export function useLandingAbout(): string | null {
const { pathname } = useLocation()
+2
View File
@@ -28,6 +28,7 @@ type Events = {
feed_item_view: { item_type: 'talk' | 'event'; position: number }
hero_day_switch: { day: 'today' | 'tomorrow' }
tomorrow_to_today: { region_name: string }
search_landing: { page: 'today' | 'tomorrow'; engine: 'google' | 'naver'; copy: 'new' | 'old' | 'none' }
shorts_open: { video_id: string }
shorts_view: { video_id: string; index: number }
shorts_sound: { on: boolean }
@@ -79,6 +80,7 @@ const GA_NAME: Record<keyof Events, string> = {
feed_item_view: '피드_항목_노출',
hero_day_switch: '오늘내일_전환',
tomorrow_to_today: '내일에서_오늘로',
search_landing: '검색_유입',
shorts_open: '쇼츠_열기',
shorts_view: '쇼츠_보기',
shorts_sound: '쇼츠_소리',