← All IntegrationsIntegration

Analytics for WordPress

WordPress powers over 40% of the web, but Google Analytics adds 45KB+ of JavaScript and requires cookie consent banners. BetterMeter replaces it with a sub-1KB tracker, no cookies, no plugin dependencies, and AI traffic detection that GA doesn't offer.

Add via functions.php

The WordPress way to add scripts is through wp_enqueue_scriptin your theme's functions.php. This ensures the script loads on every page and survives theme updates if you use a child theme.

functions.php
add_action('wp_enqueue_scripts', function() {
    wp_enqueue_script(
        'bettermeter',
        'https://bettermeter.com/api/script',
        [],
        null,
        ['strategy' => 'defer']
    );
});

// Add the data-site attribute via script_loader_tag filter
add_filter('script_loader_tag', function($tag, $handle) {
    if ('bettermeter' === $handle) {
        return str_replace(' src', ' data-site="your-domain.com" src', $tag);
    }
    return $tag;
}, 10, 2);

Or paste in header/footer injection

Most WordPress themes and page builders (Elementor, Divi, GeneratePress) have a "header scripts" or "footer scripts" field in their settings. Paste the script tag directly — no code editing required.

Paste in theme footer scripts
<script defer data-site="your-domain.com" src="https://bettermeter.com/api/script"></script>

Why switch from Google Analytics

  • 01 No cookies — BetterMeter uses no cookies, so you can remove cookie consent banners. GDPR, CCPA, and PECR compliant out of the box.
  • 02 45x smaller — Google Analytics is 45KB+. BetterMeter is under 1KB. Your Core Web Vitals improve immediately.
  • 03 AI traffic detection — See when ChatGPT, Claude, or Perplexity reference your WordPress content. Google Analytics can't do this.
  • 04 Bot separation — Crawlers and bots are tracked separately, so your human visitor counts stay accurate.
  • 05 No plugin bloat — No WordPress plugin to install, update, or worry about security vulnerabilities. Just a script tag.

WooCommerce and theme compatibility

BetterMeter works with every WordPress theme and plugin — including WooCommerce. Track product page views, checkout flows, and cart interactions with custom events. The tracker loads independently of WordPress's PHP execution, so it works on cached pages, CDN-served content, and WP Super Cache or W3 Total Cache setups.

No Plugin
Just a script tag
No Cookies
Remove consent banners
WooCommerce
Track store pages
Cache Friendly
Works with any cache plugin
AI Traffic
GPT, Claude, Perplexity
45x Smaller
vs Google Analytics