To integrate Google Analytics in Webflow and track button clicks using event tracking, follow these steps to embed your GA code and set up event listeners correctly.
This automatically injects the GA4 base code across your site.
To manually trigger events for Google Analytics (GA4), you can use a custom script inside Webflow:
cta-button
).<script>document.addEventListener("DOMContentLoaded", function() { var btn = document.getElementById("cta-button"); if(btn){ btn.addEventListener("click", function(){ gtag('event', 'click', { 'event_category': 'Button', 'event_label': 'CTA Button' }); }); }});</script>
'cta-button'
and 'CTA Button'
with your actual button ID and label.Make sure gtag() is loading via Webflow's built-in GA4 integration or your own script in the site header.
To track button clicks in Webflow using Google Analytics, add your GA4 Measurement ID or GTM container in Project Settings, then use JavaScript event listeners to send gtag('event', ...)
when buttons are clicked. Always verify events in GA4 Realtime panel or with browser debugging tools.