Skip to content

feat: SEO 최적화 + GA4 퍼널 트래킹 + 로그인 인증 가드#8

Merged
sgd122 merged 1 commit intomainfrom
feat/seo-analytics-auth-guard
Feb 19, 2026
Merged

feat: SEO 최적화 + GA4 퍼널 트래킹 + 로그인 인증 가드#8
sgd122 merged 1 commit intomainfrom
feat/seo-analytics-auth-guard

Conversation

@sgd122
Copy link
Copy Markdown
Owner

@sgd122 sgd122 commented Feb 18, 2026

Summary

  • GA4 Analytics: 전체 사용자 퍼널 측정 (업로드 → 결제 → 분석완료 → 리포트 다운로드)
  • SEO 강화: robots.ts, sitemap.ts, JSON-LD 구조화 데이터 (Organization, Product, FAQ, BreadcrumbList), 페이지별 canonical URL
  • 로그인 인증 가드: 로그인 상태에서 /login 접근 시 /dashboard로 서버사이드 리다이렉트, 미인증 사용자 보호 라우트 가드
  • 빌드 수정: FAQ_ITEMS SSR 빌드 에러 해결 (use client 바배럴 export → 데이터 파일 분리)

변경 파일 (23개)

영역 파일 변경 내용
GA4 shared/ui/google-analytics.tsx GA4 스크립트 + 페이지뷰 자동 트래킹
GA4 shared/lib/analytics.ts 퍼널 이벤트 유틸 (upload/payment/analysis/report)
GA4 shared/types/gtag.d.ts Window.gtag 타입 선언
SEO app/robots.ts, app/sitemap.ts 검색엔진 크롤링 설정
SEO shared/lib/seo.ts JSON-LD 스키마 (BreadcrumbList 추가)
SEO _pages/landing/landing-page.tsx Organization + Product + FAQ JSON-LD
SEO 마케팅 페이지 3개 canonical URL + OG 메타데이터
Auth middleware.ts 인증/보호 라우트 가드 (CORS + auth)
Auth app/(auth)/login/page.tsx 서버 컴포넌트 인증 체크 + redirect
Auth features/auth/ui/login-content.tsx 클라이언트 보조 가드
Fix widgets/landing/faq-data.ts FAQ 데이터 분리 (SSR 빌드 에러 수정)
Config turbo.json, .env.example GA/Google 환경변수 추가

Test plan

  • pnpm build 정상 빌드 확인
  • 로그인 상태에서 /login 접근 시 /dashboard 리다이렉트 확인
  • 미로그인 상태에서 /dashboard 접근 시 /login 리다이렉트 확인
  • GA4 measurement ID 설정 후 퍼널 이벤트 발생 확인
  • /robots.txt, /sitemap.xml 정상 응답 확인
  • 랜딩 페이지 JSON-LD 구조화 데이터 확인

🤖 Generated with Claude Code

- GA4 analytics: 전체 퍼널 측정 (업로드→결제→분석→리포트)
- SEO: robots.ts, sitemap.ts, JSON-LD (Organization, Product, FAQ, Breadcrumb)
- SEO: 마케팅 페이지별 canonical URL + OG 메타데이터 강화
- Auth: 로그인 페이지 서버 컴포넌트 인증 가드 (로그인 시 /dashboard 리다이렉트)
- Auth: middleware에 보호 라우트 + 인증 라우트 가드 추가
- Fix: FAQ_ITEMS SSR 빌드 에러 수정 (데이터 파일 분리)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @sgd122, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 풀 리퀘스트는 서비스의 사용자 경험 분석 및 검색 엔진 최적화를 대폭 강화하고, 동시에 보안 및 안정성을 개선하는 데 중점을 둡니다. GA4를 통한 정교한 사용자 행동 추적과 SEO 강화를 통해 서비스의 가시성과 데이터 기반 의사결정 능력을 향상시키며, 인증 가드를 통해 사용자 접근 제어를 더욱 견고하게 만듭니다.

Highlights

  • GA4 퍼널 트래킹 구현: 파일 업로드, 결제, 분석 완료, 리포트 다운로드 등 핵심 사용자 여정에 대한 GA4 커스텀 이벤트를 추가하여 퍼널 데이터를 측정합니다.
  • SEO 최적화 강화: robots.txt 및 sitemap.xml을 생성하고, 랜딩 페이지 및 마케팅 페이지에 Organization, Product, FAQ, BreadcrumbList 등 다양한 JSON-LD 구조화 데이터를 적용했습니다. 또한, 페이지별 canonical URL과 Open Graph 메타데이터를 추가하여 검색 엔진 노출을 개선했습니다.
  • 로그인 인증 가드 도입: 로그인 상태에서 로그인 페이지 접근 시 대시보드로 서버사이드 리다이렉트 처리하고, 미인증 사용자가 보호된 라우트에 접근할 경우 로그인 페이지로 리다이렉트하는 미들웨어 기반 인증 가드를 구현했습니다.
  • 빌드 오류 수정 및 환경 설정: FAQ 데이터를 별도 파일로 분리하여 SSR 빌드 오류를 해결하고, GA 및 Google Search Console 관련 환경 변수를 추가했습니다.
Changelog
  • .env.example
    • Google Analytics 및 Google Search Console 환경 변수가 추가되었습니다.
  • apps/web/src/_pages/analysis-result/analysis-result-page.tsx
    • 분석 완료 및 리포트 다운로드 GA4 이벤트 트래킹 로직이 추가되었습니다.
  • apps/web/src/_pages/landing/landing-page.tsx
    • 조직, 제품, FAQ에 대한 JSON-LD 구조화 데이터 스크립트가 추가되었습니다.
  • apps/web/src/_pages/payment-confirm/payment-confirm-page.tsx
    • 결제 완료 GA4 이벤트 트래킹 로직이 추가되었습니다.
  • apps/web/src/app/(auth)/login/page.tsx
    • 로그인 상태 사용자를 위한 서버사이드 대시보드 리다이렉트 로직이 추가되었습니다.
  • apps/web/src/app/(marketing)/about/page.tsx
    • SEO 메타데이터(canonical URL, Open Graph)가 업데이트되었습니다.
  • apps/web/src/app/(marketing)/help/page.tsx
    • SEO 메타데이터(canonical URL)가 추가되었습니다.
  • apps/web/src/app/(marketing)/pricing/page.tsx
    • SEO 메타데이터(canonical URL, Open Graph)가 업데이트되었습니다.
  • apps/web/src/app/layout.tsx
    • Google Analytics 컴포넌트가 통합되었고, 전역 SEO 메타데이터가 확장되었습니다.
  • apps/web/src/app/robots.ts
    • 검색 엔진 크롤링 규칙을 정의하는 robots.txt 파일이 추가되었습니다.
  • apps/web/src/app/sitemap.ts
    • 사이트맵을 생성하는 sitemap.xml 파일이 추가되었습니다.
  • apps/web/src/features/auth/ui/login-content.tsx
    • 로그인된 사용자가 로그인 폼을 보지 않도록 클라이언트 측 가드가 추가되었습니다.
  • apps/web/src/features/payment/hooks/use-payment.ts
    • 결제 시작 GA4 이벤트 트래킹 로직이 추가되었습니다.
  • apps/web/src/features/upload/hooks/use-file-upload.ts
    • 파일 업로드 시작 및 완료 GA4 이벤트 트래킹 로직이 추가되었습니다.
  • apps/web/src/middleware.ts
    • 인증 및 보호된 라우트에 대한 미들웨어 기반 인증 가드가 구현되었습니다.
  • apps/web/src/shared/lib/analytics.ts
    • GA4 커스텀 이벤트 트래킹 유틸리티 함수가 추가되었습니다.
  • apps/web/src/shared/lib/seo.ts
    • JSON-LD 구조화 데이터 생성을 위한 SEO 유틸리티 함수가 추가되었습니다.
  • apps/web/src/shared/types/gtag.d.ts
    • Window.gtag 타입 선언이 추가되었습니다.
  • apps/web/src/shared/ui/google-analytics.tsx
    • Google Analytics 스크립트 및 페이지뷰 트래킹 컴포넌트가 추가되었습니다.
  • apps/web/src/widgets/landing/faq-data.ts
    • FAQ 데이터가 별도 파일로 분리되었습니다.
  • apps/web/src/widgets/landing/faq-section.tsx
    • FAQ 데이터 임포트 경로가 업데이트되었습니다.
  • apps/web/src/widgets/landing/index.ts
    • FAQ_ITEMS가 내보내기 목록에 추가되었습니다.
  • turbo.json
    • 빌드 시 필요한 GA 및 Google Search Console 환경 변수가 추가되었습니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

이 PR은 SEO 최적화, GA4 퍼널 트래킹, 그리고 인증 가드 기능을 추가하여 애플리케이션의 완성도를 크게 높였습니다. 전반적으로 변경 사항들이 체계적으로 잘 구현되었습니다. 특히 Next.js의 기능을 활용한 SEO 메타데이터 및 구조화 데이터 추가, 그리고 사용자 행동 분석을 위한 GA4 이벤트 트래킹 구현이 인상적입니다.

다만, middleware.ts 파일의 인증 로직에서 Supabase 세션 쿠키를 처리하는 부분에 잠재적인 버그가 발견되었습니다. 이 부분은 인증 안정성에 영향을 줄 수 있으므로 수정이 필요합니다. 자세한 내용은 아래 리뷰 코멘트를 참고해주세요.

Comment on lines +74 to +82
setAll(cookiesToSet: { name: string; value: string; options?: Record<string, unknown> }[]) {
cookiesToSet.forEach(({ name, value, options }) => {
request.cookies.set(name, value);
response = NextResponse.next({
request: { headers: request.headers },
});
response.cookies.set(name, value, options);
});
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Supabase 클라이언트의 setAll 쿠키 핸들러 구현에 심각한 버그가 있습니다. cookiesToSet.forEach 루프 내에서 response = NextResponse.next(...)를 호출하여 response 객체를 매번 새로 생성하고 있습니다.

만약 Supabase가 토큰 갱신 등으로 여러 쿠키(예: 세션 토큰, 리프레시 토큰)를 한 번에 설정해야 할 경우, 루프의 마지막 반복에서 생성된 response 객체만 남게 되어 이전에 설정된 쿠키가 유실됩니다. 이는 인증 상태가 불안정해지는 원인이 될 수 있습니다.

setAll 로직은 모든 쿠키를 request에 먼저 설정한 후, 업데이트된 request로 response를 한 번만 생성하고, 그 다음에 모든 쿠키를 response에 설정하는 방식으로 수정해야 합니다. 아래 제안된 코드를 참고하여 수정해주세요.

          setAll(cookiesToSet: { name: string; value: string; options?: Record<string, unknown> }[]) {
            cookiesToSet.forEach(({ name, value, options }) => {
              request.cookies.set(name, value, options);
            });
            response = NextResponse.next({
              request: {
                headers: request.headers,
              },
            });
            cookiesToSet.forEach(({ name, value, options }) => {
              response.cookies.set(name, value, options);
            });
          },

@sgd122 sgd122 merged commit f3d6862 into main Feb 19, 2026
2 checks passed
@sgd122 sgd122 deleted the feat/seo-analytics-auth-guard branch February 19, 2026 05:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant