From b5322840862450dc3c783f07aadb7fe980b3eea5 Mon Sep 17 00:00:00 2001 From: Julien Bouquillon Date: Thu, 22 Jan 2015 09:37:37 +0100 Subject: [PATCH] chore: bump version --- bower.json | 2 +- dist/angular-google-analytics.js | 51 +++++++++++++++++++++++++--- dist/angular-google-analytics.min.js | 4 +-- package.json | 2 +- 4 files changed, 51 insertions(+), 8 deletions(-) diff --git a/bower.json b/bower.json index 781f11d..da942f9 100644 --- a/bower.json +++ b/bower.json @@ -2,7 +2,7 @@ "author": "revolunet", "name": "angular-google-analytics", "description": "Easy Analytics for your AngularJS application", - "version": "0.0.9", + "version": "0.0.10", "homepage": "https://github.com/revolunet/angular-google-analytics", "repository": { "type": "git", diff --git a/dist/angular-google-analytics.js b/dist/angular-google-analytics.js index 0846e8a..16db71b 100644 --- a/dist/angular-google-analytics.js +++ b/dist/angular-google-analytics.js @@ -1,6 +1,6 @@ /** * Angular Google Analytics - Easy tracking for your AngularJS application - * @version v0.0.9 - 2014-11-24 + * @version v0.0.10 - 2015-01-22 * @link http://github.com/revolunet/angular-google-analytics * @author Julien Bouquillon * @license MIT License, http://www.opensource.org/licenses/MIT @@ -174,6 +174,18 @@ angular.module('angular-google-analytics', []) created = true; } + function _generateCommandName(commandName, config) { + if (!angular.isUndefined(config) && 'name' in config && config.name) { + return config.name + '.' + commandName; + } else { + return commandName; + } + } + + function _checkOption(key, config) { + return key in config && config[key]; + } + function _createAnalyticsScriptTag() { if (!accountId) { me._log('warn', 'No account id set to create analytics script tag'); @@ -188,7 +200,30 @@ angular.module('angular-google-analytics', []) if (angular.isArray(accountId)) { accountId.forEach(function (trackerObj) { - $window.ga('create', trackerObj.tracker, cookieConfig, { name: trackerObj.name }); + var _cookieConfig = 'cookieConfig' in trackerObj ? trackerObj.cookieConfig : cookieConfig; + var options; + if (_checkOption('crossDomainLinker', trackerObj)) { + trackerObj.allowLinker = trackerObj.crossDomainLinker; + } + angular.forEach(['name', 'allowLinker'], function(key) { + if (key in trackerObj) { + if (angular.isUndefined(options)) { + options = {}; + } + options[key] = trackerObj[key]; + } + }); + if (angular.isUndefined(options)) { + $window.ga('create', trackerObj.tracker, _cookieConfig); + } else { + $window.ga('create', trackerObj.tracker, _cookieConfig, options); + } + if (options && 'allowLinker' in options && options.allowLinker) { + $window.ga(_generateCommandName('require', trackerObj), 'linker'); + if (_checkOption('crossLinkDomains', trackerObj)) { + $window.ga(_generateCommandName('linker:autoLink', trackerObj), trackerObj.crossLinkDomains); + } + } }); } else if (crossDomainLinker) { $window.ga('create', accountId, cookieConfig, linkerConfig); @@ -281,7 +316,7 @@ angular.module('angular-google-analytics', []) _analyticsJs(function () { if (angular.isArray(accountId)) { accountId.forEach(function (trackerObj) { - $window.ga(trackerObj.name + '.send', 'pageview', { + $window.ga(_generateCommandName('send', trackerObj), 'pageview', { 'page': trackPrefix + url, 'title': title }); @@ -314,7 +349,15 @@ angular.module('angular-google-analytics', []) that._log('trackEvent', args); }); _analyticsJs(function () { - $window.ga('send', 'event', category, action, label, value); + if (angular.isArray(accountId)) { + accountId.forEach(function (trackerObj) { + if (_checkOption('trackEvent', trackerObj)) { + $window.ga(_generateCommandName('send', trackerObj), 'event', category, action, label, value); + } + }); + } else { + $window.ga('send', 'event', category, action, label, value); + } that._log('event', args); }); }; diff --git a/dist/angular-google-analytics.min.js b/dist/angular-google-analytics.min.js index 68ee837..d635dc8 100644 --- a/dist/angular-google-analytics.min.js +++ b/dist/angular-google-analytics.min.js @@ -1,8 +1,8 @@ /** * Angular Google Analytics - Easy tracking for your AngularJS application - * @version v0.0.9 - 2014-11-24 + * @version v0.0.10 - 2015-01-22 * @link http://github.com/revolunet/angular-google-analytics * @author Julien Bouquillon * @license MIT License, http://www.opensource.org/licenses/MIT */ -"use strict";angular.module("angular-google-analytics",[]).provider("Analytics",function(){var e,t,n,i,c,a,o=!1,r=!0,s="",u=!1,d="$routeChangeSuccess",l="auto",g=!1,m=!1,_=!1,h=!1,f=!1,p={allowLinker:!0};this._logs=[],this.setAccount=function(t){return e=t,!0},this.trackPages=function(e){return r=e,!0},this.trackPrefix=function(e){return s=e,!0},this.setDomainName=function(e){return n=e,!0},this.useDisplayFeatures=function(e){return t=!!e,!0},this.useAnalytics=function(e){return u=!!e,!0},this.useEnhancedLinkAttribution=function(e){return _=!!e,!0},this.useCrossDomainLinker=function(e){return f=!!e,!0},this.setCrossLinkDomains=function(e){return a=e,!0},this.setPageEvent=function(e){return d=e,!0},this.setCookieConfig=function(e){return l=e,!0},this.useECommerce=function(e,t){return g=!!e,m=!!t,!0},this.setRemoveRegExp=function(e){return e instanceof RegExp?(i=e,!0):!1},this.setExperimentId=function(e){return c=e,!0},this.ignoreFirstPageLoad=function(e){return h=!!e,!0},this.$get=["$document","$location","$log","$rootScope","$window",function(k,v,E,w,y){function A(e){!u&&y._gaq&&"function"==typeof e&&e()}function P(e){u&&y.ga&&"function"==typeof e&&e()}function b(){if(!e)return C._log("warn","No account id set to create script tag"),void 0;y._gaq=[],y._gaq.push(["_setAccount",e]),n&&y._gaq.push(["_setDomainName",n]),_&&y._gaq.push(["_require","inpage_linkid","//www.google-analytics.com/plugins/ga/inpage_linkid.js"]),r&&!h&&(i?y._gaq.push(["_trackPageview",T()]):y._gaq.push(["_trackPageview"]));var c;c=t?("https:"===document.location.protocol?"https://":"http://")+"stats.g.doubleclick.net/dc.js":("https:"===document.location.protocol?"https://ssl":"http://www")+".google-analytics.com/ga.js",function(){var e=k[0],t=e.createElement("script");t.type="text/javascript",t.async=!0,t.src=c;var n=e.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n)}(c),o=!0}function q(){if(!e)return C._log("warn","No account id set to create analytics script tag"),void 0;if(function(e,t,n,i,c,a,o){e.GoogleAnalyticsObject=c,e[c]=e[c]||function(){(e[c].q=e[c].q||[]).push(arguments)},e[c].l=1*new Date,a=t.createElement(n),o=t.getElementsByTagName(n)[0],a.async=1,a.src=i,o.parentNode.insertBefore(a,o)}(window,document,"script","//www.google-analytics.com/analytics.js","ga"),angular.isArray(e)?e.forEach(function(e){y.ga("create",e.tracker,l,{name:e.name})}):f?(y.ga("create",e,l,p),y.ga("require","linker"),a&&y.ga("linker:autoLink",a)):y.ga("create",e,l),t&&y.ga("require","displayfeatures"),r&&!h&&y.ga("send","pageview",T()),y.ga&&(g&&(m?y.ga("require","ec","ec.js"):y.ga("require","ecommerce","ecommerce.js")),_&&y.ga("require","linkid","linkid.js"),c)){var n=document.createElement("script"),i=document.getElementsByTagName("script")[0];n.src="//www.google-analytics.com/cx/api.js?experiment="+c,i.parentNode.insertBefore(n,i)}}var C=this,T=function(){var e=v.path();return i?e.replace(i,""):e};return this._log=function(){arguments.length>0&&(arguments.length>1&&"warn"===arguments[0]&&E.warn(Array.prototype.slice.call(arguments,1)),this._logs.push(arguments))},this._ecommerceEnabled=function(){return g?m?(this._log("warn","Enhanced ecommerce plugin is enabled. Only one plugin(ecommerce/ec) can be used at a time. Use AnalyticsProvider.setECommerce(true, false);"),!1):!0:(this._log("warn","ecommerce not set. Use AnalyticsProvider.setECommerce(true, false);"),!1)},this._enhancedEcommerceEnabled=function(){return g?m?!0:(this._log("warn","Enhanced ecommerce plugin is disabled. Use AnalyticsProvider.setECommerce(true, true);"),!1):(this._log("warn","ecommerce not set. Use AnalyticsProvider.setECommerce(true, true);"),!1)},this._trackPage=function(t,n){var i=this,c=arguments;t=t?t:T(),n=n?n:k[0].title,A(function(){y._gaq.push(["_set","title",n]),y._gaq.push(["_trackPageview",s+t]),i._log("_trackPageview",t,n,c)}),P(function(){angular.isArray(e)?e.forEach(function(e){y.ga(e.name+".send","pageview",{page:s+t,title:n})}):y.ga("send","pageview",{page:s+t,title:n}),i._log("pageview",t,n,c)})},this._trackEvent=function(e,t,n,i,c){var a=this,o=arguments;A(function(){y._gaq.push(["_trackEvent",e,t,n,i,!!c]),a._log("trackEvent",o)}),P(function(){y.ga("send","event",e,t,n,i),a._log("event",o)})},this._addTrans=function(e,t,n,i,c,a,o,r,s){var u=this,d=arguments;A(function(){y._gaq.push(["_addTrans",e,t,n,i,c,a,o,r]),u._log("_addTrans",d)}),P(function(){u._ecommerceEnabled()&&(y.ga("ecommerce:addTransaction",{id:e,affiliation:t,revenue:n,tax:i,shipping:c,currency:s||"USD"}),u._log("ecommerce:addTransaction",d))})},this._addItem=function(e,t,n,i,c,a){var o=this,r=arguments;A(function(){y._gaq.push(["_addItem",e,t,n,i,c,a]),o._log("_addItem",r)}),P(function(){o._ecommerceEnabled()&&(y.ga("ecommerce:addItem",{id:e,name:n,sku:t,category:i,price:c,quantity:a}),o._log("ecommerce:addItem",r))})},this._trackTrans=function(){var e=this,t=arguments;A(function(){y._gaq.push(["_trackTrans"]),e._log("_trackTrans",t)}),P(function(){e._ecommerceEnabled()&&(y.ga("ecommerce:send"),e._log("ecommerce:send",t))})},this._clearTrans=function(){var e=this,t=arguments;P(function(){e._ecommerceEnabled()&&(y.ga("ecommerce:clear"),e._log("ecommerce:clear",t))})},this._addProduct=function(e,t,n,i,c,a,o,r,s){var u=this,d=arguments;A(function(){y._gaq.push(["_addProduct",e,t,n,i,c,a,o,r,s]),u._log("_addProduct",d)}),P(function(){u._enhancedEcommerceEnabled()&&(y.ga("ec:addProduct",{id:e,name:t,category:n,brand:i,variant:c,price:a,quantity:o,coupon:r,position:s}),u._log("ec:addProduct",d))})},this._addImpression=function(e,t,n,i,c,a,o,r){var s=this,u=arguments;A(function(){y._gaq.push(["_addImpression",e,t,n,i,c,a,o,r]),s._log("_addImpression",u)}),P(function(){s._enhancedEcommerceEnabled()&&y.ga("ec:addImpression",{id:e,name:t,category:c,brand:i,variant:a,list:n,position:o,price:r}),s._log("ec:addImpression",u)})},this._addPromo=function(e,t,n,i){var c=this,a=arguments;A(function(){y._gaq.push(["_addPromo",e,t,n,i]),c._log("_addPromo",arguments)}),P(function(){c._enhancedEcommerceEnabled()&&(y.ga("ec:addPromo",{id:e,name:t,creative:n,position:i}),c._log("ec:addPromo",a))})},this._getActionFieldObject=function(e,t,n,i,c,a,o,r,s){var u={};return e&&(u.id=e),t&&(u.affiliation=t),n&&(u.revenue=n),i&&(u.tax=i),c&&(u.shipping=c),a&&(u.coupon=a),o&&(u.list=o),r&&(u.step=r),s&&(u.option=s),u},this._setAction=function(e,t){var n=this,i=arguments;A(function(){y._gaq.push(["_setAction",e,t]),n._log("__setAction",i)}),P(function(){n._enhancedEcommerceEnabled()&&(y.ga("ec:setAction",e,t),n._log("ec:setAction",i))})},this._trackTransaction=function(e,t,n,i,c,a,o,r,s){this._setAction("purchase",this._getActionFieldObject(e,t,n,i,c,a,o,r,s)),this._pageView()},this._trackRefund=function(e){this._setAction("refund",this._getActionFieldObject(e)),this._pageView()},this._trackCheckOut=function(e,t){this._setAction("checkout",this._getActionFieldObject(null,null,null,null,null,null,null,e,t)),this._pageView()},this._trackCart=function(e){-1!==["add","remove"].indexOf(e)&&(this._setAction(e),this._send("event","UX","click",e+"to cart"))},this._promoClick=function(e){this._setAction("promo_click"),this._send("event","Internal Promotions","click",e)},this._productClick=function(e){this._setAction("click",this._getActionFieldObject(null,null,null,null,null,null,e,null,null)),this._send("event","UX","click",e)},this._send=function(e){var t=this;P(function(){y.ga("send",e),t._log("send",e)})},this._pageView=function(){this._send("pageview")},this._set=function(e,t){var n=this;P(function(){y.ga("set",e,t),n._log("set",e,t)})},u?q():b(),r&&w.$on(d,function(){C._trackPage()}),{_logs:C._logs,cookieConfig:l,displayFeatures:t,ecommerce:g,enhancedEcommerce:m,enhancedLinkAttribution:_,getUrl:T,experimentId:c,ignoreFirstPageLoad:h,ecommerceEnabled:function(){return C._ecommerceEnabled()},enhancedEcommerceEnabled:function(){return C._enhancedEcommerceEnabled()},trackPage:function(e,t){C._trackPage(e,t)},trackEvent:function(e,t,n,i,c){C._trackEvent(e,t,n,i,c)},addTrans:function(e,t,n,i,c,a,o,r,s){C._addTrans(e,t,n,i,c,a,o,r,s)},addItem:function(e,t,n,i,c,a){C._addItem(e,t,n,i,c,a)},trackTrans:function(){C._trackTrans()},clearTrans:function(){C._clearTrans()},addProduct:function(e,t,n,i,c,a,o,r,s){C._addProduct(e,t,n,i,c,a,o,r,s)},addPromo:function(e,t,n,i){C._addPromo(e,t,n,i)},addImpression:function(e,t,n,i,c,a,o,r){C._addImpression(e,t,n,i,c,a,o,r)},productClick:function(e){C._productClick(e)},promoClick:function(e){C._promoClick(e)},trackDetail:function(){C._setAction("detail"),C._pageView()},trackCart:function(e){C._trackCart(e)},trackCheckout:function(e,t){C._trackCheckOut(e,t)},trackTransaction:function(e,t,n,i,c,a,o,r,s){C._trackTransaction(e,t,n,i,c,a,o,r,s)},setAction:function(e,t){C._setAction(e,t)},send:function(e){C._send(e)},pageView:function(){C._pageView()},set:function(e,t){C._set(e,t)}}}]}); \ No newline at end of file +"use strict";angular.module("angular-google-analytics",[]).provider("Analytics",function(){var e,n,t,i,a,c,o=!1,r=!0,s="",u=!1,l="$routeChangeSuccess",d="auto",g=!1,m=!1,_=!1,f=!1,h=!1,p={allowLinker:!0};this._logs=[],this.setAccount=function(n){return e=n,!0},this.trackPages=function(e){return r=e,!0},this.trackPrefix=function(e){return s=e,!0},this.setDomainName=function(e){return t=e,!0},this.useDisplayFeatures=function(e){return n=!!e,!0},this.useAnalytics=function(e){return u=!!e,!0},this.useEnhancedLinkAttribution=function(e){return _=!!e,!0},this.useCrossDomainLinker=function(e){return h=!!e,!0},this.setCrossLinkDomains=function(e){return c=e,!0},this.setPageEvent=function(e){return l=e,!0},this.setCookieConfig=function(e){return d=e,!0},this.useECommerce=function(e,n){return g=!!e,m=!!n,!0},this.setRemoveRegExp=function(e){return e instanceof RegExp?(i=e,!0):!1},this.setExperimentId=function(e){return a=e,!0},this.ignoreFirstPageLoad=function(e){return f=!!e,!0},this.$get=["$document","$location","$log","$rootScope","$window",function(k,v,E,w,y){function A(e){!u&&y._gaq&&"function"==typeof e&&e()}function P(e){u&&y.ga&&"function"==typeof e&&e()}function b(){if(!e)return I._log("warn","No account id set to create script tag"),void 0;y._gaq=[],y._gaq.push(["_setAccount",e]),t&&y._gaq.push(["_setDomainName",t]),_&&y._gaq.push(["_require","inpage_linkid","//www.google-analytics.com/plugins/ga/inpage_linkid.js"]),r&&!f&&(i?y._gaq.push(["_trackPageview",L()]):y._gaq.push(["_trackPageview"]));var a;a=n?("https:"===document.location.protocol?"https://":"http://")+"stats.g.doubleclick.net/dc.js":("https:"===document.location.protocol?"https://ssl":"http://www")+".google-analytics.com/ga.js",function(){var e=k[0],n=e.createElement("script");n.type="text/javascript",n.async=!0,n.src=a;var t=e.getElementsByTagName("script")[0];t.parentNode.insertBefore(n,t)}(a),o=!0}function q(e,n){return!angular.isUndefined(n)&&"name"in n&&n.name?n.name+"."+e:e}function C(e,n){return e in n&&n[e]}function T(){if(!e)return I._log("warn","No account id set to create analytics script tag"),void 0;if(function(e,n,t,i,a,c,o){e.GoogleAnalyticsObject=a,e[a]=e[a]||function(){(e[a].q=e[a].q||[]).push(arguments)},e[a].l=1*new Date,c=n.createElement(t),o=n.getElementsByTagName(t)[0],c.async=1,c.src=i,o.parentNode.insertBefore(c,o)}(window,document,"script","//www.google-analytics.com/analytics.js","ga"),angular.isArray(e)?e.forEach(function(e){var n,t="cookieConfig"in e?e.cookieConfig:d;C("crossDomainLinker",e)&&(e.allowLinker=e.crossDomainLinker),angular.forEach(["name","allowLinker"],function(t){t in e&&(angular.isUndefined(n)&&(n={}),n[t]=e[t])}),angular.isUndefined(n)?y.ga("create",e.tracker,t):y.ga("create",e.tracker,t,n),n&&"allowLinker"in n&&n.allowLinker&&(y.ga(q("require",e),"linker"),C("crossLinkDomains",e)&&y.ga(q("linker:autoLink",e),e.crossLinkDomains))}):h?(y.ga("create",e,d,p),y.ga("require","linker"),c&&y.ga("linker:autoLink",c)):y.ga("create",e,d),n&&y.ga("require","displayfeatures"),r&&!f&&y.ga("send","pageview",L()),y.ga&&(g&&(m?y.ga("require","ec","ec.js"):y.ga("require","ecommerce","ecommerce.js")),_&&y.ga("require","linkid","linkid.js"),a)){var t=document.createElement("script"),i=document.getElementsByTagName("script")[0];t.src="//www.google-analytics.com/cx/api.js?experiment="+a,i.parentNode.insertBefore(t,i)}}var I=this,L=function(){var e=v.path();return i?e.replace(i,""):e};return this._log=function(){arguments.length>0&&(arguments.length>1&&"warn"===arguments[0]&&E.warn(Array.prototype.slice.call(arguments,1)),this._logs.push(arguments))},this._ecommerceEnabled=function(){return g?m?(this._log("warn","Enhanced ecommerce plugin is enabled. Only one plugin(ecommerce/ec) can be used at a time. Use AnalyticsProvider.setECommerce(true, false);"),!1):!0:(this._log("warn","ecommerce not set. Use AnalyticsProvider.setECommerce(true, false);"),!1)},this._enhancedEcommerceEnabled=function(){return g?m?!0:(this._log("warn","Enhanced ecommerce plugin is disabled. Use AnalyticsProvider.setECommerce(true, true);"),!1):(this._log("warn","ecommerce not set. Use AnalyticsProvider.setECommerce(true, true);"),!1)},this._trackPage=function(n,t){var i=this,a=arguments;n=n?n:L(),t=t?t:k[0].title,A(function(){y._gaq.push(["_set","title",t]),y._gaq.push(["_trackPageview",s+n]),i._log("_trackPageview",n,t,a)}),P(function(){angular.isArray(e)?e.forEach(function(e){y.ga(q("send",e),"pageview",{page:s+n,title:t})}):y.ga("send","pageview",{page:s+n,title:t}),i._log("pageview",n,t,a)})},this._trackEvent=function(n,t,i,a,c){var o=this,r=arguments;A(function(){y._gaq.push(["_trackEvent",n,t,i,a,!!c]),o._log("trackEvent",r)}),P(function(){angular.isArray(e)?e.forEach(function(e){C("trackEvent",e)&&y.ga(q("send",e),"event",n,t,i,a)}):y.ga("send","event",n,t,i,a),o._log("event",r)})},this._addTrans=function(e,n,t,i,a,c,o,r,s){var u=this,l=arguments;A(function(){y._gaq.push(["_addTrans",e,n,t,i,a,c,o,r]),u._log("_addTrans",l)}),P(function(){u._ecommerceEnabled()&&(y.ga("ecommerce:addTransaction",{id:e,affiliation:n,revenue:t,tax:i,shipping:a,currency:s||"USD"}),u._log("ecommerce:addTransaction",l))})},this._addItem=function(e,n,t,i,a,c){var o=this,r=arguments;A(function(){y._gaq.push(["_addItem",e,n,t,i,a,c]),o._log("_addItem",r)}),P(function(){o._ecommerceEnabled()&&(y.ga("ecommerce:addItem",{id:e,name:t,sku:n,category:i,price:a,quantity:c}),o._log("ecommerce:addItem",r))})},this._trackTrans=function(){var e=this,n=arguments;A(function(){y._gaq.push(["_trackTrans"]),e._log("_trackTrans",n)}),P(function(){e._ecommerceEnabled()&&(y.ga("ecommerce:send"),e._log("ecommerce:send",n))})},this._clearTrans=function(){var e=this,n=arguments;P(function(){e._ecommerceEnabled()&&(y.ga("ecommerce:clear"),e._log("ecommerce:clear",n))})},this._addProduct=function(e,n,t,i,a,c,o,r,s){var u=this,l=arguments;A(function(){y._gaq.push(["_addProduct",e,n,t,i,a,c,o,r,s]),u._log("_addProduct",l)}),P(function(){u._enhancedEcommerceEnabled()&&(y.ga("ec:addProduct",{id:e,name:n,category:t,brand:i,variant:a,price:c,quantity:o,coupon:r,position:s}),u._log("ec:addProduct",l))})},this._addImpression=function(e,n,t,i,a,c,o,r){var s=this,u=arguments;A(function(){y._gaq.push(["_addImpression",e,n,t,i,a,c,o,r]),s._log("_addImpression",u)}),P(function(){s._enhancedEcommerceEnabled()&&y.ga("ec:addImpression",{id:e,name:n,category:a,brand:i,variant:c,list:t,position:o,price:r}),s._log("ec:addImpression",u)})},this._addPromo=function(e,n,t,i){var a=this,c=arguments;A(function(){y._gaq.push(["_addPromo",e,n,t,i]),a._log("_addPromo",arguments)}),P(function(){a._enhancedEcommerceEnabled()&&(y.ga("ec:addPromo",{id:e,name:n,creative:t,position:i}),a._log("ec:addPromo",c))})},this._getActionFieldObject=function(e,n,t,i,a,c,o,r,s){var u={};return e&&(u.id=e),n&&(u.affiliation=n),t&&(u.revenue=t),i&&(u.tax=i),a&&(u.shipping=a),c&&(u.coupon=c),o&&(u.list=o),r&&(u.step=r),s&&(u.option=s),u},this._setAction=function(e,n){var t=this,i=arguments;A(function(){y._gaq.push(["_setAction",e,n]),t._log("__setAction",i)}),P(function(){t._enhancedEcommerceEnabled()&&(y.ga("ec:setAction",e,n),t._log("ec:setAction",i))})},this._trackTransaction=function(e,n,t,i,a,c,o,r,s){this._setAction("purchase",this._getActionFieldObject(e,n,t,i,a,c,o,r,s)),this._pageView()},this._trackRefund=function(e){this._setAction("refund",this._getActionFieldObject(e)),this._pageView()},this._trackCheckOut=function(e,n){this._setAction("checkout",this._getActionFieldObject(null,null,null,null,null,null,null,e,n)),this._pageView()},this._trackCart=function(e){-1!==["add","remove"].indexOf(e)&&(this._setAction(e),this._send("event","UX","click",e+"to cart"))},this._promoClick=function(e){this._setAction("promo_click"),this._send("event","Internal Promotions","click",e)},this._productClick=function(e){this._setAction("click",this._getActionFieldObject(null,null,null,null,null,null,e,null,null)),this._send("event","UX","click",e)},this._send=function(e){var n=this;P(function(){y.ga("send",e),n._log("send",e)})},this._pageView=function(){this._send("pageview")},this._set=function(e,n){var t=this;P(function(){y.ga("set",e,n),t._log("set",e,n)})},u?T():b(),r&&w.$on(l,function(){I._trackPage()}),{_logs:I._logs,cookieConfig:d,displayFeatures:n,ecommerce:g,enhancedEcommerce:m,enhancedLinkAttribution:_,getUrl:L,experimentId:a,ignoreFirstPageLoad:f,ecommerceEnabled:function(){return I._ecommerceEnabled()},enhancedEcommerceEnabled:function(){return I._enhancedEcommerceEnabled()},trackPage:function(e,n){I._trackPage(e,n)},trackEvent:function(e,n,t,i,a){I._trackEvent(e,n,t,i,a)},addTrans:function(e,n,t,i,a,c,o,r,s){I._addTrans(e,n,t,i,a,c,o,r,s)},addItem:function(e,n,t,i,a,c){I._addItem(e,n,t,i,a,c)},trackTrans:function(){I._trackTrans()},clearTrans:function(){I._clearTrans()},addProduct:function(e,n,t,i,a,c,o,r,s){I._addProduct(e,n,t,i,a,c,o,r,s)},addPromo:function(e,n,t,i){I._addPromo(e,n,t,i)},addImpression:function(e,n,t,i,a,c,o,r){I._addImpression(e,n,t,i,a,c,o,r)},productClick:function(e){I._productClick(e)},promoClick:function(e){I._promoClick(e)},trackDetail:function(){I._setAction("detail"),I._pageView()},trackCart:function(e){I._trackCart(e)},trackCheckout:function(e,n){I._trackCheckOut(e,n)},trackTransaction:function(e,n,t,i,a,c,o,r,s){I._trackTransaction(e,n,t,i,a,c,o,r,s)},setAction:function(e,n){I._setAction(e,n)},send:function(e){I._send(e)},pageView:function(){I._pageView()},set:function(e,n){I._set(e,n)}}}]}); \ No newline at end of file diff --git a/package.json b/package.json index b8cccbd..a58b54f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "angular-google-analytics", "description": "Angular Google Analytics - Easy tracking for your AngularJS application", - "version": "0.0.9", + "version": "0.0.10", "homepage": "http://github.com/revolunet/angular-google-analytics", "author": "Julien Bouquillon ", "main": "./src/angular-google-analytics.js",