tag section, then publish and test the site to ensure tracking works.
To add custom Google tracking code (like a Google Ads conversion script or Google Analytics event) to the "Book Online" button in Webflow, you need to insert the code so it triggers when that button is clicked.
book-online-btn
in the Element Settings > Element ID field.Go to Page Settings (for your homepage) or Site Settings > Custom Code if the script applies globally.
Paste your Google tracking code (e.g., a gtag
event or Google Ads conversion tag) within the Before tag section.
Include a click
event listener using the button's ID or class. For example:
For an ID selector, use:
document.getElementById('book-online-btn').addEventListener('click', function() { /* tracking code here */ });
For a class selector like .book-button
, use:
document.querySelector('.book-button').addEventListener('click', function() { /* tracking code here */ });
Replace /* tracking code here */
with your Google Ads or Analytics event code. Example for Google Analytics 4:
gtag('event', 'book_now_click', { 'event_category': 'Button', 'event_label': 'Book Online' });
To track clicks on your "Book Online" button in Webflow, give it a unique ID or class, then insert your Google tracking code in the Before tag section using a click event listener linked to that button. Be sure to publish and test the implementation.