diff --git a/index.html b/index.html index 02171ec..a71c5eb 100755 --- a/index.html +++ b/index.html @@ -8,10 +8,16 @@ window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); - // 로그인 콜백 주소에 붙어 오는 토큰·인가 코드는 지운 주소로 보낸다 (GA4 '데이터 수정' 설정과 이중 보호) - var gaPageUrl = new URL(window.location.href); - ['access_token', 'refresh_token', 'code'].forEach(function (key) { gaPageUrl.searchParams.delete(key); }); - gtag('config', 'G-KK71C474J2', { page_location: gaPageUrl.toString() }); + // 주소에는 토큰·채널 정보 등이 붙어 올 수 있어, 경로와 광고 유입 값(utm_*, gclid)만 남겨 보낸다 + // (GA4 '데이터 수정' 설정과 이중 보호) + (function () { + var current = new URL(window.location.href); + var safeUrl = new URL(current.origin + current.pathname); + current.searchParams.forEach(function (value, key) { + if (key.indexOf('utm_') === 0 || key === 'gclid') safeUrl.searchParams.append(key, value); + }); + gtag('config', 'G-KK71C474J2', { page_location: safeUrl.toString() }); + })(); @@ -87,20 +93,6 @@ - - -