feat(ga4): AI 유입 트래픽 연동 뼈대 + 리포트 "측정 가능 범위" 절
2026-09-08 작업분. GA4 에서 AI 답변엔진 유입을 채널로 갈라 보는 뼈대를 세웠다. - data/ai_channels.json: AI 답변엔진 리퍼러 목록(채널 그룹 정의의 근거) - scripts/ga4_ai_traffic.py: GA4 Data API 로 AI 유입을 뽑는 러너. --mock 으로 합성 데이터 검증까지 마쳤다. 실제 속성 연결은 GCP 계정이 정해진 뒤다 - supporters/src/layouts/Base.astro + 템플릿 site.json 2곳: ga4MeasurementId 태그. 쿠키 고지 배너 결정 전까지 미리보기에는 ID 를 넣지 않는다 - scripts/build_discovery_report.ts: Integrity 절에 "측정 가능 범위" 를 넣어 무엇을 재고 무엇을 못 재는지 리포트가 스스로 밝히게 했다 - 원진 진단 리포트 v2.1(HTML·PDF) 재생성분 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
4e73798cce
commit
8776a15183
9 files changed
+416
-2
No files matched your search
@@ -16,6 +16,8 @@ const { title, description, jsonLd, ogImage = S.buildingImage?.src || '/favicon.
|
||||
const site = Astro.site?.toString().replace(/\/$/, '') ?? '';
|
||||
const cleanPath = Astro.url.pathname.replace(/\/index\.html$/, '/').replace(/\.html$/, '');
|
||||
const canonical = (new URL(cleanPath, Astro.site).toString().replace(/\/$/, '') || site);
|
||||
// GA4: site.json 의 ga4MeasurementId(G-XXXX) 가 있을 때만 태그를 넣는다. 키 이벤트는 data/ai_channels.json conversion_events 와 같은 이름(click_tel · click_reservation · click_clinic_site · click_map).
|
||||
const GA4: string = /^G-[A-Z0-9]{6,}$/.test(String((S as Record<string, any>).ga4MeasurementId ?? '')) ? String((S as Record<string, any>).ga4MeasurementId) : '';
|
||||
const ld = jsonLd ? JSON.stringify({ '@context': 'https://schema.org', ...(Array.isArray(jsonLd) ? { '@graph': jsonLd } : jsonLd) }) : null;
|
||||
---
|
||||
<!doctype html>
|
||||
@@ -39,6 +41,9 @@ const ld = jsonLd ? JSON.stringify({ '@context': 'https://schema.org', ...(Array
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=Inter:wght@400;500;600&display=swap" rel="stylesheet" />
|
||||
{ld && <script type="application/ld+json" set:html={ld} />}
|
||||
{GA4 && <script is:inline async src={`https://www.googletagmanager.com/gtag/js?id=${GA4}`}></script>}
|
||||
{GA4 && <script is:inline set:html={`window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments)}gtag('js',new Date());gtag('config','${GA4}',{anonymize_ip:true});
|
||||
document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href')||'';var ev=h.indexOf('tel:')===0?'click_tel':a.dataset.ga==='reservation'||a.classList.contains('cta')?'click_reservation':a.dataset.ga==='clinic-site'?'click_clinic_site':a.dataset.ga==='map'?'click_map':null;if(ev)gtag('event',ev,{link_url:h,page_path:location.pathname});},true);`} />}
|
||||
</head>
|
||||
<body>
|
||||
{!INDEXABLE && <div class="sample-banner">샘플 사이트입니다. 정식 공개 전입니다.</div>}
|
||||
|
||||
Reference in new issue
Block a user