mirror of
https://github.com/hanzoai/chat.git
synced 2026-09-30 20:51:17 +00:00
Report hanzo.chat to its own GA4 stream
hanzo.chat had no GA. Configure G-GRQBMNDTT6 inline in the head, keyed by host because one document serves every brand, and fetch gtag.js after the load event so a dropped Google host cannot hold the page. The linker keeps a visit one session across the Hanzo domains, and GPC or DNT opts out.
This commit is contained in:
+21
@@ -21,6 +21,27 @@
|
||||
height: 100dvh;
|
||||
}
|
||||
</style>
|
||||
<!-- GA4, each brand host to its own stream: this one document serves every
|
||||
brand, so a host with no stream here sends nothing. The first page view
|
||||
queues before the bundle; gtag.js is fetched after `load`, since a script
|
||||
in the head holds the load event until its host answers. Route changes
|
||||
are GA4's own history listener. Global Privacy Control and Do Not Track
|
||||
opt out. -->
|
||||
<script>
|
||||
var tid = { 'hanzo.chat': 'G-GRQBMNDTT6' }[location.hostname];
|
||||
if (tid && !navigator.globalPrivacyControl && navigator.doNotTrack !== '1') {
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments)}
|
||||
gtag('js', new Date());
|
||||
gtag('config', tid, { linker: { domains: [location.hostname, 'hanzo.ai', 'hanzo.id', 'pay.hanzo.ai', 'cal.hanzo.ai'] } });
|
||||
addEventListener('load', function () {
|
||||
var s = document.createElement('script');
|
||||
s.async = true;
|
||||
s.src = 'https://www.googletagmanager.com/gtag/js?id=' + tid;
|
||||
document.head.appendChild(s);
|
||||
}, { once: true });
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
||||
Reference in New Issue
Block a user