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

This commit is contained in:
Lyubomir Marinov 2016-01-15 15:42:04 +02:00
parent b49a08c485
commit ec954ad3cc
1 changed files with 5 additions and 1 deletions

View File

@ -1,3 +1,5 @@
/* global config */
var ScriptUtil = require('../util/ScriptUtil');
// 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;
if (a === null || typeof a === 'undefined') {
this.analytics = a = new (window.Analytics || NoopAnalytics)();
var AnalyticsImpl = window.Analytics || NoopAnalytics;
this.analytics = a = new AnalyticsImpl();
}
try {
a.sendEvent.apply(a, arguments);