angularytics
Advanced tools
Comparing version 0.3.0 to 0.4.0
{ | ||
"name": "angularytics", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"main": "./dist/angularytics.min.js", | ||
@@ -18,2 +18,2 @@ "description": "The solution to tracking page views and events in a SPA with AngularJS", | ||
] | ||
} | ||
} |
@@ -0,1 +1,11 @@ | ||
0.4.0 / 2015-03-30 | ||
================== | ||
* Merge pull request #33 from tjokimie/track-timing | ||
* Rebuild dist | ||
* Update README | ||
* Add trackTiming | ||
* Remove unused parameter | ||
* Add missing semicolons | ||
# 0.1.1 | ||
@@ -2,0 +12,0 @@ * Removed Lodash dependency |
@@ -51,2 +51,9 @@ (function () { | ||
}; | ||
service.trackTiming = function (category, variable, value, opt_label) { | ||
forEachHandlerDo(function (handler) { | ||
if (category && variable && value) { | ||
handler.trackTiming(category, variable, value, opt_label); | ||
} | ||
}); | ||
}; | ||
$rootScope.$on(pageChangeEvent, function () { | ||
@@ -71,2 +78,5 @@ service.trackPageView($location.url()); | ||
}; | ||
service.trackTiming = function (category, variable, value, opt_label) { | ||
$log.log('Timing tracked', category, variable, value, opt_label); | ||
}; | ||
return service; | ||
@@ -77,32 +87,38 @@ } | ||
(function () { | ||
angular.module('angularytics').factory('AngularyticsGoogleHandler', [ | ||
'$log', | ||
function ($log) { | ||
var service = {}; | ||
service.trackPageView = function (url) { | ||
_gaq.push([ | ||
'_set', | ||
'page', | ||
url | ||
]); | ||
_gaq.push([ | ||
'_trackPageview', | ||
url | ||
]); | ||
}; | ||
service.trackEvent = function (category, action, opt_label, opt_value, opt_noninteraction) { | ||
_gaq.push([ | ||
'_trackEvent', | ||
category, | ||
action, | ||
opt_label, | ||
opt_value, | ||
opt_noninteraction | ||
]); | ||
}; | ||
return service; | ||
} | ||
]).factory('AngularyticsGoogleUniversalHandler', function () { | ||
angular.module('angularytics').factory('AngularyticsGoogleHandler', function () { | ||
var service = {}; | ||
service.trackPageView = function (url) { | ||
_gaq.push([ | ||
'_set', | ||
'page', | ||
url | ||
]); | ||
_gaq.push([ | ||
'_trackPageview', | ||
url | ||
]); | ||
}; | ||
service.trackEvent = function (category, action, opt_label, opt_value, opt_noninteraction) { | ||
_gaq.push([ | ||
'_trackEvent', | ||
category, | ||
action, | ||
opt_label, | ||
opt_value, | ||
opt_noninteraction | ||
]); | ||
}; | ||
service.trackTiming = function (category, variable, value, opt_label) { | ||
_gaq.push([ | ||
'_trackTiming', | ||
category, | ||
variable, | ||
value, | ||
opt_label | ||
]); | ||
}; | ||
return service; | ||
}).factory('AngularyticsGoogleUniversalHandler', function () { | ||
var service = {}; | ||
service.trackPageView = function (url) { | ||
ga('set', 'page', url); | ||
@@ -114,2 +130,5 @@ ga('send', 'pageview', url); | ||
}; | ||
service.trackTiming = function (category, variable, value, opt_label) { | ||
ga('send', 'timing', category, variable, value, opt_label); | ||
}; | ||
return service; | ||
@@ -116,0 +135,0 @@ }); |
/** | ||
* The solution to tracking page views and events in a SPA with AngularJS | ||
* @version v0.3.0 - 2014-06-08 | ||
* @version v0.4.0 - 2015-03-30 | ||
* @link https://github.com/mgonto/angularytics | ||
@@ -8,2 +8,2 @@ * @author Martin Gontovnikas <martin@gonto.com.ar> | ||
*/ | ||
!function(){angular.module("angularytics",[]).provider("Angularytics",function(){var a=["Google"];this.setEventHandlers=function(c){angular.isString(c)&&(c=[c]),a=[],angular.forEach(c,function(c){a.push(b(c))})};var b=function(a){return a.charAt(0).toUpperCase()+a.substring(1)},c="$locationChangeSuccess";this.setPageChangeEvent=function(a){c=a},this.$get=["$injector","$rootScope","$location",function(b,d,e){var f=[];angular.forEach(a,function(a){f.push(b.get("Angularytics"+a+"Handler"))});var g=function(a){angular.forEach(f,function(b){a(b)})},h={};return h.init=function(){},h.trackEvent=function(a,b,c,d,e){g(function(f){a&&b&&f.trackEvent(a,b,c,d,e)})},h.trackPageView=function(a){g(function(b){a&&b.trackPageView(a)})},d.$on(c,function(){h.trackPageView(e.url())}),h}]})}(),function(){angular.module("angularytics").factory("AngularyticsConsoleHandler",["$log",function(a){var b={};return b.trackPageView=function(b){a.log("URL visited",b)},b.trackEvent=function(b,c,d,e,f){a.log("Event tracked",b,c,d,e,f)},b}])}(),function(){angular.module("angularytics").factory("AngularyticsGoogleHandler",["$log",function(){var a={};return a.trackPageView=function(a){_gaq.push(["_set","page",a]),_gaq.push(["_trackPageview",a])},a.trackEvent=function(a,b,c,d,e){_gaq.push(["_trackEvent",a,b,c,d,e])},a}]).factory("AngularyticsGoogleUniversalHandler",function(){var a={};return a.trackPageView=function(a){ga("set","page",a),ga("send","pageview",a)},a.trackEvent=function(a,b,c,d,e){ga("send","event",a,b,c,d,{nonInteraction:e})},a})}(),function(){angular.module("angularytics").filter("trackEvent",["Angularytics",function(a){return function(b,c,d,e,f,g){return a.trackEvent(c,d,e,f,g),b}}])}(); | ||
!function(){angular.module("angularytics",[]).provider("Angularytics",function(){var a=["Google"];this.setEventHandlers=function(c){angular.isString(c)&&(c=[c]),a=[],angular.forEach(c,function(c){a.push(b(c))})};var b=function(a){return a.charAt(0).toUpperCase()+a.substring(1)},c="$locationChangeSuccess";this.setPageChangeEvent=function(a){c=a},this.$get=["$injector","$rootScope","$location",function(b,d,e){var f=[];angular.forEach(a,function(a){f.push(b.get("Angularytics"+a+"Handler"))});var g=function(a){angular.forEach(f,function(b){a(b)})},h={};return h.init=function(){},h.trackEvent=function(a,b,c,d,e){g(function(f){a&&b&&f.trackEvent(a,b,c,d,e)})},h.trackPageView=function(a){g(function(b){a&&b.trackPageView(a)})},h.trackTiming=function(a,b,c,d){g(function(e){a&&b&&c&&e.trackTiming(a,b,c,d)})},d.$on(c,function(){h.trackPageView(e.url())}),h}]})}(),function(){angular.module("angularytics").factory("AngularyticsConsoleHandler",["$log",function(a){var b={};return b.trackPageView=function(b){a.log("URL visited",b)},b.trackEvent=function(b,c,d,e,f){a.log("Event tracked",b,c,d,e,f)},b.trackTiming=function(b,c,d,e){a.log("Timing tracked",b,c,d,e)},b}])}(),function(){angular.module("angularytics").factory("AngularyticsGoogleHandler",function(){var a={};return a.trackPageView=function(a){_gaq.push(["_set","page",a]),_gaq.push(["_trackPageview",a])},a.trackEvent=function(a,b,c,d,e){_gaq.push(["_trackEvent",a,b,c,d,e])},a.trackTiming=function(a,b,c,d){_gaq.push(["_trackTiming",a,b,c,d])},a}).factory("AngularyticsGoogleUniversalHandler",function(){var a={};return a.trackPageView=function(a){ga("set","page",a),ga("send","pageview",a)},a.trackEvent=function(a,b,c,d,e){ga("send","event",a,b,c,d,{nonInteraction:e})},a.trackTiming=function(a,b,c,d){ga("send","timing",a,b,c,d)},a})}(),function(){angular.module("angularytics").filter("trackEvent",["Angularytics",function(a){return function(b,c,d,e,f,g){return a.trackEvent(c,d,e,f,g),b}}])}(); |
{ | ||
"name": "angularytics", | ||
"description": "The solution to tracking page views and events in a SPA with AngularJS", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"filename": "angularytics.min.js", | ||
@@ -47,2 +47,2 @@ "main": "./dist/angularytics.min.js", | ||
} | ||
} | ||
} |
@@ -91,2 +91,3 @@ #Angularytics | ||
* **trackEvent(category, action, opt_label, opt_value, opt_noninteraction)**: Tracks a new event with the given parameters | ||
* **trackTiming(category, variable, value, opt_label)**: Tracks user timings with the given parameters | ||
@@ -93,0 +94,0 @@ #### Use this service by changing the AngularyticsProvider |
@@ -13,7 +13,7 @@ (function(){ | ||
}); | ||
} | ||
}; | ||
var capitalizeHandler = function(handler) { | ||
return handler.charAt(0).toUpperCase() + handler.substring(1); | ||
} | ||
}; | ||
@@ -23,3 +23,3 @@ var pageChangeEvent = '$locationChangeSuccess'; | ||
pageChangeEvent = newPageChangeEvent; | ||
} | ||
}; | ||
@@ -39,3 +39,3 @@ this.$get = function($injector, $rootScope, $location) { | ||
}); | ||
} | ||
}; | ||
@@ -46,3 +46,3 @@ var service = {}; | ||
} | ||
}; | ||
@@ -55,3 +55,3 @@ service.trackEvent = function(category, action, opt_label, opt_value, opt_noninteraction) { | ||
}); | ||
} | ||
}; | ||
@@ -64,3 +64,11 @@ service.trackPageView = function(url) { | ||
}); | ||
} | ||
}; | ||
service.trackTiming = function(category, variable, value, opt_label) { | ||
forEachHandlerDo(function(handler) { | ||
if (category && variable && value) { | ||
handler.trackTiming(category, variable, value, opt_label); | ||
} | ||
}); | ||
}; | ||
@@ -74,4 +82,2 @@ // Event listening | ||
}; | ||
@@ -78,0 +84,0 @@ |
@@ -7,10 +7,14 @@ (function(){ | ||
$log.log("URL visited", url); | ||
} | ||
}; | ||
service.trackEvent = function(category, action, opt_label, opt_value, opt_noninteraction) { | ||
$log.log("Event tracked", category, action, opt_label, opt_value, opt_noninteraction); | ||
} | ||
}; | ||
service.trackTiming = function(category, variable, value, opt_label) { | ||
$log.log("Timing tracked", category, variable, value, opt_label); | ||
}; | ||
return service; | ||
}); | ||
})(); |
(function(){ | ||
angular.module('angularytics').factory('AngularyticsGoogleHandler', function($log) { | ||
angular.module('angularytics').factory('AngularyticsGoogleHandler', function() { | ||
var service = {}; | ||
@@ -8,8 +8,12 @@ | ||
_gaq.push(['_trackPageview', url]); | ||
} | ||
}; | ||
service.trackEvent = function(category, action, opt_label, opt_value, opt_noninteraction) { | ||
_gaq.push(['_trackEvent', category, action, opt_label, opt_value, opt_noninteraction]); | ||
} | ||
}; | ||
service.trackTiming = function(category, variable, value, opt_label) { | ||
_gaq.push(['_trackTiming', category, variable, value, opt_label]); | ||
}; | ||
return service; | ||
@@ -28,4 +32,8 @@ }).factory('AngularyticsGoogleUniversalHandler', function () { | ||
service.trackTiming = function (category, variable, value, opt_label) { | ||
ga('send', 'timing', category, variable, value, opt_label); | ||
}; | ||
return service; | ||
}); | ||
})(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
128
0
225882
5732