Integrations

Wix

Add Databuddy's cookieless product analytics to your Wix website to track pageviews, 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:

html
<script
src="https://cdn.databuddy.cc/databuddy.js"
data-client-id="YOUR_CLIENT_ID"
crossorigin="anonymous"
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:

  • Tracking Tools & Analytics (under "Marketing & SEO" or a similar category)
  • Or, Custom Code (sometimes under "Advanced Settings")

To add custom code, you'll need a Wix Premium plan and a connected domain. This feature is typically not available on free Wix plans.

Add new custom code

Once in the Tracking Tools or Custom Code section:

  • Click on + New Tool or + Add Custom Code
  • Choose Custom from the list of options if prompted

Configure the custom code

You'll be presented with a form to add your code:

  • Paste your Databuddy tracking script into the main code snippet box
  • Name your code: Give it a recognizable name, like "Databuddy Analytics"
  • Add Code to Pages: Select All pages to track your entire site
    • You might have an option to Load code once or Load code on each new page. Choose the option that loads the script on every pageview
  • Place Code in: Choose Body - end. This is recommended for analytics scripts to avoid impacting perceived page load speed. Some Wix versions might offer "Head" or "Body - start" as well. "Body - end" is usually the best choice

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.

  • Open your Wix website in a new browser tab or incognito window
  • Navigate through a few pages
  • Check your Databuddy dashboard for incoming data. It might take a few minutes for the first events to appear

Configuration options

Enable additional tracking features by adding data attributes to your script tag:

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-web-vitals
data-track-errors
crossorigin="anonymous"
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:

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

Then add data-track attributes directly to elements in Wix:

html
<!-- 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:

javascript
<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:

javascript
<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>

Important Notes:

  • Wix may require a Premium plan to add custom code
  • Use setTimeout to ensure Wix has fully loaded before attaching event listeners
  • Always check if window.databuddy exists before calling tracking methods
  • Test thoroughly as Wix's page structure may vary

Common use cases

E-commerce tracking

Track product views and purchases:

javascript
// 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:

javascript
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

  • Verify the script is in the Body - end section of Custom Code
  • Check browser console for errors
  • Ensure your Client ID is correct
  • Confirm you have a Wix Premium plan with custom code enabled

Events not tracking

  • Confirm window.databuddy exists before calling tracking methods
  • Use setTimeout to wait for Wix to fully initialize
  • Check that elements exist before attaching event listeners
  • Verify events appear in your Databuddy dashboard after 2-3 minutes

Wix-specific issues

  • Wix may load pages dynamically, so ensure scripts run after page load
  • Some Wix elements may have dynamically generated IDs
  • Test in different browsers and devices
  • Clear Wix cache and republish your site if needed

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

How is this guide?