2015-12-29 12:41:43 +00:00
|
|
|
class NoopAnalytics {
|
|
|
|
sendEvent () {}
|
2015-09-02 17:08:31 +00:00
|
|
|
}
|
|
|
|
|
2015-12-29 12:41:43 +00:00
|
|
|
const AnalyticsImpl = window.Analytics || NoopAnalytics;
|
|
|
|
|
|
|
|
class AnalyticsAdapter {
|
|
|
|
constructor () {
|
|
|
|
this.analytics = new AnalyticsImpl();
|
|
|
|
}
|
|
|
|
|
|
|
|
sendEvent (...args) {
|
|
|
|
try {
|
|
|
|
this.analytics.sendEvent(...args);
|
|
|
|
} catch (ignored) {}
|
|
|
|
}
|
|
|
|
}
|
2015-09-02 17:08:31 +00:00
|
|
|
|
2015-12-29 12:41:43 +00:00
|
|
|
export default new AnalyticsAdapter();
|