20 lines
338 B
JavaScript
20 lines
338 B
JavaScript
class NoopAnalytics {
|
|
sendEvent () {}
|
|
}
|
|
|
|
const AnalyticsImpl = window.Analytics || NoopAnalytics;
|
|
|
|
class AnalyticsAdapter {
|
|
constructor () {
|
|
this.analytics = new AnalyticsImpl();
|
|
}
|
|
|
|
sendEvent (...args) {
|
|
try {
|
|
this.analytics.sendEvent(...args);
|
|
} catch (ignored) {}
|
|
}
|
|
}
|
|
|
|
export default new AnalyticsAdapter();
|