WordPress
Add Databuddy's cookieless product analytics to your WordPress site with an asynchronous tracker. The tracker uses browser storage instead of analytics cookies. Review your privacy and consent configuration before enabling collection.
Installation methods
Choose one installation method. WordPress.com requires a plan that supports plugins and custom JavaScript; see its custom code requirements. Self-hosted WordPress supports the methods below.
Configuration options
Basic tracking setup
Enable essential tracking features for most WordPress sites:
<script
src="https://cdn.databuddy.cc/databuddy.js"
data-client-id="YOUR_CLIENT_ID"
data-track-hash-changes
crossorigin="anonymous"
async
></script>Enhanced tracking setup
For more detailed analytics, enable additional tracking options:
<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-web-vitals
data-track-errors
crossorigin="anonymous"
async
></script>WordPress-specific integrations
Form submission tracking
Track form submission attempts with a submit handler. To measure successful submissions, use your form plugin’s success callback instead:
<script>
document.addEventListener('submit', function (event) {
var form = event.target.closest('.wpcf7-form, .gform_wrapper form, .wpforms-form');
if (form && window.databuddy) {
databuddy.track('form_submit', {
form_id: form.id || 'unknown',
page_path: window.location.pathname
});
}
});
</script>Performance benefits
Databuddy is designed to have minimal impact on your WordPress site's performance:
Common use cases
Membership sites
Track premium content engagement:
<button
data-track="premium_content_view"
data-content-type="video"
>
Watch Premium Video
</button>Blog analytics
Track clicks anywhere inside an article (the data-track attribute fires on click, not on view):
<article
data-track="article_click"
data-category="tutorials"
data-author="author-name"
>
<!-- Your article content -->
</article>Lead generation
Track conversion events and CTA clicks:
<a
href="/contact"
data-track="cta_click"
data-cta-type="contact"
>
Get Quote
</a>Troubleshooting
Script not loading
If Databuddy isn't tracking:
Plugin conflicts
If you're experiencing issues:
Verification
After installation, verify tracking is working:
WordPress multisite
For WordPress multisite networks:
For an end-to-end installation check, follow the WordPress analytics walkthrough. Once pageviews arrive, use the UTM campaign tracking guide to verify that a tagged visit and its conversion appear as expected.
Related
Need help with your WordPress integration? Contact us at support@databuddy.cc.
How is this guide?