WordPress

Add Databuddy's privacy-first analytics to your WordPress site without slowing it down. No cookies, fully GDPR compliant, and 247x smaller than Google Analytics.

Installation Methods

Choose the installation method that works best for your WordPress setup. If you're using WordPress.com (hosted), you'll need to use a plugin since direct theme editing isn't available. For self-hosted WordPress.org sites, you have more flexibility.

Using a Plugin (Recommended)

The safest and easiest way to add Databuddy to WordPress is using a plugin that allows you to inject scripts without modifying theme files. This works for both WordPress.com and self-hosted installations.

1

Install a Script Injection Plugin

Install a plugin like Insert Headers and Footers from the WordPress plugin directory. This plugin lets you add scripts to your site's header or footer without touching theme files.

2

Add Your Databuddy Script

In the plugin settings, paste your Databuddy tracking script in the header section:

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

Save and Verify

Save your changes and wait a few minutes, then check your Databuddy dashboard to confirm tracking is working.

Tip: If the script doesn't load in the header, try adding it to the footer section instead. Some WordPress configurations work better with scripts in the body.

Configuration Options

Basic Tracking Setup

Enable essential tracking features for most WordPress sites:

html
<script
src="https://cdn.databuddy.cc/databuddy.js"
data-client-id="YOUR_CLIENT_ID"
data-track-hash-changes
async
></script>

Enhanced Tracking Setup

For more detailed analytics, enable additional tracking options:

html
<script
src="https://cdn.databuddy.cc/databuddy.js"
data-client-id="YOUR_CLIENT_ID"
data-track-attributes
data-track-outgoing-links
data-track-interactions
data-track-performance
data-track-web-vitals
data-track-errors
data-track-scroll-depth
async
></script>

WordPress-Specific Integrations

Form Submission Tracking

Track submissions from popular WordPress form plugins using data attributes:

html
<!-- Contact Form 7 -->
<input type="hidden" data-track="form_submit" data-form-type="contact">

<!-- Gravity Forms -->
<input type="hidden" data-track="form_submit" data-form-type="gravity">

<!-- WPForms -->
<input type="hidden" data-track="form_submit" data-form-type="wpforms">

Custom Post Type Analytics

Track views of custom post types by adding this to your theme's functions.php:

functions.phpphp
function track_custom_post_types() {
if (is_singular('your_custom_post_type')) {
  echo '<script>
    if (window.databuddy) {
      databuddy.track("custom_post_view", {
        post_type: "' . esc_js(get_post_type()) . '",
        post_id: ' . get_the_ID() . '
      });
    }
  </script>';
}
}
add_action('wp_footer', 'track_custom_post_types');

Performance Benefits

Databuddy is designed to have minimal impact on your WordPress site's performance:

  • Lightweight: 247x smaller than Google Analytics
  • Non-blocking: Loads asynchronously without affecting page speed
  • Core Web Vitals: Improves your WordPress performance scores
  • Server Friendly: Minimal server load compared to other analytics solutions

Common Use Cases

Membership Sites

Track premium content engagement:

html
<button 
data-track="premium_content_view" 
data-content-type="video"
>
Watch Premium Video
</button>

Blog Analytics

Track article engagement and reading patterns:

html
<article 
data-track="article_view" 
data-category="tutorials" 
data-author="author-name"
>
<!-- Your article content -->
</article>

Lead Generation

Track conversion events and CTA clicks:

html
<a 
href="/contact" 
data-track="cta_click" 
data-cta-type="contact"
>
Get Quote
</a>

Troubleshooting

Script Not Loading

If Databuddy isn't tracking:

  1. Check Browser Console: Open developer tools and look for errors or the "Databuddy initialized" message
  2. Verify Script Placement: Ensure the script is in the <head> or before </body>
  3. Clear Cache: Clear your WordPress cache (WP Rocket, W3 Total Cache, etc.) and browser cache
  4. Test in Incognito: Use incognito/private browsing to avoid cache issues

Plugin Conflicts

If you're experiencing issues:

  • Temporarily deactivate other analytics plugins to identify conflicts
  • Check if your security plugin is blocking the script
  • Verify your theme includes wp_head() in header.php if using the functions.php method

Verification

After installation, verify tracking is working:

  1. Visit your site and navigate through a few pages
  2. Wait 2-3 minutes for data to process
  3. Check your Databuddy dashboard for page views
  4. Use browser dev tools Network tab to confirm requests are being sent

WordPress Multisite

For WordPress multisite networks:

  1. Individual Site Configuration: Add the Databuddy script to each site individually using one of the methods above
  2. Unique Client IDs: Each site should have its own Client ID for separate analytics
  3. Plugin Management: Consider using the Insert Headers and Footers plugin for easier management across multiple sites

Need help with your WordPress integration? Contact us at help@databuddy.cc.

How is this guide?