Skip to content

Commit 1af48ff

Browse files
feat: Add Reo.Dev tracking for web-ui
1 parent e34a646 commit 1af48ff

File tree

1 file changed

+49
-6
lines changed

1 file changed

+49
-6
lines changed

overrides/partials/integrations/analytics/custom.html

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,55 @@
22
<script type="text/javascript" id="hs-script-loader" async defer src="//js.hs-scripts.com/23414950.js"></script>
33
<!-- End of HubSpot Embed Code -->
44

5-
<!-- Google tag (gtag.js) -->
6-
<script async src="https://www.googletagmanager.com/gtag/js?id=G-QDX72QWF46"></script>
5+
<!-- Consent-aware tracking integrations using HubSpot's official API -->
76
<script>
8-
window.dataLayer = window.dataLayer || [];
9-
function gtag(){dataLayer.push(arguments);}
10-
gtag('js', new Date());
7+
(function () {
8+
if (typeof window === "undefined") return;
119

12-
gtag('config', 'G-QDX72QWF46');
10+
// Initialize HubSpot privacy consent array
11+
window._hsp = window._hsp || [];
12+
13+
// Loader for Reo tracking script (respects consent)
14+
function loadReo() {
15+
if (window.__reoLoaded) return; // idempotent
16+
window.__reoLoaded = true;
17+
var clientID = 'a302bd2a30723ff';
18+
var s = document.createElement('script');
19+
s.src = 'https://static.reo.dev/' + clientID + '/reo.js';
20+
s.defer = true;
21+
s.onload = function () {
22+
try {
23+
if (window.Reo && typeof window.Reo.init === 'function') {
24+
window.Reo.init({ clientID: clientID });
25+
}
26+
} catch (_) {}
27+
};
28+
document.head.appendChild(s);
29+
}
30+
31+
// Loader for Google Tag Manager (respects consent)
32+
function loadGTM() {
33+
if (window.__gtmLoaded) return;
34+
window.__gtmLoaded = true;
35+
var gtmId = 'GTM-T8Z9D5XH';
36+
// Initialize dataLayer lazily
37+
window.dataLayer = window.dataLayer || [];
38+
window.dataLayer.push({ 'event': 'consent_ready' });
39+
var s = document.createElement('script');
40+
s.defer = true;
41+
s.src = 'https://www.googletagmanager.com/gtm.js?id=' + encodeURIComponent(gtmId);
42+
document.head.appendChild(s);
43+
}
44+
45+
// Use HubSpot's official privacy consent listener
46+
window._hsp.push(['addPrivacyConsentListener', function(consent) {
47+
// Check if analytics consent is granted
48+
if (consent && consent.categories && consent.categories.analytics) {
49+
loadReo();
50+
loadGTM();
51+
loadGA();
52+
}
53+
}]);
54+
})();
1355
</script>
56+

0 commit comments

Comments
 (0)