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)

  1. Download the plugin from your Attribu dashboard (Settings > Tracking script > WordPress tab).
  2. In WordPress, go to Plugins → Add New → Upload Plugin and upload the .zip file.
  3. Click Install Now, then Activate.
  4. Go to Settings → Attribu in your WordPress admin.
  5. Paste your Website ID (found in your Attribu dashboard under Settings).
  6. Click Save Changes.
The plugin auto-detects your domain from your WordPress site URL. You only need to change the Domain field if your site uses a different public-facing domain.

WooCommerce support

If your store uses WooCommerce, Attribu can automatically track revenue from orders and attribute it to traffic sources.

Connect your store

  1. In your Attribu dashboard, go to Settings > Tracking script > WordPress tab.
  2. Toggle I'm using WooCommerce too.
  3. Enter your store URL and click Connect WooCommerce.
  4. You'll be redirected to your WordPress admin to approve the connection.
  5. Click Approve in WordPress. You'll be redirected back to Attribu.
This uses WordPress Application Passwords to securely authorize Attribu. No API keys to copy and paste.

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:

  1. Install WPCode or Insert Headers and Footers from the WordPress plugin directory.
  2. Go to Code Snippets → Header & Footer (or Settings → Insert Headers and Footers).
  3. 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>';
});
If you use a child theme, add the code to the child theme's 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

  1. Visit your WordPress site in an incognito/private window.
  2. Open your browser's Developer Tools → Network tab.
  3. Look for a request to /js/script.js and a POST to /api/events.
  4. 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.
Copied