When my react.min,js file loads onto the client, Im receiving this error:
GET https://www.google-analytics.com/analytics.js net::ERR_BLOCKED_BY_CLIENT
(anonymous) @ react.min.js:59317
initialize @ react.min.js:59318
(anonymous) @ react.min.js:74
__webpack_require__ @ react.min.js:20
(anonymous) @ react.min.js:40
(anonymous) @ react.min.js:43
snippet of react-ga code throwing the error
// https://developers.google.com/analytics/devguides/collection/analyticsjs/
// jscs:disable
(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);//THIS LINE THROWS THE ERROR
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
// jscs:enable
Thxs for any assistances
Your network might have blacklisted https://www.google-analytics.com. This has nothing to do with React GA.
I checked its not blocked on my network. Im also able to import google-analytics using pure js, its only when using react-ga i have this issue.
Are you using AdBlock?
no, however it does appear to be a chrome only issue. so react-ga might not be at fault as you said. it works as expected in Firefox.
I confirm that after turning off my ad blocker, the library works normally
The ad blocker that I'm using is Windscribe - Free Proxy and Ad Blocker
I had to turn off ublock origin and it fixed the issue.
extension chrome duckduckgo block this.
Most helpful comment
Are you using AdBlock?