@@ -9,7 +9,7 @@ angular.module('ngCordova.plugins.googleAnalytics', [])
99 startTrackerWithId : function ( id ) {
1010 var d = $q . defer ( ) ;
1111
12- $window . analytics . startTrackerWithId ( id , function ( response ) {
12+ $window . ga . startTrackerWithId ( id , function ( response ) {
1313 d . resolve ( response ) ;
1414 } , function ( error ) {
1515 d . reject ( error ) ;
@@ -21,7 +21,19 @@ angular.module('ngCordova.plugins.googleAnalytics', [])
2121 setUserId : function ( id ) {
2222 var d = $q . defer ( ) ;
2323
24- $window . analytics . setUserId ( id , function ( response ) {
24+ $window . ga . setUserId ( id , function ( response ) {
25+ d . resolve ( response ) ;
26+ } , function ( error ) {
27+ d . reject ( error ) ;
28+ } ) ;
29+
30+ return d . promise ;
31+ } ,
32+
33+ setAppVersion : function ( version ) {
34+ var d = $q . defer ( ) ;
35+
36+ $window . ga . setAppVersion ( version , function ( response ) {
2537 d . resolve ( response ) ;
2638 } , function ( error ) {
2739 d . reject ( error ) ;
@@ -33,7 +45,7 @@ angular.module('ngCordova.plugins.googleAnalytics', [])
3345 debugMode : function ( ) {
3446 var d = $q . defer ( ) ;
3547
36- $window . analytics . debugMode ( function ( response ) {
48+ $window . ga . debugMode ( function ( response ) {
3749 d . resolve ( response ) ;
3850 } , function ( ) {
3951 d . reject ( ) ;
@@ -45,7 +57,7 @@ angular.module('ngCordova.plugins.googleAnalytics', [])
4557 trackView : function ( screenName ) {
4658 var d = $q . defer ( ) ;
4759
48- $window . analytics . trackView ( screenName , function ( response ) {
60+ $window . ga . trackView ( screenName , function ( response ) {
4961 d . resolve ( response ) ;
5062 } , function ( error ) {
5163 d . reject ( error ) ;
@@ -62,7 +74,7 @@ angular.module('ngCordova.plugins.googleAnalytics', [])
6274 d . reject ( 'Parameter "key" must be an integer.' ) ;
6375 }
6476
65- $window . analytics . addCustomDimension ( parsedKey , value , function ( ) {
77+ $window . ga . addCustomDimension ( parsedKey , value , function ( ) {
6678 d . resolve ( ) ;
6779 } , function ( error ) {
6880 d . reject ( error ) ;
@@ -74,7 +86,19 @@ angular.module('ngCordova.plugins.googleAnalytics', [])
7486 trackEvent : function ( category , action , label , value ) {
7587 var d = $q . defer ( ) ;
7688
77- $window . analytics . trackEvent ( category , action , label , value , function ( response ) {
89+ $window . ga . trackEvent ( category , action , label , value , function ( response ) {
90+ d . resolve ( response ) ;
91+ } , function ( error ) {
92+ d . reject ( error ) ;
93+ } ) ;
94+
95+ return d . promise ;
96+ } ,
97+
98+ trackMetric : function ( key , value ) {
99+ var d = $q . defer ( ) ;
100+
101+ $window . ga . trackMetric ( key , value , function ( response ) {
78102 d . resolve ( response ) ;
79103 } , function ( error ) {
80104 d . reject ( error ) ;
@@ -86,7 +110,7 @@ angular.module('ngCordova.plugins.googleAnalytics', [])
86110 trackException : function ( description , fatal ) {
87111 var d = $q . defer ( ) ;
88112
89- $window . analytics . trackException ( description , fatal , function ( response ) {
113+ $window . ga . trackException ( description , fatal , function ( response ) {
90114 d . resolve ( response ) ;
91115 } , function ( error ) {
92116 d . reject ( error ) ;
@@ -98,7 +122,7 @@ angular.module('ngCordova.plugins.googleAnalytics', [])
98122 trackTiming : function ( category , milliseconds , variable , label ) {
99123 var d = $q . defer ( ) ;
100124
101- $window . analytics . trackTiming ( category , milliseconds , variable , label , function ( response ) {
125+ $window . ga . trackTiming ( category , milliseconds , variable , label , function ( response ) {
102126 d . resolve ( response ) ;
103127 } , function ( error ) {
104128 d . reject ( error ) ;
@@ -110,7 +134,7 @@ angular.module('ngCordova.plugins.googleAnalytics', [])
110134 addTransaction : function ( transactionId , affiliation , revenue , tax , shipping , currencyCode ) {
111135 var d = $q . defer ( ) ;
112136
113- $window . analytics . addTransaction ( transactionId , affiliation , revenue , tax , shipping , currencyCode , function ( response ) {
137+ $window . ga . addTransaction ( transactionId , affiliation , revenue , tax , shipping , currencyCode , function ( response ) {
114138 d . resolve ( response ) ;
115139 } , function ( error ) {
116140 d . reject ( error ) ;
@@ -122,7 +146,43 @@ angular.module('ngCordova.plugins.googleAnalytics', [])
122146 addTransactionItem : function ( transactionId , name , sku , category , price , quantity , currencyCode ) {
123147 var d = $q . defer ( ) ;
124148
125- $window . analytics . addTransactionItem ( transactionId , name , sku , category , price , quantity , currencyCode , function ( response ) {
149+ $window . ga . addTransactionItem ( transactionId , name , sku , category , price , quantity , currencyCode , function ( response ) {
150+ d . resolve ( response ) ;
151+ } , function ( error ) {
152+ d . reject ( error ) ;
153+ } ) ;
154+
155+ return d . promise ;
156+ } ,
157+
158+ setAnonymizeIp : function ( anonymize ) {
159+ var d = $q . defer ( ) ;
160+
161+ $window . ga . setAnonymizeIp ( anonymize , function ( response ) {
162+ d . resolve ( response ) ;
163+ } , function ( error ) {
164+ d . reject ( error ) ;
165+ } ) ;
166+
167+ return d . promise ;
168+ } ,
169+
170+ setAllowIDFACollection : function ( enable ) {
171+ var d = $q . defer ( ) ;
172+
173+ $window . ga . setAllowIDFACollection ( enable , function ( response ) {
174+ d . resolve ( response ) ;
175+ } , function ( error ) {
176+ d . reject ( error ) ;
177+ } ) ;
178+
179+ return d . promise ;
180+ } ,
181+
182+ enableUncaughtExceptionReporting : function ( enable ) {
183+ var d = $q . defer ( ) ;
184+
185+ $window . ga . enableUncaughtExceptionReporting ( enable , function ( response ) {
126186 d . resolve ( response ) ;
127187 } , function ( error ) {
128188 d . reject ( error ) ;
0 commit comments