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 975B

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