Improve robustness of analytics.isAvailable

Fixes GitbookIO/javascript#18

Safari has issues with loading mixpanel, this adds and extra check so
Safari doesn’t fail on event tracking
This commit is contained in:
Aaron O'Mullan
2014-04-05 12:47:49 -07:00
parent 4850c0f302
commit 959a2d830a
2 changed files with 5 additions and 2 deletions
+4 -1
View File
@@ -9,7 +9,10 @@ define([
});
var isAvailable = function() {
return (typeof mixpanel !== "undefined");
return (
typeof mixpanel !== "undefined" &&
typeof mixpanel.track === "function"
);
};
var track = function(e, data) {