Skip to content

Commit

Permalink
Simplify Google Analytics code, #70
Browse files Browse the repository at this point in the history
  • Loading branch information
tjjalava committed Aug 21, 2017
1 parent 4fece05 commit fee9c20
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/api/ga.js
Expand Up @@ -14,11 +14,7 @@
})(window, document, "script", "https://www.google-analytics.com/analytics.js", "ga");

let gaTrackingId = sizeme_options.gaTrackingId;

let gaEnabled = false;
ga(function () {
gaEnabled = gaTrackingId !== null;
});
let gaEnabled = gaTrackingId !== null;

let trackEvent = (action, label) => {
if (gaEnabled) {
Expand All @@ -32,6 +28,8 @@ let trackEvent = (action, label) => {
});
};
trackEvent(action, label);
} else {
trackEvent = () => {};
}
};

Expand Down

0 comments on commit fee9c20

Please sign in to comment.