You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AnalyticsAdapter.js 980B

123456789101112131415161718192021222324252627
  1. var RTCBrowserType = require("../RTC/RTCBrowserType");
  2. function NoopAnalytics() {}
  3. NoopAnalytics.prototype.sendEvent = function () {};
  4. function AnalyticsAdapter() {
  5. this.browserActionSuffix = '.' + RTCBrowserType.getBrowserName();
  6. }
  7. // XXX Since we asynchronously load the integration of the analytics API and the
  8. // analytics API may asynchronously load its implementation (e.g. Google
  9. // Analytics), we cannot make the decision with respect to which analytics
  10. // implementation we will use here and we have to postpone it i.e. we will make
  11. // a lazy decision.
  12. AnalyticsAdapter.prototype.sendEvent = function (action, data)
  13. {
  14. if (this.analytics === null || typeof this.analytics === 'undefined') {
  15. var AnalyticsImpl = window.Analytics || NoopAnalytics;
  16. this.analytics = new AnalyticsImpl();
  17. }
  18. try {
  19. this.analytics.sendEvent(action + this.browserActionSuffix, data);
  20. } catch (ignored) {}
  21. };
  22. module.exports = new AnalyticsAdapter();