-
Notifications
You must be signed in to change notification settings - Fork 0
/
jQuery.ddMetrics.min.js
12 lines (11 loc) · 1.47 KB
/
jQuery.ddMetrics.min.js
1
2
3
4
5
6
7
8
9
10
11
12
/**
* jQuery.ddMetrics
* @version 1.0 (2018-11-24)
*
* @see {@link README.md}
*
* @copyright 2018 [DivanDesign]{@link http://www.DivanDesign.biz }
*/
(function(c){c.ddMetrics={isInited:!1,beforeInitStack:[],countersData:{googleAnalytics:{isEnabled:!1},yandexMetrika:{isEnabled:!1,object:{},visitParams:{}}},reachGoal:function(a,b){a=c.trim(a);if(""!=a)if(this.isInited)this.countersData.yandexMetrika.isEnabled&&(c.isPlainObject(b)?this.countersData.yandexMetrika.object.reachGoal(a,b):this.countersData.yandexMetrika.object.reachGoal(a)),this.countersData.googleAnalytics.isEnabled&&ga("send","event","general",a);else{var d={name:a};c.isPlainObject(b)&&
(d.params=b);this.beforeInitStack.push(d)}},init:function(a){var b=this;a.yandexMetrika_isEnabled=c.isNumeric(a.yandexMetrika_counterId);(a.yandexMetrika_isEnabled&&"undefined"!=typeof window["yaCounter"+a.yandexMetrika_counterId]||!a.yandexMetrika_isEnabled)&&(a.googleAnalytics_isEnabled&&"undefined"!=typeof ga||!a.googleAnalytics_isEnabled)?(b.isInited=!0,a.yandexMetrika_isEnabled&&(b.countersData.yandexMetrika.isEnabled=a.yandexMetrika_isEnabled,b.countersData.yandexMetrika.object=window["yaCounter"+
a.yandexMetrika_counterId],b.countersData.yandexMetrika.object.params(b.countersData.yandexMetrika.visitParams)),b.countersData.googleAnalytics.isEnabled=!!a.googleAnalytics_isEnabled,c.each(b.beforeInitStack,function(){b.reachGoal(this.name,this.params)}),b.beforeInitStack=[]):setTimeout(function(){b.init(a)},500)}}})(jQuery);