Webflow
Paste one script into your Webflow site settings and every page records visits in Databuddy.
Add the script
Paste it into Head code
In Site settings → Custom code, paste this into Head code:
<script
src="https://cdn.databuddy.cc/databuddy.js"
data-client-id="YOUR_CLIENT_ID"
data-track-attributes
crossorigin="anonymous"
async
></script>Your Client ID is in the Databuddy dashboard under your website's Settings → General.
Publish
Save and publish, then visit a few pages of the live website. They appear on your dashboard.
Each page load counts as a pageview. Tabs, sliders and other interactions that don't change the URL don't, so track them as events.
Track a button click
Select the element in the Designer, open Settings → Custom attributes, and add a data-track name plus any properties:
Each click sends a cta_click event with location: "hero".
Track a form submission
Give the Form Block an ID in its settings, such as contact-form, then add this to Footer code:
<script>
document.getElementById("contact-form")?.addEventListener("submit", function () {
window.databuddy?.track("form_submit", {
form_id: "contact-form",
page_path: window.location.pathname,
});
});
</script>This counts every submit attempt, including ones that fail validation.
Track section views on a one-page website
Add a custom attribute named data-track-section to each section, then add this to Footer code:
<script>
var observer = new IntersectionObserver(function (entries) {
entries.forEach(function (entry) {
if (!entry.isIntersecting) return;
window.databuddy?.track("section_view", { section_id: entry.target.id });
observer.unobserve(entry.target);
});
}, { threshold: 0.5 });
document.querySelectorAll("[data-track-section]").forEach(function (section) {
observer.observe(section);
});
</script>Each section sends one section_view per page load, the first time half of it is on screen.
Turn on more tracking
Add attributes to the script tag:
data-track-outgoing-links
data-track-web-vitals
data-track-errorsRelated
How is this guide?