Wix
Add Databuddy's privacy-first analytics to your Wix website to track page views, user interactions, and gather insights about your visitors.
How to Add Databuddy to Wix
Get Your Tracking Script
Get your Databuddy tracking script from your Databuddy dashboard. It will look like this:
<script
src="https://cdn.databuddy.cc/databuddy.js"
data-client-id="YOUR_CLIENT_ID"
async
></script>Replace YOUR_CLIENT_ID with your actual Client ID from your Databuddy dashboard.
Go to Wix Dashboard
Log in to your Wix account and select the site you want to track.
From your site's dashboard, navigate to Settings (usually in the left-hand sidebar).
Access Tracking Tools
In the Settings menu, look for a section related to tracking or advanced settings. This is often called:
Add New Custom Code
Once in the Tracking Tools or Custom Code section:
Configure the Custom Code
You'll be presented with a form to add your code:
Apply Changes
Click Apply or Save to add the custom code to your site.
Verify Integration
After applying the changes, Databuddy should start tracking visitors on your Wix site.
Configuration Options
Enable additional tracking features by adding data attributes to your script tag:
<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
async
></script>Custom Event Tracking in Wix
Track custom events in Wix by adding JavaScript code through the Custom Code section or using Wix's built-in code elements.
Using Data Attributes
Enable automatic tracking with data attributes:
<script
src="https://cdn.databuddy.cc/databuddy.js"
data-client-id="YOUR_CLIENT_ID"
data-track-attributes
async
></script>Then add data-track attributes directly to elements in Wix:
<!-- Button with automatic tracking -->
<button data-track="cta_click" data-button-type="primary">
Get Started
</button>
<!-- Link with tracking -->
<a href="/pricing" data-track="pricing_link_click" data-link-location="header">
View Pricing
</a>Tracking Button Clicks with Custom Code
Add custom JavaScript to track specific button interactions:
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function() {
// Wait for Wix to fully load
setTimeout(function() {
var button = document.getElementById('your-button-id');
if (button && window.databuddy) {
button.addEventListener('click', function() {
window.databuddy.track('button_click', {
button_id: 'your-button-id',
button_text: button.textContent || button.innerText,
page_path: window.location.pathname
});
});
}
}, 1000); // Adjust delay if needed for Wix to initialize
});
</script>Tracking Form Submissions
Track form submissions from Wix forms:
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function() {
setTimeout(function() {
var form = document.querySelector('form[data-name="ContactForm"]');
if (form && window.databuddy) {
form.addEventListener('submit', function() {
window.databuddy.track('form_submit', {
form_type: 'contact',
page_path: window.location.pathname
});
});
}
}, 1000);
});
</script>Common Use Cases
E-commerce Tracking
Track product views and purchases:
// Track product view
if (window.databuddy) {
window.databuddy.track('product_view', {
product_id: 'product-123',
product_name: 'Example Product',
price: 29.99
});
}
// Track add to cart
window.databuddy.track('add_to_cart', {
product_id: 'product-123',
quantity: 1
});Newsletter Signups
Track newsletter subscriptions:
document.addEventListener('DOMContentLoaded', function() {
setTimeout(function() {
var newsletterForm = document.querySelector('form[data-name="NewsletterForm"]');
if (newsletterForm && window.databuddy) {
newsletterForm.addEventListener('submit', function() {
window.databuddy.track('newsletter_signup', {
form_location: 'footer',
page_path: window.location.pathname
});
});
}
}, 1000);
});Troubleshooting
Script Not Loading
Events Not Tracking
Wix-Specific Issues
Related Integrations
Need help with your Wix integration? Contact us at help@databuddy.cc.
How is this guide?