Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ python3 scripts/builder_cards.py

## 이벤트 측정

`assets/js/track.js`의 `hubTrack(이름, 파라미터)`가 GA4로 이벤트를 보냅니다. GA4가 설치되지 않았으면 아무 일도 하지 않습니다. 이벤트 이름과 파라미터는 PM 문서의 이벤트 사전을 따르고, 새 이벤트를 넣을 때는 사전에도 같이 적습니다. HTML에서는 `data-event="click_join" data-event-params='{"target":"template","source":"builder_page"}'`처럼 속성만으로도 보낼 수 있습니다. 로컬에서 확인하려면 콘솔에서 `window.HUB_DEBUG = true`를 켭니다.
`assets/js/track.js`의 `hubTrack(이름, 파라미터)`가 GA4로 이벤트를 보냅니다. 허브는 `assets/js/ga.js`에서 자체 Google 태그(`G-CS9K0E86LR`, 허브 GA4 속성의 스트림)만 불러오고, 웹북 태그와는 섞이지 않습니다. GA4가 설치되지 않았으면 아무 일도 하지 않습니다. 이벤트 이름과 파라미터는 PM 문서의 이벤트 사전을 따르고, 새 이벤트를 넣을 때는 사전에도 같이 적습니다. HTML에서는 `data-event="click_join" data-event-params='{"target":"template","source":"builder_page"}'`처럼 속성만으로도 보낼 수 있습니다. 로컬에서 확인하려면 콘솔에서 `window.HUB_DEBUG = true`를 켭니다.

한빛미디어 링크는 `track.js`가 한곳에서 처리합니다. 누를 때마다 `click_partner`(item, action, placement)를 한 번 보내고 링크에 `utm_source=causalinference_hub`를 붙이므로, 한빛 링크에는 따로 `data-event`를 달지 않습니다. `item`은 책 `paid-book`, 강의 `paid-lecture`, 채널 H 연재 `channel-h`이고, 그 밖의 한빛 주소는 `other`입니다. 들어온 링크의 `utm_*`는 `ga.js`가 주소창에서 지우기 전에 `sessionStorage`의 `cil-hub-landing`에 남깁니다. `utm_source=forum5`처럼 `forum<회차>`로 들어오면 그 탭에서는 진단이 행사 현장 모드가 됩니다. 진단 결과에 네트워킹 카드가 생기고, 진단 이벤트에 `context`가 붙습니다. 카드는 행사 다음 날까지만 나옵니다.

Expand Down
24 changes: 9 additions & 15 deletions assets/js/ga.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,19 @@
counted. Incoming utm_* (from shared links or other team sites) reach GA through page_location
and are then removed from the address bar so the URL people copy stays clean. */
(() => {
/* The hub's GA4 stream is G-C5V0X2SGD3. Until its own Google tag is served (it was combined into the
web book's tag, G-BEBVKYH8HL, whose script then also sends to the web book's stream), the hub falls back to
that shared tag, which is how it measured until now. Once the hub's destination is removed from the
shared tag, gtag/js?id=G-C5V0X2SGD3 loads and the hub reports to its own property only. */
const OWN = "G-C5V0X2SGD3", SHARED = "G-BEBVKYH8HL";
/* The hub reports to its own stream, G-CS9K0E86LR, in the hub's GA4 property, through its own Google tag.
(Until November 2026 the hub loaded the web book's tag, G-BEBVKYH8HL, which sent every page to both the
web book's property and the hub's first stream, G-C5V0X2SGD3. That stream now only keeps the history.) */
const ID = "G-CS9K0E86LR";
if (location.hostname === "causalinferencelab.github.io") {
const cfg = { page_location: location.href, allow_google_signals: false, allow_ad_personalization_signals: false };
const load = (id, onerror) => {
const s = document.createElement("script");
s.async = true;
s.src = `https://www.googletagmanager.com/gtag/js?id=${id}`;
if (onerror) s.onerror = onerror;
document.head.appendChild(s);
};
const s = document.createElement("script");
s.async = true;
s.src = `https://www.googletagmanager.com/gtag/js?id=${ID}`;
document.head.appendChild(s);
window.dataLayer = window.dataLayer || [];
window.gtag = function gtag() { window.dataLayer.push(arguments); };
window.gtag("js", new Date());
window.gtag("config", OWN, cfg);
load(OWN, () => { window.gtag("config", SHARED, cfg); load(SHARED); });
window.gtag("config", ID, { page_location: location.href, allow_google_signals: false, allow_ad_personalization_signals: false });
}
try {
const u = new URL(location.href);
Expand Down
Binary file added loose.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added proj.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.