feat: GA4 전환 이벤트 추적 + 전 페이지 스크롤 리빌 애니메이션

- lib/gtag.ts: GA4 이벤트 유틸리티 (trackCTAClick, trackToolDemo, trackDownload, trackOutboundClick)
- ContactModal/ContactForm: 공용 trackEvent로 리팩토링 + generate_lead 이벤트
- 홈/tools/automation/prompt/website: CTA 클릭 이벤트 추적 추가
- 홈/freelance/ai-kit: IntersectionObserver 스크롤 리빌 애니메이션 신규 추가
- automation/prompt: GA4 trackCTAClick 적용

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-03 07:34:17 +09:00
parent c7bf0253e3
commit 5d2fd4be1f
10 changed files with 230 additions and 60 deletions

47
lib/gtag.ts Normal file
View File

@@ -0,0 +1,47 @@
export const GA_ID = 'G-WG77RNHXRK';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
declare global { interface Window { gtag?: (...args: any[]) => void } }
export function trackEvent(
eventName: string,
params?: Record<string, string | number>,
) {
if (typeof window !== 'undefined' && typeof window.gtag === 'function') {
window.gtag('event', eventName, params);
}
}
/** CTA 클릭 추적 */
export function trackCTAClick(label: string, page?: string) {
trackEvent('cta_click', {
event_category: 'engagement',
event_label: label,
page_location: page || (typeof window !== 'undefined' ? window.location.pathname : ''),
});
}
/** 도구 체험/데모 클릭 */
export function trackToolDemo(toolName: string) {
trackEvent('tool_demo_click', {
event_category: 'engagement',
tool_name: toolName,
});
}
/** 무료 도구 다운로드 */
export function trackDownload(toolName: string) {
trackEvent('file_download', {
event_category: 'conversion',
file_name: toolName,
});
}
/** 외부 링크 클릭 (크몽 등) */
export function trackOutboundClick(url: string, label: string) {
trackEvent('outbound_click', {
event_category: 'outbound',
event_label: label,
link_url: url,
});
}