Преглед изворни кода

Decides whether to use analytics after the analytics API has been given a chance to load.

j8
Lyubomir Marinov пре 10 година
родитељ
комит
ec954ad3cc
1 измењених фајлова са 5 додато и 1 уклоњено
  1. 5
    1
      modules/statistics/AnalyticsAdapter.js

+ 5
- 1
modules/statistics/AnalyticsAdapter.js Прегледај датотеку

@@ -1,3 +1,5 @@
1
+/* global config */
2
+
1 3
 var ScriptUtil = require('../util/ScriptUtil');
2 4
 
3 5
 // Load the integration of a third-party analytics API such as Google Analytics.
@@ -33,7 +35,9 @@ AnalyticsAdapter.prototype.sendEvent = function (action, data) {
33 35
   var a = this.analytics;
34 36
 
35 37
   if (a === null || typeof a === 'undefined') {
36
-      this.analytics = a = new (window.Analytics || NoopAnalytics)();
38
+      var AnalyticsImpl = window.Analytics || NoopAnalytics;
39
+
40
+      this.analytics = a = new AnalyticsImpl();
37 41
   }
38 42
   try {
39 43
       a.sendEvent.apply(a, arguments);

Loading…
Откажи
Сачувај