Integrations

WordPress

Paste one script into your WordPress header and Databuddy records every pageview and visit.

Databuddy script
<script
  src="https://cdn.databuddy.cc/databuddy.js"
  data-client-id="YOUR_CLIENT_ID"
  crossorigin="anonymous"
  async
></script>

Your Client ID is in the dashboard under your website's Settings → General.

Add the script

Install a header plugin

In Plugins → Add New, install WPCode – Insert Headers and Footers, or use the script plugin your website already has.

Paste the script

Paste the script above into the plugin's site-wide Header field, not a PHP snippet field. Save.

Clear your caches

Purge your WordPress cache plugin and any CDN so visitors get the new markup.

This survives theme updates, so it's the safest choice. WordPress.com needs a plan that allows plugins (requirements).

Install the script once. A copy in a plugin plus another in your theme or Google Tag Manager counts every pageview twice.

Check it works

Open your website in a private window and visit two or three pages. In the browser's Network tab, databuddy.js loads from cdn.databuddy.cc and events go to basket.databuddy.cc. Those visits then show on your dashboard.

What you seeWhat to check
No script in the page sourceThe snippet is saved and active, and your cache and CDN are purged
The script loads but nothing arrivesThe Client ID, your consent tool, and any content security policy
Every pageview counted twiceAnother copy in your theme, a plugin or a tag manager

Count form submissions

Count a contact form only when it succeeds. Contact Form 7 fires wpcf7mailsent after it sends the mail:

Header plugin, after the Databuddy script
<script>
  document.addEventListener("wpcf7mailsent", function (event) {
    window.databuddy?.track("quote_request_completed", {
      form_id: String(event.detail.contactFormId),
    });
  });
</script>

Keep names, emails and messages out of event properties. Gravity Forms and WPForms have their own success hooks that work the same way.

Track button clicks

Add data-track-attributes to the script tag, then name any element in your content:

Block editor, Custom HTML block
<a href="/contact" data-track="cta_click" data-cta-type="contact">Get a quote</a>

Each click sends a cta_click event with ctaType: "contact". Every other data-* attribute on the element becomes a property the same way.

On a multisite network, add the script to each website with its own Client ID.

How is this guide?