How We Fixed Tracking and Recovered Campaign Data
The client reached out with a simple issue:
“Since March 6, Google Analytics shows 0 visitors. Campaigns are running.”
At first glance, this looks like a marketing problem.
In reality, it was a technical tracking failure.
🚨 Symptom
- Google Analytics (GA4) showed 0 visitors every day
- ads were running (Google Ads, likely social as well)
- the website was fully functional
- no visible frontend errors
👉 classic case: data is not being collected — not that it doesn’t exist
🔍 Diagnosis
A quick audit revealed:
- tracking was handled via plugin (MonsterInsights)
- the site used a cookie consent system (Complianz)
- the GA script was either blocked or fired incorrectly
👉 result:
Google Analytics either didn’t run at all, or ran outside proper consent
⚠️ Common Problem
Many WordPress sites rely on:
- an analytics plugin
- a cookie consent plugin
- a cache plugin
And these often:
👉 don’t communicate correctly
Result:
- tracking doesn’t fire at all
- or it fires illegally (without consent)
🛠️ Solution
We completely removed the plugin-based approach.
Instead, we implemented:
✅ Custom tracking script (gtag.js)
- full control over when tracking is triggered
✅ Proper integration with cookie consent (Complianz)
- tracking runs only after consent (statistics)
✅ Fallback for returning users
- if consent already exists → tracking runs immediately
💡 Implementation (simplified)
<script>
function loadGA() {
if (window.gaLoaded) return;
window.gaLoaded = true;
var script = document.createElement('script');
script.async = true;
script.src = "https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXX";
document.head.appendChild(script);
window.dataLayer = window.dataLayer || [];
function gtag(){ dataLayer.push(arguments); }
window.gtag = gtag;
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXX', {
anonymize_ip: true
});
}
document.addEventListener('cmplz_event_statistics', loadGA);
if (typeof cmplz_has_consent === 'function' && cmplz_has_consent('statistics')) {
loadGA();
}
</script>
🧪 Verification
Tested in:
- Chrome / Edge
- Firefox
- Incognito mode
Result:
| Status | Result |
|---|---|
| Before consent | ❌ no GA cookies |
| After consent | ✅ _ga cookies created |
| Network requests | ✅ only after consent |
👉 GDPR-compliant + fully working tracking
📈 Outcome for the Client
- Google Analytics tracking restored
- campaign data recovered
- plugin conflicts eliminated
- clean and controlled implementation
🧠 Takeaway
If GA shows 0:
👉 the problem is not traffic
👉 the problem is tracking
Most common causes:
- cookie consent blocking scripts
- plugin conflicts
- incorrect tracking implementation
🔧 Need it checked?
If:
- you’re missing analytics data
- you suspect broken tracking
- or want to ensure GDPR compliance
Tracking is not “adding a script”.
Tracking is data control.
More case studies
- Hacked WordPress Website (Drobčekovo) – Malware Cleanup Without Data Loss
- WordPress White Screen After PHP Upgrade – How I Fixed a Broken Website
About the Author
I’m Marián Kohn. I help businesses fix technical issues on WordPress and WooCommerce websites.
I specialize in fixing broken sites, improving performance, securing systems, and resolving issues that impact business.
When WordPress breaks, I help businesses fix it.