diff --git a/src/ios/CDVGoogleAnalytics.h b/src/ios/CDVGoogleAnalytics.h index dd34d5e..b8c49ae 100644 --- a/src/ios/CDVGoogleAnalytics.h +++ b/src/ios/CDVGoogleAnalytics.h @@ -120,6 +120,7 @@ - (void) setCustomParams: (CDVInvokedUrlCommand*)command; - (void) setUserId: (CDVInvokedUrlCommand*)command; - (void) setDebugMode: (CDVInvokedUrlCommand*)command; +- (void) optOut:(CDVInvokedUrlCommand*)command; @end diff --git a/src/ios/CDVGoogleAnalytics.m b/src/ios/CDVGoogleAnalytics.m index 4968b96..5aabec5 100644 --- a/src/ios/CDVGoogleAnalytics.m +++ b/src/ios/CDVGoogleAnalytics.m @@ -103,7 +103,7 @@ - (void) trackView: (CDVInvokedUrlCommand *)command { if (options) { NSString *screenName = [options objectForKey:CDVGA_OPT_SCREEN_NAME]; if (screenName && screenName.length > 0) { - GAIDictionaryBuilder *builder = [self prepareBuilder:[GAIDictionaryBuilder createAppView] withOptions:options]; + GAIDictionaryBuilder *builder = [self prepareBuilder:[GAIDictionaryBuilder createScreenView] withOptions:options]; _actualScreen = screenName; [_tracker set:kGAIScreenName value:screenName]; [_tracker send:[builder build]]; @@ -430,6 +430,11 @@ - (void) setDebugMode: (CDVInvokedUrlCommand*) command { [[GAI sharedInstance].logger setLogLevel:kGAILogLevelVerbose]; } +- (void) optOut:(CDVInvokedUrlCommand*)command { + BOOL optOut = [[command.arguments objectAtIndex:0] boolValue]; + [[GAI sharedInstance] setOptOut:optOut]; +} + #pragma mark - #pragma mark Internal functions diff --git a/src/ios/GAI.h b/src/ios/GAI.h index fa394a5..b0e4952 100644 --- a/src/ios/GAI.h +++ b/src/ios/GAI.h @@ -1,15 +1,15 @@ /*! @header GAI.h @abstract Google Analytics iOS SDK Header - @version 3.0 - @copyright Copyright 2013 Google Inc. All rights reserved. + @version 3.15 + @copyright Copyright 2015 Google Inc. All rights reserved. */ #import + #import "GAILogger.h" -#import "GAITracker.h" #import "GAITrackedViewController.h" - +#import "GAITracker.h" typedef NS_ENUM(NSUInteger, GAIDispatchResult) { kGAIDispatchNoData, @@ -174,14 +174,19 @@ typedef enum { (returning kGAIDispatchError). If there is no network connection or there is no data to send, kGAIDispatchNoData is returned. + Note that calling this method with a non-nil completionHandler disables periodic dispatch. + Periodic dispatch can be reenabled by setting the dispatchInterval to a positive number when + the app resumes from the background. + Calling this method with a nil completionHandler is the same as calling the dispatch above. - This method can be used for background data fetching in iOS 7.0 or later. + This method can be used for background data fetching in iOS 7.0 or later. It would be wise to + call this when the application is exiting to initiate the submission of any unsubmitted + tracking information. - It would be wise to call this when application is exiting to initiate the - submission of any unsubmitted tracking information. Note that this does not - have any effect on dispatchInterval, and can be used in conjunction with - periodic dispatch. */ -- (void)dispatchWithCompletionHandler:(void (^)(GAIDispatchResult))completionHandler; + @param completionHandler The block to run after a single dispatch request. The GAIDispatchResult + param indicates whether the dispatch succeeded, had an error, or had no hits to dispatch. + */ +- (void)dispatchWithCompletionHandler:(void (^)(GAIDispatchResult result))completionHandler; @end diff --git a/src/ios/GAIDictionaryBuilder.h b/src/ios/GAIDictionaryBuilder.h index 5aadbf9..28418cb 100644 --- a/src/ios/GAIDictionaryBuilder.h +++ b/src/ios/GAIDictionaryBuilder.h @@ -103,6 +103,8 @@ *
  • dclid
  • *
  • gclid
  • *
  • gmob_t
  • + *
  • aclid
  • + *
  • anid
  • * *

    * Example: @@ -127,7 +129,7 @@ This method is deprecated. Use createScreenView instead. */ -+ (GAIDictionaryBuilder *)createAppView; ++ (GAIDictionaryBuilder *)createAppView DEPRECATED_MSG_ATTRIBUTE("Use createScreenView instead."); /*! Returns a GAIDictionaryBuilder object with parameters specific to a screenview diff --git a/src/ios/GAIFields.h b/src/ios/GAIFields.h index 6a862c0..e54cef0 100644 --- a/src/ios/GAIFields.h +++ b/src/ios/GAIFields.h @@ -19,6 +19,7 @@ extern NSString *const kGAIClientId; extern NSString *const kGAIDataSource; extern NSString *const kGAIAnonymizeIp; extern NSString *const kGAISessionControl; +extern NSString *const kGAIDeviceModelVersion; extern NSString *const kGAIScreenResolution; extern NSString *const kGAIViewportSize; extern NSString *const kGAIEncoding; @@ -69,6 +70,8 @@ extern NSString *const kGAICampaignName; extern NSString *const kGAICampaignKeyword; extern NSString *const kGAICampaignContent; extern NSString *const kGAICampaignId; +extern NSString *const kGAICampaignAdNetworkClickId; +extern NSString *const kGAICampaignAdNetworkId; extern NSString *const kGAITimingCategory; extern NSString *const kGAITimingVar; @@ -84,7 +87,7 @@ extern NSString *const kGAIIdfa; extern NSString *const kGAIAdTargetingEnabled; // hit types -extern NSString *const kGAIAppView; // deprecated, use kGAIScreenView instead +extern NSString *const kGAIAppView DEPRECATED_MSG_ATTRIBUTE("Use kGAIScreenView instead."); extern NSString *const kGAIScreenView; extern NSString *const kGAIEvent; extern NSString *const kGAISocial; diff --git a/src/ios/GAITrackedViewController.h b/src/ios/GAITrackedViewController.h index 5cbabdd..de19def 100644 --- a/src/ios/GAITrackedViewController.h +++ b/src/ios/GAITrackedViewController.h @@ -1,7 +1,6 @@ /*! @header GAITrackedViewController.h @abstract Google Analytics for iOS Tracked View Controller Header - @version 2.0 @copyright Copyright 2012 Google Inc. All rights reserved. */ @@ -11,7 +10,7 @@ @protocol GAITracker; /*! - Extends UIViewController to generate Google Analytics appview calls + Extends UIViewController to generate Google Analytics screenview calls whenever the view appears; this is done by overriding the `viewDidAppear:` method. The screen name must be set for any tracking calls to be made. diff --git a/src/ios/GAITracker.h b/src/ios/GAITracker.h index 605a2e4..fdc5c5d 100644 --- a/src/ios/GAITracker.h +++ b/src/ios/GAITracker.h @@ -1,7 +1,6 @@ /*! @header GAITracker.h @abstract Google Analytics iOS SDK Tracker Header - @version 3.0 @copyright Copyright 2013 Google Inc. All rights reserved. */ diff --git a/src/ios/libGoogleAnalyticsServices.a b/src/ios/libGoogleAnalyticsServices.a index 16d87ae..c7c10fb 100644 Binary files a/src/ios/libGoogleAnalyticsServices.a and b/src/ios/libGoogleAnalyticsServices.a differ diff --git a/www/analytics.js b/www/analytics.js index 599d6c3..53c7450 100644 --- a/www/analytics.js +++ b/www/analytics.js @@ -227,4 +227,8 @@ analytics.setDebugMode = function (success, error) { cordova.exec(success, error, 'GAPlugin', 'setDebugMode', []); }; +analytics.optOut = function(optOut) { + cordova.exec(null, null, "GAPlugin", "optOut", [optOut]); +}; + window.analytics = analytics;