WordPress installation
Install the Attribu WordPress plugin to automatically inject the tracking script on every page. If you use WooCommerce, the plugin also tracks add-to-cart, checkout, and order events for revenue attribution.
Method 1: Attribu Plugin (recommended)
- Download the plugin from your Attribu dashboard (Settings > Tracking script > WordPress tab).
- In WordPress, go to Plugins → Add New → Upload Plugin and upload the
.zipfile. - Click Install Now, then Activate.
- Go to Settings → Attribu in your WordPress admin.
- Paste your Website ID (found in your Attribu dashboard under Settings).
- Click Save Changes.
WooCommerce support
If your store uses WooCommerce, Attribu can automatically track revenue from orders and attribute it to traffic sources.
Connect your store
- In your Attribu dashboard, go to Settings > Tracking script > WordPress tab.
- Toggle I'm using WooCommerce too.
- Enter your store URL and click Connect WooCommerce.
- You'll be redirected to your WordPress admin to approve the connection.
- Click Approve in WordPress. You'll be redirected back to Attribu.
What gets tracked
Once connected, the plugin automatically tracks:
- Add to cart events with product name, price, and quantity
- Remove from cart events
- Initiate checkout with cart total, discount, and product names
- Completed orders with full revenue attribution to traffic sources
Existing completed orders are also imported when you first connect.
Method 2: Header/Footer plugin
If you prefer not to install the Attribu plugin, you can use any header/footer plugin:
- Install WPCode or Insert Headers and Footers from the WordPress plugin directory.
- Go to Code Snippets → Header & Footer (or Settings → Insert Headers and Footers).
- Paste the tracking script in the Header section:
<script
defer
data-website-id="YOUR_SITE_ID"
data-domain="yourdomain.com"
src="https://attribu.tech/js/script.js"
></script>Method 3: functions.php
Add the script directly to your theme by editing functions.php:
// Add to your theme's functions.php:
add_action('wp_head', function() {
echo '<script defer
data-website-id="YOUR_SITE_ID"
data-domain="yourdomain.com"
src="https://attribu.tech/js/script.js"></script>';
});functions.php so it survives theme updates.Self-hosted instances
If you are self-hosting Attribu, change the Attribu URL field in the plugin settings to point to your instance (e.g. https://analytics.yourdomain.com). The plugin will load the tracking script from that URL instead.
Verifying installation
- Visit your WordPress site in an incognito/private window.
- Open your browser's Developer Tools → Network tab.
- Look for a request to
/js/script.jsand a POST to/api/events. - Check your Attribu dashboard. A new pageview should appear within a few seconds.
Troubleshooting
- No data appearing? Make sure the Website ID matches exactly (copy-paste from your dashboard).
- Caching plugins may cache the page without the script. Clear your cache after installing.
- Security plugins (Wordfence, Sucuri) may block external scripts. Whitelist your Attribu domain.
- Localhost is ignored by default. Enable "Allow localhost debugging" in your dashboard if testing locally.