diff --git a/corehq/apps/analytics/static/analytix/js/gtm.js b/corehq/apps/analytics/static/analytix/js/gtm.js index d6684ebbbd025..720c502785c34 100644 --- a/corehq/apps/analytics/static/analytix/js/gtm.js +++ b/corehq/apps/analytics/static/analytix/js/gtm.js @@ -32,13 +32,15 @@ hqDefine('analytix/js/gtm', [ var data = { event: eventName, }; - if (eventData){ + if (eventData) { _.extend(data, eventData); } window.dataLayer.push(data); - _logger.verbose.log(eventName, ['window.dataLayer.push']); + _logger.verbose.log(eventName, 'window.dataLayer.push'); }).fail(function () { - callbackFn(); + if (_.isFunction(callbackFn)) { + callbackFn(); + } }); };