Add Snippet to track button clicks

Hi @beauty, here is one thing to try:

Step 1:

Create a class named “tracking-button” on the button or element that you wish track once the element is clicked.

Step 2:

Paste the following code into the Before Body section of custom code in Page settings

<script>
$( document ).ready(function() { 

function gtag_report_conversion(url) { var callback = function () { if (typeof(url) ≠ 'undefined') { window.location = url; } }; gtag('event', 'conversion', { 'send_to': 'AW-823066871/povGCPuL7noQ94G8iAM', 'event_callback': callback }); return false;
}
$(".tracking-button").click(function() {gtag_report_conversion()});
});

</script>

The code is to be pasted in to the Before Body section of Page settings as shown below:

Save changes and then republish the site.

Here is some helpful articles:

Using custom code in the head and body: Custom code in head and body tags | Webflow University

Using custom code in an embed component on the page: Custom code embed | Webflow University

Save the changes and the republish the site to see if that helps.

1 Like