I am using require js to download Google Analytics. In config I have
requirejs.config({ "paths": { "ga": "//www.google-analytics.com/analytics", ...
And I have a module that depends on ga, which initializes the analytics.
Everything works fine until someone uses a browser plugin that blocks Google Analytics. When this happens, the resulting JavaScript error breaks everything.
- resource upload failed: blocked by client
- uncaught error: script error for: ga
How can I tell requirejs not have a match if some module fails to load? How to make the module optional?
Thanks.
javascript requirejs google-analytics
herostwist
source share