diff --git a/docs/이벤트_추적.md b/docs/이벤트_추적.md index 910ef17..2dc124c 100644 --- a/docs/이벤트_추적.md +++ b/docs/이벤트_추적.md @@ -37,7 +37,7 @@ GA4 태그(`gtag.js`, 측정 ID `G-D378J4X373`)를 `index.html`에 심고, 화 | `설치_완료` (코드 `install_done`) | 설치 완료 (브라우저가 `appinstalled`를 줄 때만. 아이폰은 오지 않음) | 없음 | `install.ts` | | `앱_실행` (코드 `app_launch`) | 홈 화면 아이콘(설치한 앱)으로 엶 | `mode: 'standalone'` | `main.tsx` | | `첫화면_멈춤` (코드 `boot_stuck`) | 8초 넘게 '날씨 불러오는 중' 첫 화면이 남음 (페이지마다 한 번) | `reason`(첫 오류 문구, 100자), `seconds`, `tries`(연달아 다시 불러온 횟수), `app_started`(앱 파일 실행 여부) | `index.html` 첫 화면 스크립트 | -| `창_열기` (코드 `sheet_open`) | 아래에서 올라오는 창이 열림 (각·글·보내기·댓글·로그인·내 정보·지역·내 각·홈 화면 추가·점수 근거·이야기 등) | `sheet`(창 종류: `gak`·`article`·`share`·`comments`·`login`·`me`·`region`·`mix`·`myGak`·`install`·`weatherWhy`·`talk`·`seasonWeek`) | `Sheets.tsx` `SheetProvider` `open` | +| `창_열기` (코드 `sheet_open`) | 아래에서 올라오는 창이 열림 (각·글·보내기·댓글·로그인·내 정보·지역·내 각·홈 화면 추가·점수 근거·이야기 등) | `sheet`(창 종류: `gak`·`article`·`share`·`comments`·`login`·`me`·`region`·`mix`·`myGak`·`install`·`weatherWhy`·`talk`·`seasonWeek`·`contact`) | `Sheets.tsx` `SheetProvider` `open` | | `좋아요` (코드 `like`) | 좋아요 성공 (취소는 안 보냄) | `content_type: 'post' \| 'comment' \| 'talk' \| 'hero_post' \| 'gak_post' \| 'foliage_post' \| 'events_post' \| 'season_post'`, `item_id`(포스트·댓글·글 번호) | `Post.tsx` `FullCard`, `pinnedLike.ts`, `Sheets.tsx` `CommentRow`, `talk.tsx` | | `댓글` (코드 `comment`) | 댓글 올리기 성공 | `post_id` | `Sheets.tsx` `CommentsSheet` `send` | | `이야기_댓글` (코드 `talk_comment`) | 사람 글에 댓글 올리기 성공 (로그인한 사람만) | `talk_id`(글 번호) | `Sheets.tsx` `CommentsSheet` `send` | @@ -57,6 +57,8 @@ GA4 태그(`gtag.js`, 측정 ID `G-D378J4X373`)를 `index.html`에 심고, 화 | `내각_저장` (코드 `my_gak_save`) | 내 각 만들기 성공 (로그인 전엔 기기에 저장) | `gak_name` | `myGakState.ts` `create` | | `토스소개_시작` (코드 `toss_intro_start`) | 토스판 첫 소개 화면에서 '시작하기' | 없음 | `tossIntro.tsx` | | `설치배너_닫기` (코드 `install_banner_close`) | '홈 화면에 추가' 띠를 × 로 닫음 | 없음 | `installBanner.tsx` | +| `맨위로_누름` (코드 `top_button`) | 오른쪽 아래 둥근 버튼(내려갔을 때 '맨 위로')을 눌러 맨 위로 올라감 | `page`(누른 화면: `today`·`sky`·`gak`·`week`·`season`·`talk` 등) | `BLayout.tsx` `FloatButton` | +| `문의_누름` (코드 `contact_click`) | 문의 창에서 전화·이메일을 누름 (창 열림은 `창_열기`의 `sheet: 'contact'`) | `method: 'phone' \| 'email'` | `Sheets.tsx` `ContactSheet` | | `타로_뽑기` (코드 `fortune_draw`) | 오늘 한 장에서 카드를 뽑음 (하루 한 번, 다시 열 때는 안 보냄) | `card`(각 코드) | `fortune.tsx` `useTodayCard` | | `하루_기록` (코드 `day_log`) | 저녁 체크인을 적어 둠 (고쳐 적어도 보냄). 다녀온 곳 이름은 보내지 않음 | `mood`(1~5), `went_out`, `card_hit`(맞았어요 true·글쎄요 false·안 고름 null) | `fortune.tsx` `useTodayCard` | | `오늘아이콘_누름` (코드 `today_icon`) | 오늘 탭 아이콘 줄에서 아이콘을 누름 | `icon`(`tarot`·`saju`·`game`·`foliage`·`shorts`·`myGak`·`talk`) | `todayIcons.tsx` `TodayIcons` | diff --git a/frontend/public/b/aio2o.png b/frontend/public/b/aio2o.png new file mode 100644 index 0000000..67c9cfa Binary files /dev/null and b/frontend/public/b/aio2o.png differ diff --git a/frontend/public/icons/contact.png b/frontend/public/icons/contact.png new file mode 100644 index 0000000..f9a1da9 Binary files /dev/null and b/frontend/public/icons/contact.png differ diff --git a/frontend/public/icons/top.png b/frontend/public/icons/top.png new file mode 100644 index 0000000..c9ef1ce Binary files /dev/null and b/frontend/public/icons/top.png differ diff --git a/frontend/src/b/BLayout.tsx b/frontend/src/b/BLayout.tsx index fb70100..91838b4 100644 --- a/frontend/src/b/BLayout.tsx +++ b/frontend/src/b/BLayout.tsx @@ -2,6 +2,7 @@ import { useCallback, useEffect, useMemo, useState, type ReactNode } from 'react import { NavLink, Outlet, useLocation, useNavigationType } from 'react-router' import { useIsFetching, useQuery, useQueryClient } from '@tanstack/react-query' import { authConfigOptions, getSeasonWeekOptions } from '@nalssigak/shared/api/client/@tanstack/react-query.gen' +import { track } from '../lib/analytics' import { cx } from '../lib/utils' import { kindOfHour, kst, seasonOf, type TimeKind } from '@nalssigak/shared/lib' import './b.css' @@ -89,6 +90,37 @@ function TopBar() { ) } +// 이만큼 내려가면 문의 버튼이 맨 위로 버튼으로 바뀐다 +const TOP_AFTER = 400 + +/** 오른쪽 아래 둥근 버튼: 맨 위에서는 문의(문의 창 열기), 내려가면 맨 위로 */ +function FloatButton() { + const { pathname } = useLocation() + const { open } = useSheet() + const [down, setDown] = useState(() => window.scrollY > TOP_AFTER) + useEffect(() => { + const check = () => setDown(window.scrollY > TOP_AFTER) + window.addEventListener('scroll', check, { passive: true }) + return () => window.removeEventListener('scroll', check) + }, []) + // 쇼츠는 화면 전체가 영상이라 가리지 않게 뺀다 + if (pathname.startsWith('/shorts')) return null + const toTop = () => { + track('top_button', { page: TABS.find((t) => t.to !== '/' && pathname.startsWith(t.to))?.key ?? pathname.split('/')[1] ?? 'today' }) + window.scrollTo({ top: 0, behavior: 'smooth' }) + } + return ( + + ) +} + const STARS = Array.from({ length: 46 }, (_, i) => ({ left: `${(i * 41 + 7) % 100}%`, top: `${(i * 67 + 3) % 96}%`, @@ -279,6 +311,7 @@ function Shell() {
+