feat: Add GA4 CTA click tracking across all pages

Track clicks on 'Get started free' and 'Request demo' CTAs via
gtag events (cta_get_started, cta_request_demo) and GTM dataLayer.

This enables GA4 conversion tracking for CTA clicks, which was
previously missing (GA audit found zero conversion events).

Uses event delegation so it automatically tracks all CTA links
including dynamically rendered ones.

Added to: homepage, pricing, demo, blog posts, blog list,
status page, and industry pages.
This commit is contained in:
Jamie Mallers
2026-02-20 14:46:19 +00:00
parent 006c41472c
commit 3e416c1679
12 changed files with 54 additions and 0 deletions

View File

@@ -82,6 +82,7 @@
<%- include('./Partials/BlogCta') -%>
<%- include('../footer') -%>
<%- include("../Partials/cta-tracking") -%>
</body>
</html>

View File

@@ -47,6 +47,7 @@
<%- include('./Partials/BlogCta') -%>
<%- include('../footer') -%>
<%- include("../Partials/cta-tracking") -%>
</body>
</html>

View File

@@ -720,6 +720,7 @@
} catch(e) {}
})();
</script>
<%- include("../Partials/cta-tracking") -%>
</body>
</html>

View File

@@ -0,0 +1,43 @@
<!-- GA4 CTA Click Tracking -->
<script>
(function() {
// Track clicks on all CTA links (register + demo)
document.addEventListener('click', function(e) {
var link = e.target.closest('a');
if (!link) return;
var href = link.getAttribute('href') || '';
var eventName = null;
var eventLabel = '';
if (href.indexOf('/accounts/register') !== -1) {
eventName = 'cta_get_started';
eventLabel = link.textContent.trim();
} else if (href.indexOf('/enterprise/demo') !== -1) {
eventName = 'cta_request_demo';
eventLabel = link.textContent.trim();
}
if (eventName) {
// GA4 via gtag
if (typeof gtag !== 'undefined') {
gtag('event', eventName, {
event_category: 'conversion',
event_label: eventLabel,
link_url: href
});
}
// GTM dataLayer (backup)
if (typeof dataLayer !== 'undefined') {
dataLayer.push({
event: eventName,
eventCategory: 'conversion',
eventAction: eventName,
eventLabel: eventLabel,
linkUrl: href
});
}
}
});
})();
</script>

View File

@@ -811,6 +811,7 @@
</main>
<%- include('footer') -%>
<%- include("./Partials/cta-tracking") -%>
</body>
</html>

View File

@@ -42,6 +42,7 @@
<%- include('footer') -%>
<%- include('./Partials/video-script') -%>
<%- include('./Partials/cta-tracking') -%>
</body>

View File

@@ -386,6 +386,7 @@
</main>
<%- include('../footer') -%>
<%- include("../Partials/cta-tracking") -%>
</body>
</html>

View File

@@ -386,6 +386,7 @@
</main>
<%- include('../footer') -%>
<%- include("../Partials/cta-tracking") -%>
</body>
</html>

View File

@@ -385,6 +385,7 @@
</main>
<%- include('../footer') -%>
<%- include("../Partials/cta-tracking") -%>
</body>
</html>

View File

@@ -378,6 +378,7 @@
</main>
<%- include('../footer') -%>
<%- include("../Partials/cta-tracking") -%>
</body>
</html>

View File

@@ -1953,6 +1953,7 @@ Coinbase: "The Times 03/Jan/2009 Chancellor on brink of second bailout for
})();
</script>
<%- include("./Partials/cta-tracking") -%>
</body>
</html>

View File

@@ -1350,6 +1350,7 @@
})();
</script>
<%- include("./Partials/cta-tracking") -%>
</body>
</html>