diff --git a/dist/angulartics-ga.min.js b/dist/angulartics-ga.min.js index 23569d5..097e7ca 100644 --- a/dist/angulartics-ga.min.js +++ b/dist/angulartics-ga.min.js @@ -1,2 +1,2 @@ -!function(window,angular,undefined){"use strict";angular.module("angulartics.google.analytics",["angulartics"]).config(["$analyticsProvider","$windowProvider",function($analyticsProvider,$windowProvider){function detectUniversalAnalytics(){var gaNamespace=$window.GoogleAnalyticsObject;return gaNamespace&&$window[gaNamespace]}function detectClassicAnalytics(){return!angular.isUndefined($window._gaq)}function dimensionsAndMetrics(properties){var key,customData={};for(key in properties)key.indexOf("dimension")&&key.indexOf("metric")||(customData[key]=properties[key]);return customData}function getPage_(properties){return properties.page||pagePathCache||$window.location.hash.substring(1)||window.location.pathname}var $window=$windowProvider.$get();$analyticsProvider.settings.pageTracking.trackRelativePath=!0;var pagePathCache;$analyticsProvider.settings.ga={additionalAccountNames:void 0,additionalAccountHitTypes:{pageview:!0,event:!0,exception:!1,ecommerce:!1,userTiming:!1,setUserProperties:!1,userId:!1},disableEventTracking:null,disablePageTracking:null,enhancedEcommerce:!1,transport:null,userId:null},$analyticsProvider.registerPageTrack(function(path,properties){pagePathCache=path,properties=properties||{},$analyticsProvider.settings.ga.disablePageTracking||dispatchToGa("pageview","send",angular.extend({},properties,{hitType:"pageview",page:path}))}),$analyticsProvider.registerEventTrack(function(action,properties){if(!$analyticsProvider.settings.ga.disableEventTracking&&(action||action+""=="0")){if(properties=properties||{},properties.category=properties.category||"Event",properties.value){var parsed=parseInt(properties.value,10);properties.value=isNaN(parsed)?0:parsed}angular.isFunction(properties.hitCallback)||(properties.hitCallback=null),properties.nonInteraction=properties.nonInteraction||properties.noninteraction,dispatchToGa("event","send",angular.extend({},properties,{hitType:"event",eventCategory:properties.category,eventAction:action,eventLabel:properties.label,eventValue:properties.value,nonInteraction:properties.nonInteraction,page:getPage_(properties),hitCallback:properties.hitCallback}))}}),$analyticsProvider.registerExceptionTrack(function(error,cause){dispatchToGa("exception","send",{hitType:"event",eventCategory:"Exceptions",eventAction:error.toString(),eventLabel:error.stack,nonInteraction:!0,page:getPage_({}),isException:!0})}),$analyticsProvider.registerSetUsername(function(userId){$analyticsProvider.settings.ga.userId=userId}),$analyticsProvider.registerSetUserProperties(function(properties){properties&&dispatchToGa("setUserProperties","set",dimensionsAndMetrics(properties))}),$analyticsProvider.registerUserTimings(function(properties){if(!angular.isObject(properties)||angular.isArray(properties))return console.log("Required argument properties is missing or not an object");angular.forEach(["timingCategory","timingVar","timingValue"],function(prop){if(angular.isUndefined(properties[prop]))return console.log("Argument properties missing required property "+prop)}),dispatchToGa("userTiming","send",{hitType:"timing",timingCategory:properties.timingCategory,timingVar:properties.timingVar,timingValue:properties.timingValue,timingLabel:properties.timingLabel,optSampleRate:properties.optSampleRate,page:getPage_(properties)})}),$analyticsProvider.registerTransactionTrack(function(transaction){var product,i;if(dispatchToGa("ecommerce","require","ecommerce"),dispatchToGa("ecommerce","ecommerce:addTransaction",transaction),transaction.products)for(i=0;i-1&&$analyticsProvider.settings.ga.enhancedEcommerce)switch(command){case"ecommerce:addTransaction":command=["ec:setAction","purchase"];break;case"ecommerce:addItem":command="ec:addProduct",fieldsObj.id=fieldsObj.sku;break;case"ecommerce:send":command="send",fieldsObj.hitType="event",fieldsObj.eventCategory="Angulartics Enhanced Ecommerce",fieldsObj.eventAction="Purchase",fieldsObj.nonInteraction=!0}uaCommand=command instanceof Array?command.concat(fieldsObj):[command,fieldsObj],applyUniversalCall_(uaCommand,shouldCopyHit)}function applyUniversalCall_(commandArray,shouldCopyHit){var commandClone,userId=$analyticsProvider.settings.ga.userId,gaNamespace=$window.GoogleAnalyticsObject;$window[gaNamespace].apply(this,commandArray),shouldCopyHit&&(commandClone=angular.copy(commandArray),userId&&!$analyticsProvider.settings.ga.additionalAccountHitTypes.userId&&commandClone[2]&&"object"==typeof commandClone[2]&&delete commandClone[2].userId,angular.forEach($analyticsProvider.settings.ga.additionalAccountNames,function(accountName){commandClone[0]=accountName+"."+commandClone[0],$window[gaNamespace].apply(this,commandClone)}))}function dispatchToClassic_(command,fieldsObj,shouldCopyHit){if("set"===command)return console.log('Classic Analytics does not support the "set" command or Custom Dimensions. Command ignored.');var classicCommand;if("send"===command)switch(fieldsObj.hitType){case"pageview":classicCommand=["_trackPageview",fieldsObj.page];break;case"event":classicCommand=["_trackEvent",fieldsObj.eventCategory,fieldsObj.eventAction,fieldsObj.eventLabel,fieldsObj.eventValue,fieldsObj.nonInteraction];break;case"timing":classicCommand=["_trackTiming",fieldsObj.timingCategory,fieldsObj.timingVar,fieldsObj.timingValue,fieldsObj.timingLabel,fieldsObj.optSampleRate]}if("ecommerce:addTransaction"===command&&(classicCommand=["_addTrans",fieldsObj.id,fieldsObj.affiliation,fieldsObj.revenue,fieldsObj.tax,fieldsObj.shipping,fieldsObj.billingCity,fieldsObj.billingRegion,fieldsObj.billingCountry]),"ecommerce:addItem"===command&&(classicCommand=["_addItem",fieldsObj.id,fieldsObj.sku,fieldsObj.name,fieldsObj.category,fieldsObj.price,fieldsObj.quantity]),"_set"===command&&(classicCommand=["_set","currencyCode",fieldsObj]),"ecommerce:send"===command&&(classicCommand=["_trackTrans"]),!classicCommand)return console.log("Unable to find command "+command+" or fieldsObj missing required properties. Command ignored.");$window._gaq.push(classicCommand),shouldCopyHit&&angular.forEach($analyticsProvider.settings.ga.additionalAccountNames,function(accountName){var classicCommandClone=[].slice.call(classicCommand);classicCommandClone[0]=accountName+"."+classicCommandClone[0],$window._gaq.push(classicCommandClone)})}var handler;return detectClassicAnalytics()&&(handler=dispatchToClassic_),detectUniversalAnalytics()&&(handler=dispatchToUniversal_),handler?function(method,command,fieldsObj){var shouldCopyHit=$analyticsProvider.settings.ga.additionalAccountHitTypes[method];handler(command,fieldsObj,shouldCopyHit)}:angular.noop}()}])}(window,window.angular); +!function(window,angular,undefined){"use strict";angular.module("angulartics.google.analytics",["angulartics"]).config(["$analyticsProvider","$windowProvider",function($analyticsProvider,$windowProvider){function detectUniversalAnalytics(){var gaNamespace=$window.GoogleAnalyticsObject;return gaNamespace&&$window[gaNamespace]}function detectClassicAnalytics(){return!angular.isUndefined($window._gaq)}function dimensionsAndMetrics(properties){var key,customData={};for(key in properties)key.indexOf("dimension")&&key.indexOf("metric")||(customData[key]=properties[key]);return customData}function getPage_(properties){return properties.page||pagePathCache||$window.location.hash.substring(1)||window.location.pathname}var $window=$windowProvider.$get();$analyticsProvider.settings.pageTracking.trackRelativePath=!0;var pagePathCache;$analyticsProvider.settings.ga={additionalAccountNames:undefined,additionalAccountHitTypes:{pageview:!0,event:!0,exception:!1,ecommerce:!1,userTiming:!1,setUserProperties:!1,userId:!1},disableEventTracking:null,disablePageTracking:null,enhancedEcommerce:!1,transport:null,userId:null},$analyticsProvider.registerPageTrack(function(path,properties){pagePathCache=path,properties=properties||{},$analyticsProvider.settings.ga.disablePageTracking||dispatchToGa("pageview","send",angular.extend({},properties,{hitType:"pageview",page:path}))}),$analyticsProvider.registerEventTrack(function(action,properties){if(!$analyticsProvider.settings.ga.disableEventTracking&&(action||action+""=="0")){if(properties=properties||{},properties.category=properties.category||"Event",properties.value){var parsed=parseInt(properties.value,10);properties.value=isNaN(parsed)?0:parsed}angular.isFunction(properties.hitCallback)||(properties.hitCallback=null),properties.nonInteraction=properties.nonInteraction||properties.noninteraction,dispatchToGa("event","send",angular.extend({},properties,{hitType:"event",eventCategory:properties.category,eventAction:action,eventLabel:properties.label,eventValue:properties.value,nonInteraction:properties.nonInteraction,page:getPage_(properties),hitCallback:properties.hitCallback}))}}),$analyticsProvider.registerExceptionTrack(function(error,cause){dispatchToGa("exception","send",{hitType:"event",eventCategory:"Exceptions",eventAction:error.toString(),eventLabel:error.stack,nonInteraction:!0,page:getPage_({}),isException:!0})}),$analyticsProvider.registerSetUsername(function(userId){$analyticsProvider.settings.ga.userId=userId}),$analyticsProvider.registerSetUserProperties(function(properties){properties&&dispatchToGa("setUserProperties","set",dimensionsAndMetrics(properties))}),$analyticsProvider.registerUserTimings(function(properties){return!angular.isObject(properties)||angular.isArray(properties)?console.log("Required argument properties is missing or not an object"):(angular.forEach(["timingCategory","timingVar","timingValue"],function(prop){if(angular.isUndefined(properties[prop]))return console.log("Argument properties missing required property "+prop)}),void dispatchToGa("userTiming","send",{hitType:"timing",timingCategory:properties.timingCategory,timingVar:properties.timingVar,timingValue:properties.timingValue,timingLabel:properties.timingLabel,optSampleRate:properties.optSampleRate,page:getPage_(properties)}))}),$analyticsProvider.registerTransactionTrack(function(transaction){var product,i;if(dispatchToGa("ecommerce","require","ecommerce"),dispatchToGa("ecommerce","ecommerce:addTransaction",transaction),transaction.products)for(i=0;i-1&&$analyticsProvider.settings.ga.enhancedEcommerce)switch(command){case"ecommerce:addTransaction":command=["ec:setAction","purchase"];break;case"ecommerce:addItem":command="ec:addProduct",fieldsObj.id=fieldsObj.sku;break;case"ecommerce:send":command="send",fieldsObj.hitType="event",fieldsObj.eventCategory="Angulartics Enhanced Ecommerce",fieldsObj.eventAction="Purchase",fieldsObj.nonInteraction=!0}uaCommand=command instanceof Array?command.concat(fieldsObj):[command,fieldsObj],applyUniversalCall_(uaCommand,shouldCopyHit)}function applyUniversalCall_(commandArray,shouldCopyHit){var commandClone,userId=$analyticsProvider.settings.ga.userId,gaNamespace=$window.GoogleAnalyticsObject;$window[gaNamespace].apply(this,commandArray),shouldCopyHit&&(commandClone=angular.copy(commandArray),userId&&!$analyticsProvider.settings.ga.additionalAccountHitTypes.userId&&commandClone[2]&&"object"==typeof commandClone[2]&&delete commandClone[2].userId,angular.forEach($analyticsProvider.settings.ga.additionalAccountNames,function(accountName){commandClone[0]=accountName+"."+commandArray[0],$window[gaNamespace].apply(this,commandClone)}))}function dispatchToClassic_(command,fieldsObj,shouldCopyHit){if("set"===command)return console.log('Classic Analytics does not support the "set" command or Custom Dimensions. Command ignored.');var classicCommand;if("send"===command)switch(fieldsObj.hitType){case"pageview":classicCommand=["_trackPageview",fieldsObj.page];break;case"event":classicCommand=["_trackEvent",fieldsObj.eventCategory,fieldsObj.eventAction,fieldsObj.eventLabel,fieldsObj.eventValue,fieldsObj.nonInteraction];break;case"timing":classicCommand=["_trackTiming",fieldsObj.timingCategory,fieldsObj.timingVar,fieldsObj.timingValue,fieldsObj.timingLabel,fieldsObj.optSampleRate]}return"ecommerce:addTransaction"===command&&(classicCommand=["_addTrans",fieldsObj.id,fieldsObj.affiliation,fieldsObj.revenue,fieldsObj.tax,fieldsObj.shipping,fieldsObj.billingCity,fieldsObj.billingRegion,fieldsObj.billingCountry]),"ecommerce:addItem"===command&&(classicCommand=["_addItem",fieldsObj.id,fieldsObj.sku,fieldsObj.name,fieldsObj.category,fieldsObj.price,fieldsObj.quantity]),"_set"===command&&(classicCommand=["_set","currencyCode",fieldsObj]),"ecommerce:send"===command&&(classicCommand=["_trackTrans"]),classicCommand?($window._gaq.push(classicCommand),void(shouldCopyHit&&angular.forEach($analyticsProvider.settings.ga.additionalAccountNames,function(accountName){var classicCommandClone=[].slice.call(classicCommand);classicCommandClone[0]=accountName+"."+classicCommandClone[0],$window._gaq.push(classicCommandClone)}))):console.log("Unable to find command "+command+" or fieldsObj missing required properties. Command ignored.")}var handler;return detectClassicAnalytics()&&(handler=dispatchToClassic_),detectUniversalAnalytics()&&(handler=dispatchToUniversal_),handler?function(method,command,fieldsObj){var shouldCopyHit=$analyticsProvider.settings.ga.additionalAccountHitTypes[method];handler(command,fieldsObj,shouldCopyHit)}:angular.noop}()}])}(window,window.angular); //# sourceMappingURL=../dist/angulartics-ga.min.js.map \ No newline at end of file diff --git a/dist/angulartics-ga.min.js.map b/dist/angulartics-ga.min.js.map index 4069d4a..9162f39 100644 --- a/dist/angulartics-ga.min.js.map +++ b/dist/angulartics-ga.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["lib/angulartics-ga.js"],"names":["window","angular","undefined","module","config","$analyticsProvider","$windowProvider","detectUniversalAnalytics","gaNamespace","$window","GoogleAnalyticsObject","detectClassicAnalytics","isUndefined","_gaq","dimensionsAndMetrics","properties","key","customData","indexOf","getPage_","page","pagePathCache","location","hash","substring","pathname","$get","settings","pageTracking","trackRelativePath","ga","additionalAccountNames","additionalAccountHitTypes","pageview","event","exception","ecommerce","userTiming","setUserProperties","userId","disableEventTracking","disablePageTracking","enhancedEcommerce","transport","registerPageTrack","path","dispatchToGa","extend","hitType","registerEventTrack","action","category","value","parsed","parseInt","isNaN","isFunction","hitCallback","nonInteraction","noninteraction","eventCategory","eventAction","eventLabel","label","eventValue","registerExceptionTrack","error","cause","toString","stack","isException","registerSetUsername","registerSetUserProperties","registerUserTimings","isObject","isArray","console","log","forEach","prop","timingCategory","timingVar","timingValue","timingLabel","optSampleRate","registerTransactionTrack","transaction","product","i","products","length","sku","id","currencyCode","copy","dispatchToUniversal_","command","fieldsObj","shouldCopyHit","uaCommand","pluginName","applyUniversalCall_","Array","concat","commandArray","commandClone","apply","this","accountName","dispatchToClassic_","classicCommand","affiliation","revenue","tax","shipping","billingCity","billingRegion","billingCountry","name","price","quantity","push","classicCommandClone","slice","call","handler","method","noop"],"mappings":"CAAA,SAAUA,OAAQC,QAASC,WAAY,YAOvCD,SAAQE,OAAO,gCAAiC,gBAC/CC,QAAQ,qBAAsB,kBAAmB,SAAUC,mBAAoBC,iBAkS9E,QAASC,4BAIP,GAAIC,aAAcC,QAAQC,qBAC1B,OAAOF,cAAeC,QAAQD,aAShC,QAASG,0BAGP,OAAQV,QAAQW,YAAYH,QAAQI,MAYtC,QAASC,sBAAqBC,YAE5B,GACIC,KADAC,aAGJ,KAAKD,MAAOD,YAILC,IAAIE,QAAQ,cAAiBF,IAAIE,QAAQ,YAC5CD,WAAWD,KAAOD,WAAWC,KAGjC,OAAOC,YA6RT,QAASE,UAASJ,YAEhB,MAAOA,YAAWK,MAAQC,eACxBZ,QAAQa,SAASC,KAAKC,UAAU,IAAMxB,OAAOsB,SAASG,SA1mB1D,GAAIhB,SAAUH,gBAAgBoB,MAI9BrB,oBAAmBsB,SAASC,aAAaC,mBAAoB,CAI7D,IAAIR,cAGJhB,oBAA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C,WACVmC,UAAUjC,WACViC,UAAUvC,eAEZ,MACF,KAAK,SACHoD,gBACE,eACAb,UAAUjB,eACViB,UAAUhB,UACVgB,UAAUf,YACVe,UAAUd,YACVc,UAAUb,eAuDlB,GAhDgB,6BAAZY,UAEFc,gBACE,YACAb,UAAUL,GACVK,UAAUc,YACVd,UAAUe,QACVf,UAAUgB,IACVhB,UAAUiB,SACVjB,UAAUkB,YACVlB,UAAUmB,cACVnB,UAAUoB,iBAKE,sBAAZrB,UAEFc,gBACE,WACAb,UAAUL,GACVK,UAAUN,IACVM,UAAUqB,KACVrB,UAAU9C,SACV8C,UAAUsB,MACVtB,UAAUuB,WAKE,SAAZxB,UAEFc,gBACE,OACA,eACAb,YAKY,mBAAZD,UAEFc,gBACE,iBAKCA,eACH,MAAOlC,SAAQC,IAAI,0BAA4BmB,QAAU,8DAI3DvF,SAAQI,KAAK4G,KAAKX,gBAEdZ,eAEFjG,QAAQ6E,QAAQzE,mBAAmBsB,SAASG,GAAGC,uBAAwB,SAAU6E,aAE/E,GAAIc,wBAAyBC,MAAMC,KAAKd,eAExCY,qBAAoB,GAAKd,YAAc,IAAMc,oBAAoB,GAEjEjH,QAAQI,KAAK4G,KAAKC,uBA5PxB,GAAIG,QAWJ,OATIlH,4BACFkH,QAAUhB,oBAGRtG,6BACFsH,QAAU9B,sBAIP8B,QAIE,SAASC,OAAQ9B,QAASC,WAE/B,GAAIC,eAAgB7F,mBAAmBsB,SAASG,GAAGE,0BAA0B8F,OAC7ED,SAAQ7B,QAASC,UAAWC,gBANrBjG,QAAQ8H,YAyQlB/H,OAAQA,OAAOC","file":"dist/angulartics-ga.min.js","sourceRoot":".."} \ No newline at end of file +{"version":3,"sources":["lib/angulartics-ga.js"],"names":["window","angular","undefined","module","config","$analyticsProvider","$windowProvider","detectUniversalAnalytics","gaNamespace","$window","GoogleAnalyticsObject","detectClassicAnalytics","isUndefined","_gaq","dimensionsAndMetrics","properties","key","customData","indexOf","getPage_","page","pagePathCache","location","hash","substring","pathname","$get","settings","pageTracking","trackRelativePath","ga","additionalAccountNames","additionalAccountHitTypes","pageview","event","exception","ecommerce","userTiming","setUserProperties","userId","disableEventTracking","disablePageTracking","enhancedEcommerce","transport","registerPageTrack","path","dispatchToGa","extend","hitType","registerEventTrack","action","category","value","parsed","parseInt","isNaN","isFunction","hitCallback","nonInteraction","noninteraction","eventCategory","eventAction","eventLabel","label","eventValue","registerExceptionTrack","error","cause","toString","stack","isException","registerSetUsername","registerSetUserProperties","registerUserTimings","isObject","isArray","console","log","forEach","prop","timingCategory","timingVar","timingValue","timingLabel","optSampleRate","registerTransactionTrack","transaction","product","i","products","length","sku","id","currencyCode","copy","dispatchToUniversal_","command","fieldsObj","shouldCopyHit","uaCommand","pluginName","applyUniversalCall_","Array","concat","commandArray","commandClone","apply","this","accountName","dispatchToClassic_","classicCommand","affiliation","revenue","tax","shipping","billingCity","billingRegion","billingCountry","name","price","quantity","push","classicCommandClone","slice","call","handler","method","noop"],"mappings":"CAAA,SAAUA,OAAQC,QAASC,WAAY,YAOvCD,SAAQE,OAAO,gCAAiC,gBAC/CC,QAAQ,qBAAsB,kBAAmB,SAAUC,mBAAoBC,iBAkS9E,QAASC,4BAIP,GAAIC,aAAcC,QAAQC,qBAC1B,OAAOF,cAAeC,QAAQD,aAShC,QAASG,0BAGP,OAAQV,QAAQW,YAAYH,QAAQI,MAYtC,QAASC,sBAAqBC,YAE5B,GACIC,KADAC,aAGJ,KAAKD,MAAOD,YAILC,IAAIE,QAAQ,cAAiBF,IAAIE,QAAQ,YAC5CD,WAAWD,KAAOD,WAAWC,KAGjC,OAAOC,YA6RT,QAASE,UAASJ,YAEhB,MAAOA,YAAWK,MAAQC,eACxBZ,QAAQa,SAASC,KAAKC,UAAU,IAAMxB,OAAOsB,SAASG,SA1mB1D,GAAIhB,SAAUH,gBAAgBoB,MAI9BrB,oBAAmBsB,SAASC,aAAaC,mBAAoB,CAI7D,IAAIR,cAGJhB,oBAAmBsB,SAASG,IAC1BC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C,UAAUvC,eAEZ,MACF,KAAK,SACHoD,gBACE,eACAb,UAAUjB,eACViB,UAAUhB,UACVgB,UAAUf,YACVe,UAAUd,YACVc,UAAUb,eAuDlB,MAhDgB,6BAAZY,UAEFc,gBACE,YACAb,UAAUL,GACVK,UAAUc,YACVd,UAAUe,QACVf,UAAUgB,IACVhB,UAAUiB,SACVjB,UAAUkB,YACVlB,UAAUmB,cACVnB,UAAUoB,iBAKE,sBAAZrB,UAEFc,gBACE,WACAb,UAAUL,GACVK,UAAUN,IACVM,UAAUqB,KACVrB,UAAU9C,SACV8C,UAAUsB,MACVtB,UAAUuB,WAKE,SAAZxB,UAEFc,gBACE,OACA,eACAb,YAKY,mBAAZD,UAEFc,gBACE,gBAKCA,gBAKLrG,QAAQI,KAAK4G,KAAKX,qBAEdZ,eAEFjG,QAAQ6E,QAAQzE,mBAAmBsB,SAASG,GAAGC,uBAAwB,SAAU6E,aAE/E,GAAIc,wBAAyBC,MAAMC,KAAKd,eAExCY,qBAAoB,GAAKd,YAAc,IAAMc,oBAAoB,GAEjEjH,QAAQI,KAAK4G,KAAKC,yBAdb9C,QAAQC,IAAI,0BAA4BmB,QAAU,+DA9O7D,GAAI6B,QAWJ,OATIlH,4BACFkH,QAAUhB,oBAGRtG,6BACFsH,QAAU9B,sBAIP8B,QAIE,SAASC,OAAQ9B,QAASC,WAE/B,GAAIC,eAAgB7F,mBAAmBsB,SAASG,GAAGE,0BAA0B8F,OAC7ED,SAAQ7B,QAASC,UAAWC,gBANrBjG,QAAQ8H,YAyQlB/H,OAAQA,OAAOC","file":"dist/angulartics-ga.min.js","sourceRoot":".."} \ No newline at end of file diff --git a/package.json b/package.json index 08729a7..10844a2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angulartics-google-analytics", - "version": "0.4.2", + "version": "0.4.1", "description": "Google Analytics plugin for Angulartics", "keywords": [ "google", @@ -35,7 +35,7 @@ "clean": "rm -rf dist", "prebuild": "npm run clean", "build": "mkdir -p dist && uglifyjs lib/angulartics-ga.js --compress --source-map dist/angulartics-ga.min.js.map --source-map-root .. --source-map-url ../dist/angulartics-ga.min.js.map -o dist/angulartics-ga.min.js", - "test": "node_modules/karma/bin/karma start --single-run=true" + "test": "npm build" }, "repository": { "type": "git", diff --git a/test/angulartics.googleAnalytics.spec.js b/test/angulartics.googleAnalytics.spec.js index 0633255..40fd6e0 100644 --- a/test/angulartics.googleAnalytics.spec.js +++ b/test/angulartics.googleAnalytics.spec.js @@ -530,7 +530,7 @@ describe('angulartics-ga', function() { beforeEach(function() { - analytics.settings.ga.additionalAccountNames = ['foo']; + analytics.settings.ga.additionalAccountNames = ['foo', 'bar']; }); @@ -538,9 +538,10 @@ describe('angulartics-ga', function() { analytics.pageTrack('/foo'); - expect(window.ga.q.length).toEqual(2); + expect(window.ga.q.length).toEqual(3); expect(window.ga.q[0][0]).toBe('send'); expect(window.ga.q[1][0]).toBe('foo.send'); + expect(window.ga.q[2][0]).toBe('bar.send'); done();