Skip to content

Commit 1541cfd

Browse files
committed
docs(analytics): add GA4 redirect tracking page (repo.html)
1 parent aaf2a5d commit 1541cfd

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

docs/go/repo.html

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Redirecting…</title>
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-4NH21XZLBN"></script>
8+
<script>
9+
window.dataLayer = window.dataLayer || [];
10+
function gtag(){ dataLayer.push(arguments); }
11+
gtag('js', new Date());
12+
gtag('config', 'G-4NH21XZLBN');
13+
</script>
14+
</head>
15+
<body>
16+
<p>Redirecting to GitHub repo…</p>
17+
<script>
18+
const params = new URLSearchParams(location.search);
19+
const src = params.get('src') || 'unknown';
20+
const campaign = params.get('cmp') || 'repo';
21+
const content = params.get('c') || '';
22+
23+
gtag('event', 'outbound_to_github', {
24+
destination: 'github_repo',
25+
source_label: src,
26+
campaign,
27+
content
28+
});
29+
setTimeout(() => {
30+
const utm = `?utm_source=${encodeURIComponent(src)}&utm_medium=referral&utm_campaign=${encodeURIComponent(campaign)}${content ? `&utm_content=${encodeURIComponent(content)}` : ''}`;
31+
location.href = 'https://github.com/bsayli/spring-boot-openapi-generics-clients' + utm;
32+
}, 250);
33+
</script>
34+
</body>
35+
</html>

0 commit comments

Comments
 (0)