Migrating and isolating google analytics to tolerate failure to load#379
Conversation
Codecov Report
@@ Coverage Diff @@
## master #379 +/- ##
======================================
Coverage 95.3% 95.3%
======================================
Files 92 92
Lines 3941 3941
Branches 255 255
======================================
Hits 3756 3756
Misses 128 128
Partials 57 57Continue to review full report at Codecov.
|
| result[0] = [cmd, id, auto]; | ||
| }; | ||
| window.apidata.analytics = undefined; | ||
| var ga = analytics.init(); |
There was a problem hiding this comment.
You're not using ga variable after that, just analytics.init(); is enough I think.
| result[0] = [cmd, id, auto]; | ||
| }; | ||
| window.apidata.analytics = {"tracking_id": "X"}; | ||
| var ga = analytics.init(); |
| if (window.apidata.analytics !== undefined) { | ||
| window.ga('create', window.apidata.analytics.tracking_id, 'auto'); | ||
| } else { | ||
| window.ga = function () { |
There was a problem hiding this comment.
I think window.ga = function () { return; } and window.ga = function () {}; will have the same effect but for the second option jslint would complain about empty brackets
There was a problem hiding this comment.
pycharm complains for the exact opposite reason. It claims return is unnecessary.
by the way, I use jshint, not jslint (jslint is the one by Douglas Crockford IIRC, and while I respect the guy, I think his linter is a bit excessive)
Fixes #369