Chrome Console Shows Resource Loading Error for Analytics JavaScript File

I’ve been encountering a strange error in the developer console of Chrome while browsing different websites. It seems like the analytics script isn’t loading correctly.

To investigate further, I added error handling around the original tracking code to pinpoint the problem:

try {
  // Analytics tracking code
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
} catch(error) {
  console.log('Analytics loading failed:', error);
}

Interestingly, when I directly access the script URL on my browser, it loads without any issue. However, the console keeps reporting these loading errors. This is happening across various websites, not just the ones I manage. Although my analytics data seems relatively stable, I’m concerned about potentially missing critical information on visitor activity. Has anyone else experienced a similar problem?

I had the same console errors popping up everywhere. It turned out my router was blocking analytics domains through DNS filtering. The scripts couldn’t load even though I could access the URLs directly through different paths. Check if you’re using Pi-hole, OpenDNS with filtering, or if your ISP blocks content. Switching to Google DNS (8.8.8.8) temporarily might help determine if the errors stop. Corporate firewalls can do this as well, especially if you’re testing from work.

This usually happens because of browser extensions that block tracking stuff. Even if your adblocker looks disabled, most have specific settings that target analytics scripts while letting everything else through. I had the exact same console errors on multiple sites until I found out my privacy extension was blocking Google Analytics by default. The script URL works fine when you visit it directly because extensions only block embedded resources, not when you navigate there yourself. Open an incognito window with no extensions and see if the errors go away. If they do, turn extensions back on one by one to figure out which one’s causing the problem.

yep, sounds like an adblocker issue. they often block analytics scripts even if the main site loads fine. maybe check if uBlock Origin or similar is on - that could explain the errors across multiple sites.