For over a decade, installing Google Analytics (GA) was the first thing every developer did after launching a website. It was automatic. It was the standard.
But the web has changed.
With the arrival of Google Analytics 4 (GA4), the tool has become a complex enterprise beast. It is difficult to use, aggressively data-hungry, and relies on heavy scripts (~45KB) that hurt your Core Web Vitals.
At AgilePress, we ask: Do you really need a Ferrari dashboard just to drive to the grocery store?
Most business owners just want to know: How many people visited? Where did they come from? Which pages did they read?
Here is the AgilePress approach to modern, high-performance analytics.
The AgilePress Default: Independent Analytics
For 95% of our projects, we have replaced Google with a lightweight, WordPress-native solution: Independent Analytics.
Why is this our #1 choice?
- Zero External Scripts: It runs entirely on your server. No data is sent to Google or third parties. This means your site loads instantly (0ms delay from external requests).
- No Cookie Banners (Legal Peace of Mind): Unlike GA4, it tracks visits server-side without planting cookies on the user’s device. This often means you don’t need a cookie consent banner, keeping your UX clean and your conversion rates high.
- You Own the Data: Your traffic data is stored in your own database, not on a tech giant’s server.
- It is Free: It creates no recurring monthly cost for your business.
It is the definition of Agile: Simple, fast, and effective.
The “Premium” Alternative: Plausible or Fathom
We are also fans of privacy-focused SaaS tools like Plausible or Fathom Analytics. They are fantastic, lightweight (<1KB script), and beautiful.
However, they come with a recurring monthly cost. We recommend them for high-traffic sites where we prefer to offload the analytics processing from the WordPress database. But for most SMBs, paying a monthly fee for simple stats is unnecessary when native solutions exist.
The “Mandatory” Scenario: Optimized GA4
Sometimes, you cannot escape Google. Perhaps you run Google Ads, or your marketing agency demands GA4 data for remarketing audiences.
In these cases, we still refuse to simply “copy and paste” the default tracking code provided by Google.
The Problem: The standard gtag.js library is heavy, sets short cache times (hurting PageSpeed scores), and executes unnecessary code for features you likely don’t use.
The Solution: “Minimal Analytics” (Open Source)
Instead of writing custom shaky code or installing heavy plugins, we rely on the Minimal Analytics 4 open-source project.
This is a community-maintained library that strips GA4 down to its bare essentials. It weighs less than 1.5KB (vs the 40KB+ of the official script) and sends data directly to Google’s servers without the bloat.
How we implement it:
We don’t paste code blindly. We enqueue the library properly in WordPress. Here is a snippet of how a modern implementation looks in functions.php:
PHP
<?php
/**
* AgilePress Optimized GA4
* Uses the 'Minimal Analytics 4' open-source library.
* * Benefits:
* 1. Hosted locally (browser caching enabled).
* 2. 95% smaller than the official tag.
* 3. Zero impact on Core Web Vitals.
*/
// Define your Measurement ID
if ( ! defined( 'AGILE_GA4_ID' ) ) {
define( 'AGILE_GA4_ID', 'G-YOUR-ID-HERE' );
}
function agilepress_load_minimal_analytics() {
// 1. Only load for visitors (not admins)
if ( is_user_logged_in() || ! defined( 'AGILE_GA4_ID' ) ) {
return;
}
// 2. Load the lightweight library from a trusted CDN or your local server
// We use a specific version to ensure stability.
wp_enqueue_script(
'minimal-analytics',
'https://cdn.jsdelivr.net/npm/@minimal-analytics/ga4/dist/index.js',
array(),
'1.0.0',
true // Load in footer
);
// 3. Initialize with your ID
wp_add_inline_script( 'minimal-analytics', "window.minimalAnalytics?.({ trackingId: '" . AGILE_GA4_ID . "', autoTrack: true });" );
}
add_action( 'wp_enqueue_scripts', 'agilepress_load_minimal_analytics' );
Note: For production sites, we download this script and host it locally to avoid dependency on external CDNs.
⚠️ A Crucial Note on GDPR
Even with this ultra-light script, if you track users in the EU, you still need a Cookie Banner to be 100% compliant, as Google processes the data.
This brings us back to our first point: Complexity has a cost.
If you want to avoid the banner, avoid the legal headache, and have the fastest possible site, the answer isn’t to optimize Google Analytics. The answer is to use Independent Analytics.
Conclusion: Data Should Clarify, Not Confuse
Analytics are supposed to help you make business decisions.
If you log into your dashboard and feel overwhelmed by graphs you don’t understand, or if your analytics tool requires you to annoy your users with pop-ups, it is a liability.
At AgilePress, we choose tools that provide clarity at a glance. Whether it is the native power of Independent Analytics or a robust implementation of Minimal Analytics, our goal is the same: accurate data, zero performance cost, and total respect for your users.