Decides whether to use analytics after the analytics API has been given a chance to load.
This commit is contained in:
parent
b49a08c485
commit
ec954ad3cc
|
@ -1,3 +1,5 @@
|
||||||
|
/* global config */
|
||||||
|
|
||||||
var ScriptUtil = require('../util/ScriptUtil');
|
var ScriptUtil = require('../util/ScriptUtil');
|
||||||
|
|
||||||
// Load the integration of a third-party analytics API such as Google Analytics.
|
// Load the integration of a third-party analytics API such as Google Analytics.
|
||||||
|
@ -33,7 +35,9 @@ AnalyticsAdapter.prototype.sendEvent = function (action, data) {
|
||||||
var a = this.analytics;
|
var a = this.analytics;
|
||||||
|
|
||||||
if (a === null || typeof a === 'undefined') {
|
if (a === null || typeof a === 'undefined') {
|
||||||
this.analytics = a = new (window.Analytics || NoopAnalytics)();
|
var AnalyticsImpl = window.Analytics || NoopAnalytics;
|
||||||
|
|
||||||
|
this.analytics = a = new AnalyticsImpl();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
a.sendEvent.apply(a, arguments);
|
a.sendEvent.apply(a, arguments);
|
||||||
|
|
Loading…
Reference in New Issue