-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 57 Continue to review full report at Codecov.
|
jstests/tests/test_analytics.js
Outdated
var result=[]; | ||
window.ga = function(cmd, id, auto) { | ||
result[0] = [cmd, id, auto]; | ||
}; | ||
window.apidata.analytics = undefined; | ||
var ga = analytics.init(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're not using ga
variable after that, just analytics.init();
is enough I think.
jstests/tests/test_analytics.js
Outdated
var result=[]; | ||
window.ga = function(cmd, id, auto) { | ||
result[0] = [cmd, id, auto]; | ||
}; | ||
window.apidata.analytics = {"tracking_id": "X"}; | ||
var ga = analytics.init(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahah ok :)
Fixes #369