diff --git a/src/mocks/googleAnalytics.js b/src/mocks/googleAnalytics.js index 4d15e8de..f39690c7 100644 --- a/src/mocks/googleAnalytics.js +++ b/src/mocks/googleAnalytics.js @@ -31,7 +31,8 @@ ngCordovaMocks.factory('$cordovaGoogleAnalytics', ['$q', function ($q) { 'trackException', 'trackTiming', 'addTransaction', - 'addTransactionItem' + 'addTransactionItem', + 'setAllowIDFACollection' ]; methodsName.forEach(function (funcName) { diff --git a/src/plugins/googleAnalytics.js b/src/plugins/googleAnalytics.js index 3926ead6..4721a755 100755 --- a/src/plugins/googleAnalytics.js +++ b/src/plugins/googleAnalytics.js @@ -123,6 +123,18 @@ angular.module('ngCordova.plugins.googleAnalytics', []) d.reject(error); }); + return d.promise; + }, + + setAllowIDFACollection: function(enable) { + var d = $q.defer(); + + $window.analytics.setAllowIDFACollection(enable, function (response) { + d.resolve(response); + }, function (error) { + d.reject(error); + }); + return d.promise; } };