diff --git a/README.md b/README.md index 3add957..4d61130 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ follow these step: -- Set 'YOUR GOOGLE ACCOUNT' in googleanalyticis.js placeholder with your google account id +- Create angular constant GOOGLE_ACCOUNT with your google account id (http://docs.angularjs.org/api/auto/object/$provide#constant) - Add the service to your angular js app module: ``var app = angular.module('myapp', ['analytics']) { diff --git a/analyticsService.js b/analyticsService.js index a787d2e..657e2e5 100644 --- a/analyticsService.js +++ b/analyticsService.js @@ -1,8 +1,8 @@ var _gaq = _gaq || []; -angular.module('analytics', []).run(['$http', function($http) { +angular.module('analytics', []).run(['$http', 'GOOGLE_ACCOUNT', function($http, GOOGLE_ACCOUNT) { - _gaq.push(['_setAccount', 'YOUR GOOGLE ACCOUNT']); + _gaq.push(['_setAccount', GOOGLE_ACCOUNT]); _gaq.push(['_trackPageview']); var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;