Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update iOS library to latest version 3.15 and optout method (iOS) #12

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/ios/CDVGoogleAnalytics.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
- (void) setCustomParams: (CDVInvokedUrlCommand*)command;
- (void) setUserId: (CDVInvokedUrlCommand*)command;
- (void) setDebugMode: (CDVInvokedUrlCommand*)command;
- (void) optOut:(CDVInvokedUrlCommand*)command;

@end

7 changes: 6 additions & 1 deletion src/ios/CDVGoogleAnalytics.m
Original file line number Diff line number Diff line change
Expand Up @@ -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]];
Expand Down Expand Up @@ -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

Expand Down
25 changes: 15 additions & 10 deletions src/ios/GAI.h
Original file line number Diff line number Diff line change
@@ -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 <Foundation/Foundation.h>

#import "GAILogger.h"
#import "GAITracker.h"
#import "GAITrackedViewController.h"

#import "GAITracker.h"

typedef NS_ENUM(NSUInteger, GAIDispatchResult) {
kGAIDispatchNoData,
Expand Down Expand Up @@ -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
4 changes: 3 additions & 1 deletion src/ios/GAIDictionaryBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@
* <li>dclid</li>
* <li>gclid</li>
* <li>gmob_t</li>
* <li>aclid</li>
* <li>anid</li>
* </ul>
* <p>
* Example:
Expand All @@ -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
Expand Down
5 changes: 4 additions & 1 deletion src/ios/GAIFields.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions src/ios/GAITrackedViewController.h
Original file line number Diff line number Diff line change
@@ -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.
*/

Expand All @@ -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.

Expand Down
1 change: 0 additions & 1 deletion src/ios/GAITracker.h
Original file line number Diff line number Diff line change
@@ -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.
*/

Expand Down
Binary file modified src/ios/libGoogleAnalyticsServices.a
Binary file not shown.
4 changes: 4 additions & 0 deletions www/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;