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
4 changes: 4 additions & 0 deletions marketing/analytics-access.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ one-time setup.

## GA4 events

Both apps load `gtag.js` only when the page hostname is `rdlabo.dev` or one of its subdomains.
Local development (`localhost`, `127.0.0.1`) and preview hosts define the `gtag` stub but never
load the tag, so their page views and clicks do not reach the property.

The site emits these events from article pages:

| Event | Meaning |
Expand Down
13 changes: 9 additions & 4 deletions projects/docs/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,20 @@
<meta name="theme-color" content="#fffaf7" />
<link rel="icon" type="image/svg+xml" href="/assets/brand/rdlabo-logo.svg" />
<link rel="apple-touch-icon" href="/assets/brand/apple-touch-icon.png" />
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-EXVGMHNGJG"></script>
<!-- Google tag (gtag.js): loaded only on production hosts -->
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'G-EXVGMHNGJG', { send_page_view: false });
if (/(^|\.)rdlabo\.dev$/.test(window.location.hostname)) {
var gtagScript = document.createElement('script');
gtagScript.async = true;
gtagScript.src = 'https://www.googletagmanager.com/gtag/js?id=G-EXVGMHNGJG';
document.head.appendChild(gtagScript);
gtag('js', new Date());
gtag('config', 'G-EXVGMHNGJG', { send_page_view: false });
}
</script>
</head>
<body>
Expand Down
13 changes: 9 additions & 4 deletions projects/web-site/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,20 @@
<link rel="icon" type="image/png" href="/assets/brand/apple-touch-icon.png" />
<link rel="icon" type="image/svg+xml" href="/assets/brand/rdlabo-logo.svg" />
<link rel="apple-touch-icon" href="/assets/brand/apple-touch-icon.png" />
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-EXVGMHNGJG"></script>
<!-- Google tag (gtag.js): loaded only on production hosts -->
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'G-EXVGMHNGJG', { send_page_view: false });
if (/(^|\.)rdlabo\.dev$/.test(window.location.hostname)) {
var gtagScript = document.createElement('script');
gtagScript.async = true;
gtagScript.src = 'https://www.googletagmanager.com/gtag/js?id=G-EXVGMHNGJG';
document.head.appendChild(gtagScript);
gtag('js', new Date());
gtag('config', 'G-EXVGMHNGJG', { send_page_view: false });
}
</script>
</head>
<body>
Expand Down