diff options
Diffstat (limited to 'StoneIsland/platforms/ios')
22 files changed, 2014 insertions, 6 deletions
diff --git a/StoneIsland/platforms/ios/Stone Island.xcodeproj/project.pbxproj b/StoneIsland/platforms/ios/Stone Island.xcodeproj/project.pbxproj index e2303cfe..9b8aa41d 100755 --- a/StoneIsland/platforms/ios/Stone Island.xcodeproj/project.pbxproj +++ b/StoneIsland/platforms/ios/Stone Island.xcodeproj/project.pbxproj @@ -5,7 +5,6 @@ }; objectVersion = 46; objects = { - /* Begin PBXBuildFile section */ 0207DA581B56EA530066E2B4 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0207DA571B56EA530066E2B4 /* Images.xcassets */; }; 099C5D0E05AF43F4B95AAA4A /* CDVNotification.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 2F49F2111FC649498658CF3B /* CDVNotification.bundle */; }; @@ -39,6 +38,13 @@ EF28FE2B49A344FBA3F7306F /* CDVInAppBrowser.m in Sources */ = {isa = PBXBuildFile; fileRef = 729B6141DF9D4C1BB64A7097 /* CDVInAppBrowser.m */; }; F4862C5594894163A3C3AB06 /* CDVConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E7CCBA15DC14F20830BD1B3 /* CDVConnection.m */; }; F990B4C12C3746EAA8C30F8D /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 6465D215A1B148A387730F27 /* libz.tbd */; }; + EE465A3641884122A7088AC5 /* UniversalAnalyticsPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = FFB5E8C21AD14D10A7088119 /* UniversalAnalyticsPlugin.m */; }; + 600310C41D3B400498A5890B /* libGoogleAnalyticsServices.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 281039EFAD1B4A8C90FDC17F /* libGoogleAnalyticsServices.a */; }; + C4E60C33635D44649CAAF727 /* libAdIdAccess.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 92230324A2954C6AADBA989A /* libAdIdAccess.a */; }; + 7739C5D961784F519029D858 /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BBF0272D99FA4D308445B382 /* CoreData.framework */; }; + D54B6FB071A94BED99CBF7E6 /* AdSupport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A3D8D77BE5A0496891F24BF9 /* AdSupport.framework */; }; + 6B52986769BB47ED98DF12F6 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 5133B28F80C74DA0A4EF900A /* libz.dylib */; }; + 0245BD3C98FD4F04A11BBCAA /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 4A4D6FDE815144E3BC47859B /* libsqlite3.dylib */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -118,6 +124,24 @@ F6093E605D6D49D1918413AA /* CDVDevice.m */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.c.objc; name = CDVDevice.m; path = "cordova-plugin-device/CDVDevice.m"; sourceTree = "<group>"; }; F840E1F0165FE0F500CFE078 /* config.xml */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = config.xml; path = "Stone Island/config.xml"; sourceTree = "<group>"; }; FCCC22BF4385472E88382D56 /* MessageUI.framework */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = wrapper.framework; name = MessageUI.framework; path = System/Library/Frameworks/MessageUI.framework; sourceTree = SDKROOT; }; + FFB5E8C21AD14D10A7088119 /* UniversalAnalyticsPlugin.m */ = {isa = PBXFileReference; name = "UniversalAnalyticsPlugin.m"; path = "cordova-plugin-google-analytics/UniversalAnalyticsPlugin.m"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; explicitFileType = undefined; includeInIndex = 0; }; + 281039EFAD1B4A8C90FDC17F /* libGoogleAnalyticsServices.a */ = {isa = PBXFileReference; name = "libGoogleAnalyticsServices.a"; path = "Stone Island/Plugins/cordova-plugin-google-analytics/libGoogleAnalyticsServices.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; + 92230324A2954C6AADBA989A /* libAdIdAccess.a */ = {isa = PBXFileReference; name = "libAdIdAccess.a"; path = "Stone Island/Plugins/cordova-plugin-google-analytics/libAdIdAccess.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; + A37B0133EF7A42B6BAF5F317 /* UniversalAnalyticsPlugin.h */ = {isa = PBXFileReference; name = "UniversalAnalyticsPlugin.h"; path = "cordova-plugin-google-analytics/UniversalAnalyticsPlugin.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; }; + 36C6224E10CC4C1DB3DEAAF4 /* GAIDictionaryBuilder.h */ = {isa = PBXFileReference; name = "GAIDictionaryBuilder.h"; path = "cordova-plugin-google-analytics/GAIDictionaryBuilder.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; }; + 1380CC4A1CFE434BB20950B7 /* GAIFields.h */ = {isa = PBXFileReference; name = "GAIFields.h"; path = "cordova-plugin-google-analytics/GAIFields.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; }; + 71D1AD5902B0425F8154F30F /* GAILogger.h */ = {isa = PBXFileReference; name = "GAILogger.h"; path = "cordova-plugin-google-analytics/GAILogger.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; }; + 9A8A8193C2794F48888355D3 /* GAITrackedViewController.h */ = {isa = PBXFileReference; name = "GAITrackedViewController.h"; path = "cordova-plugin-google-analytics/GAITrackedViewController.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; }; + 7EECC2D2BFEA43FE966814C6 /* GAI.h */ = {isa = PBXFileReference; name = "GAI.h"; path = "cordova-plugin-google-analytics/GAI.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; }; + F52665B1E3624AACB50A72B1 /* GAITracker.h */ = {isa = PBXFileReference; name = "GAITracker.h"; path = "cordova-plugin-google-analytics/GAITracker.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; }; + 2953CC1328564E13AE3FE7CD /* GAIEcommerceFields.h */ = {isa = PBXFileReference; name = "GAIEcommerceFields.h"; path = "cordova-plugin-google-analytics/GAIEcommerceFields.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; }; + CAAD7EE259C942989156C616 /* GAIEcommerceProduct.h */ = {isa = PBXFileReference; name = "GAIEcommerceProduct.h"; path = "cordova-plugin-google-analytics/GAIEcommerceProduct.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; }; + 8A49AF7CDE3040039CE14E5A /* GAIEcommerceProductAction.h */ = {isa = PBXFileReference; name = "GAIEcommerceProductAction.h"; path = "cordova-plugin-google-analytics/GAIEcommerceProductAction.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; }; + E2AFABA192234A0E9C198427 /* GAIEcommercePromotion.h */ = {isa = PBXFileReference; name = "GAIEcommercePromotion.h"; path = "cordova-plugin-google-analytics/GAIEcommercePromotion.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; }; + BBF0272D99FA4D308445B382 /* CoreData.framework */ = {isa = PBXFileReference; name = "CoreData.framework"; path = "System/Library/Frameworks/CoreData.framework"; sourceTree = SDKROOT; fileEncoding = undefined; lastKnownFileType = wrapper.framework; explicitFileType = undefined; includeInIndex = 0; }; + A3D8D77BE5A0496891F24BF9 /* AdSupport.framework */ = {isa = PBXFileReference; name = "AdSupport.framework"; path = "System/Library/Frameworks/AdSupport.framework"; sourceTree = SDKROOT; fileEncoding = undefined; lastKnownFileType = wrapper.framework; explicitFileType = undefined; includeInIndex = 0; }; + 5133B28F80C74DA0A4EF900A /* libz.dylib */ = {isa = PBXFileReference; name = "libz.dylib"; path = "usr/lib/libz.dylib"; sourceTree = SDKROOT; fileEncoding = undefined; lastKnownFileType = compiled.mach-o.dylib; explicitFileType = undefined; includeInIndex = 0; }; + 4A4D6FDE815144E3BC47859B /* libsqlite3.dylib */ = {isa = PBXFileReference; name = "libsqlite3.dylib"; path = "usr/lib/libsqlite3.dylib"; sourceTree = SDKROOT; fileEncoding = undefined; lastKnownFileType = compiled.mach-o.dylib; explicitFileType = undefined; includeInIndex = 0; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -136,6 +160,12 @@ A9267928B9A04BE29B534458 /* AddressBook.framework in Frameworks */, 36186AA3639F426384682A75 /* libsqlite3.tbd in Frameworks */, F990B4C12C3746EAA8C30F8D /* libz.tbd in Frameworks */, + 600310C41D3B400498A5890B /* libGoogleAnalyticsServices.a in Frameworks */, + C4E60C33635D44649CAAF727 /* libAdIdAccess.a in Frameworks */, + 7739C5D961784F519029D858 /* CoreData.framework in Frameworks */, + D54B6FB071A94BED99CBF7E6 /* AdSupport.framework in Frameworks */, + 6B52986769BB47ED98DF12F6 /* libz.dylib in Frameworks */, + 0245BD3C98FD4F04A11BBCAA /* libsqlite3.dylib in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -218,6 +248,12 @@ 6940DEA5B3084B54B48BD8F1 /* AddressBook.framework */, 014A3BF81C154724B8D195A5 /* libsqlite3.tbd */, 6465D215A1B148A387730F27 /* libz.tbd */, + 281039EFAD1B4A8C90FDC17F /* libGoogleAnalyticsServices.a */, + 92230324A2954C6AADBA989A /* libAdIdAccess.a */, + BBF0272D99FA4D308445B382 /* CoreData.framework */, + A3D8D77BE5A0496891F24BF9 /* AdSupport.framework */, + 5133B28F80C74DA0A4EF900A /* libz.dylib */, + 4A4D6FDE815144E3BC47859B /* libsqlite3.dylib */, ); name = Frameworks; sourceTree = "<group>"; @@ -271,6 +307,18 @@ B195BD92B31445039168DCCC /* PushPlugin.m */, 40CE234F002F419597A039E4 /* AppDelegate+notification.h */, 9AA8E7740E114B6E967452F8 /* PushPlugin.h */, + FFB5E8C21AD14D10A7088119 /* UniversalAnalyticsPlugin.m */, + A37B0133EF7A42B6BAF5F317 /* UniversalAnalyticsPlugin.h */, + 36C6224E10CC4C1DB3DEAAF4 /* GAIDictionaryBuilder.h */, + 1380CC4A1CFE434BB20950B7 /* GAIFields.h */, + 71D1AD5902B0425F8154F30F /* GAILogger.h */, + 9A8A8193C2794F48888355D3 /* GAITrackedViewController.h */, + 7EECC2D2BFEA43FE966814C6 /* GAI.h */, + F52665B1E3624AACB50A72B1 /* GAITracker.h */, + 2953CC1328564E13AE3FE7CD /* GAIEcommerceFields.h */, + CAAD7EE259C942989156C616 /* GAIEcommerceProduct.h */, + 8A49AF7CDE3040039CE14E5A /* GAIEcommerceProductAction.h */, + E2AFABA192234A0E9C198427 /* GAIEcommercePromotion.h */, ); name = Plugins; path = "Stone Island/Plugins"; @@ -463,6 +511,7 @@ E162E7029FC24C4595D1D82D /* IonicKeyboard.m in Sources */, 35DC9CF8FDC24E6DA829674B /* AppDelegate+notification.m in Sources */, 76C30D264E504728A7F0FD0C /* PushPlugin.m in Sources */, + EE465A3641884122A7088AC5 /* UniversalAnalyticsPlugin.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -505,6 +554,11 @@ LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; PRODUCT_NAME = "Stone Island"; TARGETED_DEVICE_FAMILY = "1,2"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/Stone Island/Plugins/cordova-plugin-google-analytics\"", + "\"$(SRCROOT)/Stone Island/Plugins/cordova-plugin-google-analytics\"", + ); }; name = Debug; }; @@ -534,6 +588,11 @@ LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; PRODUCT_NAME = "Stone Island"; TARGETED_DEVICE_FAMILY = "1,2"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/Stone Island/Plugins/cordova-plugin-google-analytics\"", + "\"$(SRCROOT)/Stone Island/Plugins/cordova-plugin-google-analytics\"", + ); }; name = Release; }; diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/GAI.h b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/GAI.h new file mode 100644 index 00000000..7f3f7029 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/GAI.h @@ -0,0 +1,192 @@ +/*! + @header GAI.h + @abstract Google Analytics iOS SDK Header + @version 3.14 + @copyright Copyright 2015 Google Inc. All rights reserved. + */ + +#import <Foundation/Foundation.h> + +#import "GAILogger.h" +#import "GAITrackedViewController.h" +#import "GAITracker.h" + +typedef NS_ENUM(NSUInteger, GAIDispatchResult) { + kGAIDispatchNoData, + kGAIDispatchGood, + kGAIDispatchError +}; + +/*! Google Analytics product string. */ +extern NSString *const kGAIProduct; + +/*! Google Analytics version string. */ +extern NSString *const kGAIVersion; + +/*! + NSError objects returned by the Google Analytics SDK may have this error domain + to indicate that the error originated in the Google Analytics SDK. + */ +extern NSString *const kGAIErrorDomain; + +/*! Google Analytics error codes. */ +typedef enum { + // This error code indicates that there was no error. Never used. + kGAINoError = 0, + + // This error code indicates that there was a database-related error. + kGAIDatabaseError, + + // This error code indicates that there was a network-related error. + kGAINetworkError, +} GAIErrorCode; + +/*! + Google Analytics iOS top-level class. Provides facilities to create trackers + and set behaviorial flags. + */ +@interface GAI : NSObject + +/*! + For convenience, this class exposes a default tracker instance. + This is initialized to `nil` and will be set to the first tracker that is + instantiated in trackerWithTrackingId:. It may be overridden as desired. + + The GAITrackedViewController class will, by default, use this tracker instance. + */ +@property(nonatomic, assign) id<GAITracker> defaultTracker; + +/*! + The GAILogger to use. + */ +@property(nonatomic, retain) id<GAILogger> logger; + +/*! + When this is true, no tracking information will be gathered; tracking calls + will effectively become no-ops. When set to true, all tracking information that + has not yet been submitted. The value of this flag will be persisted + automatically by the SDK. Developers can optionally use this flag to implement + an opt-out setting in the app to allows users to opt out of Google Analytics + tracking. + + This is set to `NO` the first time the Google Analytics SDK is used on a + device, and is persisted thereafter. + */ +@property(nonatomic, assign) BOOL optOut; + +/*! + If this value is positive, tracking information will be automatically + dispatched every dispatchInterval seconds. Otherwise, tracking information must + be sent manually by calling dispatch. + + By default, this is set to `120`, which indicates tracking information should + be dispatched automatically every 120 seconds. + */ +@property(nonatomic, assign) NSTimeInterval dispatchInterval; + +/*! + When set to true, the SDK will record the currently registered uncaught + exception handler, and then register an uncaught exception handler which tracks + the exceptions that occurred using defaultTracker. If defaultTracker is not + `nil`, this function will track the exception on the tracker and attempt to + dispatch any outstanding tracking information for 5 seconds. It will then call + the previously registered exception handler, if any. When set back to false, + the previously registered uncaught exception handler will be restored. + */ +@property(nonatomic, assign) BOOL trackUncaughtExceptions; + +/*! + When this is 'YES', no tracking information will be sent. Defaults to 'NO'. + */ +@property(nonatomic, assign) BOOL dryRun; + +/*! Get the shared instance of the Google Analytics for iOS class. */ ++ (GAI *)sharedInstance; + +/*! + Creates or retrieves a GAITracker implementation with the specified name and + tracking ID. If the tracker for the specified name does not already exist, then + it will be created and returned; otherwise, the existing tracker will be + returned. If the existing tracker for the respective name has a different + tracking ID, that tracking ID is not changed by this method. If defaultTracker + is not set, it will be set to the tracker instance returned here. + + @param name The name of this tracker. Must not be `nil` or empty. + + @param trackingId The tracking ID to use for this tracker. It should be of + the form `UA-xxxxx-y`. + + @return A GAITracker associated with the specified name. The tracker + can be used to send tracking data to Google Analytics. The first time this + method is called with a particular name, the tracker for that name will be + returned, and subsequent calls with the same name will return the same + instance. It is not necessary to retain the tracker because the tracker will be + retained internally by the library. + + If an error occurs or the name is not valid, this method will return + `nil`. + */ +- (id<GAITracker>)trackerWithName:(NSString *)name + trackingId:(NSString *)trackingId; + +/*! + Creates or retrieves a GAITracker implementation with name equal to + the specified tracking ID. If the tracker for the respective name does not + already exist, it is created, has it's tracking ID set to |trackingId|, + and is returned; otherwise, the existing tracker is returned. If the existing + tracker for the respective name has a different tracking ID, that tracking ID + is not changed by this method. If defaultTracker is not set, it is set to the + tracker instance returned here. + + @param trackingId The tracking ID to use for this tracker. It should be of + the form `UA-xxxxx-y`. The name of the tracker will be the same as trackingID. + + @return A GAITracker associated with the specified trackingID. The tracker + can be used to send tracking data to Google Analytics. The first time this + method is called with a particular trackingID, the tracker for the respective + name will be returned, and subsequent calls with the same trackingID + will return the same instance. It is not necessary to retain the tracker + because the tracker will be retained internally by the library. + + If an error occurs or the trackingId is not valid, this method will return + `nil`. + */ +- (id<GAITracker>)trackerWithTrackingId:(NSString *)trackingId; + +/*! + Remove a tracker from the trackers dictionary. If it is the default tracker, + clears the default tracker as well. + + @param name The name of the tracker. + */ +- (void)removeTrackerByName:(NSString *)name; + +/*! + Dispatches any pending tracking information. + + Note that this does not have any effect on dispatchInterval, and can be used in + conjunction with periodic dispatch. */ +- (void)dispatch; + +/*! + Dispatches the next tracking beacon in the queue, calling completionHandler when + the tracking beacon has either been sent (returning kGAIDispatchGood) or an error has resulted + (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. It would be wise to + call this when the application is exiting to initiate the submission of any unsubmitted + tracking information. + + @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/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/GAIDictionaryBuilder.h b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/GAIDictionaryBuilder.h new file mode 100644 index 00000000..b8c5fdab --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/GAIDictionaryBuilder.h @@ -0,0 +1,217 @@ +/*! + @header GAIDictionaryBuilder.h + @abstract Google Analytics iOS SDK Hit Format Header + @copyright Copyright 2013 Google Inc. All rights reserved. + */ + +#import <Foundation/Foundation.h> + +#import "GAIEcommerceProduct.h" +#import "GAIEcommerceProductAction.h" +#import "GAIEcommercePromotion.h" + +/*! + * Helper class to build a dictionary of hit parameters and values. + * <br> + * Examples: + * <code> + * id<GAITracker> t = // get a tracker. + * [t send:[[[GAIDictionaryBuilder createEventWithCategory:@"EventCategory" + * action:@"EventAction" + * label:nil + * value:nil] + * set:@"dimension1" forKey:[GAIFields customDimensionForIndex:1]] build]]; + * </code> + * This will send an event hit type with the specified parameters + * and a custom dimension parameter. + * <br> + * If you want to send a parameter with all hits, set it on GAITracker directly. + * <code> + * [t set:kGAIScreenName value:@"Home"]; + * [t send:[[GAIDictionaryBuilder createSocialWithNetwork:@"Google+" + * action:@"PlusOne" + * target:@"SOME_URL"] build]]; + * [t send:[[GAIDictionaryBuilder createSocialWithNetwork:@"Google+" + * action:@"Share" + * target:@"SOME_POST"] build]]; + * [t send:[[GAIDictionaryBuilder createSocialWithNetwork:@"Google+" + * action:@"HangOut" + * target:@"SOME_CIRCLE"] + * build]]; + * </code> + * You can override a value set on the tracker by adding it to the dictionary. + * <code> + * [t set:kGAIScreenName value:@"Home"]; + * [t send:...]; + * [t send[[[GAIDictionaryBuilder createEventWithCategory:@"click" + * action:@"popup" + * label:nil + * value:nil] + * set:@"popup title" forKey:kGAIScreenName] build]]; + * </code> + * The values set via [GAIDictionaryBuilder set] or + * [GAIDictionaryBuilder setAll] will override any existing values in the + * GAIDictionaryBuilder object (i.e. initialized by + * [GAIDictionaryBuilder createXYZ]). e.g. + * <code> + * GAIDictionaryBuilder *m = + * GAIDictionaryBuilder createTimingWithCategory:@"category" + * interval:@0 + * name:@"name" + * label:nil]; + * [t send:[m.set:@"10" forKey:kGAITimingVar] build]; + * [t send:[m.set:@"20" forKey:kGAITimingVar] build]; + * </code> + */ +@interface GAIDictionaryBuilder : NSObject + +- (GAIDictionaryBuilder *)set:(NSString *)value + forKey:(NSString *)key; + +/*! + * Copies all the name-value pairs from params into this object, ignoring any + * keys that are not NSString and any values that are neither NSString or + * NSNull. + */ +- (GAIDictionaryBuilder *)setAll:(NSDictionary *)params; + +/*! + * Returns the value for the input parameter paramName, or nil if paramName + * is not present. + */ +- (NSString *)get:(NSString *)paramName; + +/*! + * Return an NSMutableDictionary object with all the parameters set in this + */ +- (NSMutableDictionary *)build; + +/*! + * Parses and translates utm campaign parameters to analytics campaign param + * and returns them as a map. + * + * @param urlString url containing utm campaign parameters. + * + * Valid campaign parameters are: + * <ul> + * <li>utm_id</li> + * <li>utm_campaign</li> + * <li>utm_content</li> + * <li>utm_medium</li> + * <li>utm_source</li> + * <li>utm_term</li> + * <li>dclid</li> + * <li>gclid</li> + * <li>gmob_t</li> + * <li>aclid</li> + * <li>anid</li> + * </ul> + * <p> + * Example: + * http://my.site.com/index.html?utm_campaign=wow&utm_source=source + * utm_campaign=wow&utm_source=source. + * <p> + * For more information on auto-tagging, see + * http://support.google.com/googleanalytics/bin/answer.py?hl=en&answer=55590 + * <p> + * For more information on manual tagging, see + * http://support.google.com/googleanalytics/bin/answer.py?hl=en&answer=55518 + */ +- (GAIDictionaryBuilder *)setCampaignParametersFromUrl:(NSString *)urlString; + +/*! + Returns a GAIDictionaryBuilder object with parameters specific to an appview + hit. + + Note that using this method will not set the screen name for followon hits. To + do that you need to call set:kGAIDescription value:<screenName> on the + GAITracker instance. + + This method is deprecated. Use createScreenView instead. + */ ++ (GAIDictionaryBuilder *)createAppView DEPRECATED_MSG_ATTRIBUTE("Use createScreenView instead."); + +/*! + Returns a GAIDictionaryBuilder object with parameters specific to a screenview + hit. + + Note that using this method will not set the screen name for followon hits. To + do that you need to call set:kGAIDescription value:<screenName> on the + GAITracker instance. + */ ++ (GAIDictionaryBuilder *)createScreenView; + +/*! + Returns a GAIDictionaryBuilder object with parameters specific to an event hit. + */ ++ (GAIDictionaryBuilder *)createEventWithCategory:(NSString *)category + action:(NSString *)action + label:(NSString *)label + value:(NSNumber *)value; + +/*! + Returns a GAIDictionaryBuilder object with parameters specific to an exception + hit. + */ ++ (GAIDictionaryBuilder *)createExceptionWithDescription:(NSString *)description + withFatal:(NSNumber *)fatal; + +/*! + Returns a GAIDictionaryBuilder object with parameters specific to an item hit. + */ ++ (GAIDictionaryBuilder *)createItemWithTransactionId:(NSString *)transactionId + name:(NSString *)name + sku:(NSString *)sku + category:(NSString *)category + price:(NSNumber *)price + quantity:(NSNumber *)quantity + currencyCode:(NSString *)currencyCode; + +/*! + Returns a GAIDictionaryBuilder object with parameters specific to a social hit. + */ ++ (GAIDictionaryBuilder *)createSocialWithNetwork:(NSString *)network + action:(NSString *)action + target:(NSString *)target; + +/*! + Returns a GAIDictionaryBuilder object with parameters specific to a timing hit. + */ ++ (GAIDictionaryBuilder *)createTimingWithCategory:(NSString *)category + interval:(NSNumber *)intervalMillis + name:(NSString *)name + label:(NSString *)label; + +/*! + Returns a GAIDictionaryBuilder object with parameters specific to a transaction + hit. + */ ++ (GAIDictionaryBuilder *)createTransactionWithId:(NSString *)transactionId + affiliation:(NSString *)affiliation + revenue:(NSNumber *)revenue + tax:(NSNumber *)tax + shipping:(NSNumber *)shipping + currencyCode:(NSString *)currencyCode; + +/*! + Set the product action field for this hit. + */ +- (GAIDictionaryBuilder *)setProductAction:(GAIEcommerceProductAction *)productAction; + +/*! + Adds a product to this hit. + */ +- (GAIDictionaryBuilder *)addProduct:(GAIEcommerceProduct *)product; + +/*! + Add a product impression to this hit. + */ +- (GAIDictionaryBuilder *)addProductImpression:(GAIEcommerceProduct *)product + impressionList:(NSString *)name + impressionSource:(NSString *)source; + +/*! + Add a promotion to this hit. + */ +- (GAIDictionaryBuilder *)addPromotion:(GAIEcommercePromotion *)promotion; +@end diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/GAIEcommerceFields.h b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/GAIEcommerceFields.h new file mode 100644 index 00000000..b3ba60ae --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/GAIEcommerceFields.h @@ -0,0 +1,124 @@ +/*! + @header GAIEcommerceFields.h + @abstract Google Analytics iOS SDK Ecommerce Hit Format Header + @copyright Copyright 2014 Google Inc. All rights reserved. + */ + +#import <Foundation/Foundation.h> + +/*! + This class provides several fields and methods useful as wire format parameters for + Enhanced Ecommerce. See the online developer guides for Enhanced Ecommerce for details + on how to use the Enhanced Ecommerce features. + */ + +// Enhanced Ecommerce Product fields +extern NSString *const kGAIProductId; +extern NSString *const kGAIProductName; +extern NSString *const kGAIProductBrand; +extern NSString *const kGAIProductCategory; +extern NSString *const kGAIProductVariant; +extern NSString *const kGAIProductPrice; +extern NSString *const kGAIProductQuantity; +extern NSString *const kGAIProductCouponCode; +extern NSString *const kGAIProductPosition; + +extern NSString *const kGAIProductAction; + +// product action values +extern NSString *const kGAIPADetail; +extern NSString *const kGAIPAClick; +extern NSString *const kGAIPAAdd; +extern NSString *const kGAIPARemove; +extern NSString *const kGAIPACheckout; +extern NSString *const kGAIPACheckoutOption; +extern NSString *const kGAIPAPurchase; +extern NSString *const kGAIPARefund; + +// product action fields +// used for 'purchase' and 'refund' actions +extern NSString *const kGAIPATransactionId; +extern NSString *const kGAIPAAffiliation; +extern NSString *const kGAIPARevenue; +extern NSString *const kGAIPATax; +extern NSString *const kGAIPAShipping; +extern NSString *const kGAIPACouponCode; +// used for 'checkout' action +extern NSString *const kGAICheckoutStep; +extern NSString *const kGAICheckoutOption; +// used for 'detail' and 'click' actions +extern NSString *const kGAIProductActionList; +extern NSString *const kGAIProductListSource; + +// Enhanced Ecommerce Impressions fields +extern NSString *const kGAIImpressionName; +extern NSString *const kGAIImpressionListSource; +extern NSString *const kGAIImpressionProduct; +extern NSString *const kGAIImpressionProductId; +extern NSString *const kGAIImpressionProductName; +extern NSString *const kGAIImpressionProductBrand; +extern NSString *const kGAIImpressionProductCategory; +extern NSString *const kGAIImpressionProductVariant; +extern NSString *const kGAIImpressionProductPosition; +extern NSString *const kGAIImpressionProductPrice; + +// Enhanced Ecommerce Promotions fields +extern NSString *const kGAIPromotionId; +extern NSString *const kGAIPromotionName; +extern NSString *const kGAIPromotionCreative; +extern NSString *const kGAIPromotionPosition; + +// Promotion actions +extern NSString *const kGAIPromotionAction; +extern NSString *const kGAIPromotionView; +extern NSString *const kGAIPromotionClick; + +@interface GAIEcommerceFields : NSObject + +/*! + Generates an enhanced ecommerce product field. Note that field names generated by + customDimensionForIndex and customMetricForIndex can be used as suffixes. + + @param index the index of the product + @param suffix the product field suffix (such as kGAIProductPrice). + + @return an NSString representing the product field parameter + */ ++ (NSString *)productFieldForIndex:(NSUInteger)index suffix:(NSString *)suffix; + +/*! + Genrates an enhanced ecommerce impression list field name with an index. The return value of + this method should also be used as input to the productImpressionForList method below. + + @param index the index of the impression list + + @return an NSString representing the impression list parameter + */ ++ (NSString *)impressionListForIndex:(NSUInteger)index; + +/*! + Generates an enhanced ecommerce product impression field with the impression list, product index + and product suffix as parameters. The output of the method impressionListForIndex above should be + used as the input list for this method. The output of customDimensionForIndex and + customMetricForIndex can be used as suffixes. + + @param list the impression list for this product impression + @param index the index of this product in the impression list + @param suffix the product impression suffix for this field + + @return an NSString representing this product impression field parameter + */ ++ (NSString *)productImpressionForList:(NSString *)list + index:(NSUInteger)index + suffix:(NSString *)Suffix; + +/*! + Generates an enhanced ecommerce promotion field with an index and suffix. + + @param index the index of the promotion + @param suffix the promotion suffix (such as kGAIPromotionId) + + @return an NSString representing this promotion field paramter + */ ++ (NSString *)promotionForIndex:(NSUInteger)index suffix:(NSString *)suffix; +@end diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/GAIEcommerceProduct.h b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/GAIEcommerceProduct.h new file mode 100644 index 00000000..029f7638 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/GAIEcommerceProduct.h @@ -0,0 +1,102 @@ +/*! + @header GAIEcommerceProduct.h + @abstract Google Analytics iOS SDK Hit Format Header + @copyright Copyright 2014 Google Inc. All rights reserved. + */ + +#import <Foundation/Foundation.h> + +/*! + * Class to construct product related information for a Google Analytics beacon. Use this class to + * report information about products sold by merchants or impressions of products seen by users. + * Instances of this class can be associated with both Product Actions and Product + * Impression Lists. + * <br> + * Typical usage: + * <code> + * [tracker set:kGAIScreenName value:@"MyScreen"]; + * GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createScreenView]; + * GAIEcommerceProduct *product = [[GAIEcommerceProduct alloc] init]; + * [product setId:@""PID-1234""]; + * [product setName:@"Space Monkeys!"]; + * [product setPrice:@100]; + * [product setQuantity:@2]; + * [builder addProductImpression:product impressionList:@"listName"]; + * [tracker send:[builder build]]; + * </code> + */ +@interface GAIEcommerceProduct : NSObject + +/*! + Sets the id that is used to identify a product in GA reports. + */ +- (GAIEcommerceProduct *)setId:(NSString *)productId; + +/*! + Sets the name that is used to indentify the product in GA reports. + */ +- (GAIEcommerceProduct *)setName:(NSString *)productName; + +/*! + Sets the brand associated with the product in GA reports. + */ +- (GAIEcommerceProduct *)setBrand:(NSString *)productBrand; + +/*! + Sets the category associated with the product in GA reports. + */ +- (GAIEcommerceProduct *)setCategory:(NSString *)productCategory; + +/*! + Sets the variant of the product. + */ +- (GAIEcommerceProduct *)setVariant:(NSString *)productVariant; + +/*! + Sets the price of the product. + */ +- (GAIEcommerceProduct *)setPrice:(NSNumber *)productPrice; + +/*! + Sets the quantity of the product. This field is usually not used with product impressions. + */ +- (GAIEcommerceProduct *)setQuantity:(NSNumber *)productQuantity; + +/*! + Sets the coupon code associated with the product. This field is usually not used with product + impressions. + */ +- (GAIEcommerceProduct *)setCouponCode:(NSString *)productCouponCode; + +/*! + Sets the position of the product on the screen/product impression list, etc. + */ +- (GAIEcommerceProduct *)setPosition:(NSNumber *)productPosition; + +/*! + Sets the custom dimension associated with this product. + */ +- (GAIEcommerceProduct *)setCustomDimension:(NSUInteger)index value:(NSString *)value; + +/*! + Sets the custom metric associated with this product. + */ +- (GAIEcommerceProduct *)setCustomMetric:(NSUInteger)index value:(NSNumber *)value; + +/*! + Builds an NSDictionary of fields stored in this instance suitable for a product action. The + index parameter is the index of this product in the product action list. + <br> + Normally, users will have no need to call this method. + */ +- (NSDictionary *)buildWithIndex:(NSUInteger)index; + +/*! + Builds an NSDictionary of fields stored in this instance suitable for an impression list. The + lIndex parameter is the index of the product impression list while the index parameter is the + index of this product in that impression list. + <br> + Normally, users will have no need to call this method. + */ +- (NSDictionary *)buildWithListIndex:(NSUInteger)lIndex index:(NSUInteger)index; +@end diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/GAIEcommerceProductAction.h b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/GAIEcommerceProductAction.h new file mode 100644 index 00000000..e3da1c15 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/GAIEcommerceProductAction.h @@ -0,0 +1,107 @@ +/*! + @header GAIProductAction.h + @abstract Google Analytics iOS SDK Hit Format Header + @copyright Copyright 2014 Google Inc. All rights reserved. + */ + +#import <Foundation/Foundation.h> + +/*! + * Class to construct transaction/checkout or other product interaction related information for a + * Google Analytics hit. Use this class to report information about products sold, viewed or + * refunded. This class is intended to be used with GAIDictionaryBuilder. + * <br> + * Typical usage: + * <code> + * [tracker set:kGAIScreenName value:@"MyScreen"]; + * GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createScreenView]; + * GAIEcommerceProductAction *action = [[GAIEcommerceProductAction alloc] init]; + * [action setAction:kGAIPAPurchase]; + * [action setTransactionId:@"TT-1234"]; + * [action setRevenue:@3.14]; + * [action setCouponCode:@"EXTRA100"]; + * [builder setProductAction:action]; + * GAIEcommerceProduct *product = [[GAIEcommerceProduct alloc] init]; + * [product setId:@""PID-1234""]; + * [product setName:@"Space Monkeys!"]; + * [product setPrice:@100]; + * [product setQuantity:@2]; + * [builder addProduct:product]; + * [tracker send:[builder build]]; + * </code> + */ +@interface GAIEcommerceProductAction : NSObject + +/*! + Sets the product action field for this product action. Valid values can be found in + GAIEcommerceFields.h under "product action values". + */ +- (GAIEcommerceProductAction *)setAction:(NSString *)productAction; + +/*! + The unique id associated with the transaction. This value is used for kGAIPAPurchase and + kGAIPARefund product actions. + */ +- (GAIEcommerceProductAction *)setTransactionId:(NSString *)transactionId; + +/*! + Sets the transaction's affiliation value. This value is used for kGAIPAPurchase and + kGAIPARefund product actions. + */ +- (GAIEcommerceProductAction *)setAffiliation:(NSString *)affiliation; + +/*! + Sets the transaction's total revenue. This value is used for kGAIPAPurchase and kGAIPARefund + product actions. + */ +- (GAIEcommerceProductAction *)setRevenue:(NSNumber *)revenue; + +/*! + Sets the transaction's total tax. This value is used for kGAIPAPurchase and kGAIPARefund + product actions. + */ +- (GAIEcommerceProductAction *)setTax:(NSNumber *)tax; + +/*! + Sets the transaction's total shipping costs. This value is used for kGAIPAPurchase and + kGAIPARefund product actions. + */ +- (GAIEcommerceProductAction *)setShipping:(NSNumber *)shipping; + +/*! + Sets the coupon code used in this transaction. This value is used for kGAIPAPurchase and + kGAIPARefund product actions. + */ +- (GAIEcommerceProductAction *)setCouponCode:(NSString *)couponCode; + +/*! + Sets the checkout process's progress. This value is used for kGAICheckout and + kGAICheckoutOptions product actions. + */ +- (GAIEcommerceProductAction *)setCheckoutStep:(NSNumber *)checkoutStep; + +/*! + Sets the option associated with the checkout. This value is used for kGAICheckout and + kGAICheckoutOptions product actions. + */ +- (GAIEcommerceProductAction *)setCheckoutOption:(NSString *)checkoutOption; + +/*! + Sets the list name associated with the products in Google Analytics beacons. This value is + used in kGAIPADetail and kGAIPAClick product actions. + */ +- (GAIEcommerceProductAction *)setProductActionList:(NSString *)productActionList; + +/*! + Sets the list source name associated with the products in Google Analytics beacons. This value + is used in kGAIPADetail and kGAIPAClick product actions. + */ +- (GAIEcommerceProductAction *)setProductListSource:(NSString *)productListSource; + +/*! + Builds an NSDictionary of fields stored in this instance representing this product action. + <br> + Normally, users will have no need to call this method. + */ +- (NSDictionary *)build; +@end diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/GAIEcommercePromotion.h b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/GAIEcommercePromotion.h new file mode 100644 index 00000000..c7bf25af --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/GAIEcommercePromotion.h @@ -0,0 +1,54 @@ +/*! + @header GAIEcommercePromotion.h + @abstract Google Analytics iOS SDK Hit Format Header + @copyright Copyright 2014 Google Inc. All rights reserved. + */ + +#import <Foundation/Foundation.h> + +/*! + * Class to construct promotion related fields for Google Analytics hits. The fields from this class + * can be used to represent internal promotions that run within an app, such as banners, banner ads + * etc. + * + * Typical usage: + * <code> + * GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createScreenView]; + * GAIEcommercePromotion *promotion = [[GAIEcommercePromotion alloc] init]; + * [promotion setId:@"PROMO-ID1234"]; + * [promotion setName:@"Home screen banner"]; + * [builder set:kGAIPromotionClick forKey:kGAIPromotionAction]; + * [builder addPromotion:promotion]; + * [tracker send:builder.build]]; + * </code> + */ +@interface GAIEcommercePromotion : NSObject + +/*! + Sets the id that is used to identify a promotion in GA reports. + */ +- (GAIEcommercePromotion *)setId:(NSString *)pid; + +/*! + Sets the name that is used to identify a promotion in GA reports. + */ +- (GAIEcommercePromotion *)setName:(NSString *)name; + +/*! + Sets the name of the creative associated with the promotion. + */ +- (GAIEcommercePromotion *)setCreative:(NSString *)creative; + +/*! + Sets the position of the promotion. + */ +- (GAIEcommercePromotion *)setPosition:(NSString *)position; + +/*! + Builds an NSDictionary of fields stored in this instance. The index parameter is the + index of this promotion in that promotion list. + <br> + Normally, users will have no need to call this method. + */ +- (NSDictionary *)buildWithIndex:(NSUInteger)index; +@end diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/GAIFields.h b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/GAIFields.h new file mode 100644 index 00000000..e54cef03 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/GAIFields.h @@ -0,0 +1,133 @@ +/*! + @header GAIFields.h + @abstract Google Analytics iOS SDK Hit Format Header + @copyright Copyright 2013 Google Inc. All rights reserved. + */ + +#import <Foundation/Foundation.h> + +/*! + These fields can be used for the wire format parameter names required by + the |GAITracker| get, set and send methods as well as the set methods in the + |GAIDictionaryBuilder| class. + */ +extern NSString *const kGAIUseSecure; + +extern NSString *const kGAIHitType; +extern NSString *const kGAITrackingId; +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; +extern NSString *const kGAIScreenColors; +extern NSString *const kGAILanguage; +extern NSString *const kGAIJavaEnabled; +extern NSString *const kGAIFlashVersion; +extern NSString *const kGAINonInteraction; +extern NSString *const kGAIReferrer; +extern NSString *const kGAILocation; +extern NSString *const kGAIHostname; +extern NSString *const kGAIPage; +extern NSString *const kGAIDescription; // synonym for kGAIScreenName +extern NSString *const kGAIScreenName; // synonym for kGAIDescription +extern NSString *const kGAITitle; +extern NSString *const kGAIAdMobHitId; +extern NSString *const kGAIAppName; +extern NSString *const kGAIAppVersion; +extern NSString *const kGAIAppId; +extern NSString *const kGAIAppInstallerId; +extern NSString *const kGAIUserId; + +extern NSString *const kGAIEventCategory; +extern NSString *const kGAIEventAction; +extern NSString *const kGAIEventLabel; +extern NSString *const kGAIEventValue; + +extern NSString *const kGAISocialNetwork; +extern NSString *const kGAISocialAction; +extern NSString *const kGAISocialTarget; + +extern NSString *const kGAITransactionId; +extern NSString *const kGAITransactionAffiliation; +extern NSString *const kGAITransactionRevenue; +extern NSString *const kGAITransactionShipping; +extern NSString *const kGAITransactionTax; +extern NSString *const kGAICurrencyCode; + +extern NSString *const kGAIItemPrice; +extern NSString *const kGAIItemQuantity; +extern NSString *const kGAIItemSku; +extern NSString *const kGAIItemName; +extern NSString *const kGAIItemCategory; + +extern NSString *const kGAICampaignSource; +extern NSString *const kGAICampaignMedium; +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; +extern NSString *const kGAITimingValue; +extern NSString *const kGAITimingLabel; + +extern NSString *const kGAIExDescription; +extern NSString *const kGAIExFatal; + +extern NSString *const kGAISampleRate; + +extern NSString *const kGAIIdfa; +extern NSString *const kGAIAdTargetingEnabled; + +// hit types +extern NSString *const kGAIAppView DEPRECATED_MSG_ATTRIBUTE("Use kGAIScreenView instead."); +extern NSString *const kGAIScreenView; +extern NSString *const kGAIEvent; +extern NSString *const kGAISocial; +extern NSString *const kGAITransaction; +extern NSString *const kGAIItem; +extern NSString *const kGAIException; +extern NSString *const kGAITiming; + +/*! + This class provides several fields and methods useful as wire format parameter + names. The methods are used for wire format parameter names that are indexed. + */ + +@interface GAIFields : NSObject + +/*! + Generates the correct parameter name for a content group with an index. + + @param index the index of the content group. + + @return an NSString representing the content group parameter for the index. + */ ++ (NSString *)contentGroupForIndex:(NSUInteger)index; + +/*! + Generates the correct parameter name for a custon dimension with an index. + + @param index the index of the custom dimension. + + @return an NSString representing the custom dimension parameter for the index. + */ ++ (NSString *)customDimensionForIndex:(NSUInteger)index; + +/*! + Generates the correct parameter name for a custom metric with an index. + + @param index the index of the custom metric. + + @return an NSString representing the custom metric parameter for the index. + */ ++ (NSString *)customMetricForIndex:(NSUInteger)index; + +@end diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/GAILogger.h b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/GAILogger.h new file mode 100644 index 00000000..06291f2c --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/GAILogger.h @@ -0,0 +1,49 @@ +/*! + @header GAILogger.h + @abstract Google Analytics iOS SDK Source + @copyright Copyright 2011 Google Inc. All rights reserved. + */ + +#import <Foundation/Foundation.h> + +typedef NS_ENUM(NSUInteger, GAILogLevel) { + kGAILogLevelNone = 0, + kGAILogLevelError = 1, + kGAILogLevelWarning = 2, + kGAILogLevelInfo = 3, + kGAILogLevelVerbose = 4 +}; + +/*! + Protocol to be used for logging debug and informational messages from the SDK. + Implementations of this protocol can be provided to the |GAI| class, + to be used as the logger by the SDK. See the |logger| property in GAI.h. + */ +@protocol GAILogger<NSObject> +@required + +/*! + Only messages of |logLevel| and below are logged. + */ +@property (nonatomic, assign) GAILogLevel logLevel; + +/*! + Logs message with log level |kGAILogLevelVerbose|. + */ +- (void)verbose:(NSString *)message; + +/*! + Logs message with log level |kGAILogLevelInfo|. + */ +- (void)info:(NSString *)message; + +/*! + Logs message with log level |kGAILogLevelWarning|. + */ +- (void)warning:(NSString *)message; + +/*! + Logs message with log level |kGAILogLevelError|. + */ +- (void)error:(NSString *)message; +@end diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/GAITrackedViewController.h b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/GAITrackedViewController.h new file mode 100644 index 00000000..de19def0 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/GAITrackedViewController.h @@ -0,0 +1,33 @@ +/*! + @header GAITrackedViewController.h + @abstract Google Analytics for iOS Tracked View Controller Header + @copyright Copyright 2012 Google Inc. All rights reserved. + */ + +#import <Foundation/Foundation.h> +#import <UIKit/UIKit.h> + +@protocol GAITracker; + +/*! + 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. + + By default, this will use [GAI defaultTracker] for tracking calls, but one can + override this by setting the tracker property. + */ +@interface GAITrackedViewController : UIViewController + +/*! + The tracker on which view tracking calls are be made, or `nil`, in which case + [GAI defaultTracker] will be used. + */ +@property(nonatomic, assign) id<GAITracker> tracker; +/*! + The screen name, for purposes of Google Analytics tracking. If this is `nil`, + no tracking calls will be made. + */ +@property(nonatomic, copy) NSString *screenName; + +@end diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/GAITracker.h b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/GAITracker.h new file mode 100644 index 00000000..fdc5c5df --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/GAITracker.h @@ -0,0 +1,57 @@ +/*! + @header GAITracker.h + @abstract Google Analytics iOS SDK Tracker Header + @copyright Copyright 2013 Google Inc. All rights reserved. +*/ + +#import <Foundation/Foundation.h> + +/*! + Google Analytics tracking interface. Obtain instances of this interface from + [GAI trackerWithTrackingId:] to track screens, events, transactions, timing, + and exceptions. The implementation of this interface is thread-safe, and no + calls are expected to block or take a long time. All network and disk activity + will take place in the background. + */ +@protocol GAITracker<NSObject> + +/*! + Name of this tracker. + */ +@property(nonatomic, readonly) NSString *name; + +/*! + Allow collection of IDFA and related fields if set to true. Default is false. + */ +@property(nonatomic) BOOL allowIDFACollection; + +/*! + Set a tracking parameter. + + @param parameterName The parameter name. + + @param value The value to set for the parameter. If this is nil, the + value for the parameter will be cleared. + */ +- (void)set:(NSString *)parameterName + value:(NSString *)value; + +/*! + Get a tracking parameter. + + @param parameterName The parameter name. + + @returns The parameter value, or nil if no value for the given parameter is + set. + */ +- (NSString *)get:(NSString *)parameterName; + +/*! + Queue tracking information with the given parameter values. + + @param parameters A map from parameter names to parameter values which will be + set just for this piece of tracking information, or nil for none. + */ +- (void)send:(NSDictionary *)parameters; + +@end diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/UniversalAnalyticsPlugin.h b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/UniversalAnalyticsPlugin.h new file mode 100644 index 00000000..dde480ac --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/UniversalAnalyticsPlugin.h @@ -0,0 +1,34 @@ +//UniversalAnalyticsPlugin.h +//Created by Daniel Wilson 2013-09-19 + +#import <Foundation/Foundation.h> +#import <Cordova/CDV.h> +#import "GAI.h" + +@interface UniversalAnalyticsPlugin : CDVPlugin { + bool _trackerStarted; + bool _debugMode; + NSMutableDictionary *_customDimensions; +} + +- (void) startTrackerWithId: (CDVInvokedUrlCommand*)command; +- (void) setAllowIDFACollection: (CDVInvokedUrlCommand*) command; +- (void) setUserId: (CDVInvokedUrlCommand*)command; +- (void) setAppVersion: (CDVInvokedUrlCommand*)command; +- (void) getVar: (CDVInvokedUrlCommand*)command; +- (void) setVar: (CDVInvokedUrlCommand*)command; +- (void) dispatch: (CDVInvokedUrlCommand*)command; +- (void) debugMode: (CDVInvokedUrlCommand*)command; +- (void) setOptOut: (CDVInvokedUrlCommand*)command; +- (void) enableUncaughtExceptionReporting: (CDVInvokedUrlCommand*)command; +- (void) addCustomDimension: (CDVInvokedUrlCommand*)command; +- (void) trackEvent: (CDVInvokedUrlCommand*)command; +- (void) trackMetric: (CDVInvokedUrlCommand*)command; +- (void) trackTiming: (CDVInvokedUrlCommand*)command; +- (void) trackView: (CDVInvokedUrlCommand*)command; +- (void) trackException: (CDVInvokedUrlCommand*)command; +- (void) addTransaction: (CDVInvokedUrlCommand*)command; +- (void) addTransactionItem: (CDVInvokedUrlCommand*)command; + +@end + diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/UniversalAnalyticsPlugin.m b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/UniversalAnalyticsPlugin.m new file mode 100644 index 00000000..12355da6 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/UniversalAnalyticsPlugin.m @@ -0,0 +1,543 @@ +//UniversalAnalyticsPlugin.m +//Created by Daniel Wilson 2013-09-19 + +#import "UniversalAnalyticsPlugin.h" +#import "GAI.h" +#import "GAIDictionaryBuilder.h" +#import "GAIFields.h" + +@implementation UniversalAnalyticsPlugin + +- (void) pluginInitialize +{ + _debugMode = false; + _trackerStarted = false; + _customDimensions = nil; +} + +- (void) startTrackerWithId: (CDVInvokedUrlCommand*)command +{ + [self.commandDelegate runInBackground:^{ + CDVPluginResult* pluginResult = nil; + NSString* accountId = [command.arguments objectAtIndex:0]; + NSNumber* dispatchPeriod = [command.arguments objectAtIndex:1]; + + if ([dispatchPeriod isKindOfClass:[NSNumber class]]) + [GAI sharedInstance].dispatchInterval = [dispatchPeriod doubleValue]; + else + [GAI sharedInstance].dispatchInterval = 30; + + [[GAI sharedInstance] trackerWithTrackingId:accountId]; + + _trackerStarted = true; + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + }]; + /* NSLog(@"successfully started GAI tracker"); */ +} + +- (void) setAllowIDFACollection: (CDVInvokedUrlCommand*) command +{ + CDVPluginResult* pluginResult = nil; + if ( ! _trackerStarted) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Tracker not started"]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + return; + } + + id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker]; + tracker.allowIDFACollection = [[command argumentAtIndex:0 withDefault:@(NO)] boolValue]; +} + +- (void) addCustomDimensionsToTracker: (id<GAITracker>)tracker +{ + if (_customDimensions) { + for (NSString *key in _customDimensions.allKeys) { + NSString *value = [_customDimensions objectForKey:key]; + + NSNumberFormatter *f = [[NSNumberFormatter alloc] init]; + f.numberStyle = NSNumberFormatterDecimalStyle; + NSNumber *myKey = [f numberFromString:key]; + + /* NSLog(@"Setting tracker dimension slot %@: <%@>", key, value); */ + [tracker set:[GAIFields customDimensionForIndex:myKey.unsignedIntegerValue] + value:value]; + } + } +} + +- (void) getVar: (CDVInvokedUrlCommand*) command +{ + [self.commandDelegate runInBackground:^{ + CDVPluginResult* pluginResult = nil; + if ( ! _trackerStarted) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Tracker not started"]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + return; + } + + id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker]; + NSString* parameterName = [command.arguments objectAtIndex:0]; + NSString* result = [tracker get:parameterName]; + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:result]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + }]; +} + +- (void) setVar: (CDVInvokedUrlCommand*) command +{ + [self.commandDelegate runInBackground:^{ + CDVPluginResult* pluginResult = nil; + if ( ! _trackerStarted) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Tracker not started"]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + return; + } + + id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker]; + NSString* parameterName = [command.arguments objectAtIndex:0]; + NSString* parameter = [command.arguments objectAtIndex:1]; + [tracker set:parameterName value:parameter]; + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + }]; +} + +- (void) dispatch: (CDVInvokedUrlCommand*) command +{ + [[GAI sharedInstance] dispatch]; +} + +- (void) debugMode: (CDVInvokedUrlCommand*) command +{ + _debugMode = true; + [[GAI sharedInstance].logger setLogLevel:kGAILogLevelVerbose]; +} + +- (void) setUserId: (CDVInvokedUrlCommand*)command +{ + CDVPluginResult* pluginResult = nil; + NSString* userId = [command.arguments objectAtIndex:0]; + + if ( ! _trackerStarted) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Tracker not started"]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + return; + } + + id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker]; + [tracker set:@"&uid" value: userId]; + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; +} + +- (void) setAnonymizeIp: (CDVInvokedUrlCommand*)command +{ + CDVPluginResult* pluginResult = nil; + NSString* anonymize = [command.arguments objectAtIndex:0]; + + if ( ! _trackerStarted) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Tracker not started"]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + return; + } + + id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker]; + [tracker set:kGAIAnonymizeIp value:anonymize]; + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; +} + +- (void) setOptOut: (CDVInvokedUrlCommand*)command +{ + CDVPluginResult* pluginResult = nil; + bool optout = [[command.arguments objectAtIndex:0] boolValue]; + + if ( ! _trackerStarted) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Tracker not started"]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + return; + } + + [[GAI sharedInstance] setOptOut:optout]; + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; +} + +- (void) setAppVersion: (CDVInvokedUrlCommand*)command +{ + CDVPluginResult* pluginResult = nil; + NSString* version = [command.arguments objectAtIndex:0]; + + if ( ! _trackerStarted) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Tracker not started"]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + return; + } + + id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker]; + [tracker set:@"&av" value: version]; + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; +} + +- (void) enableUncaughtExceptionReporting: (CDVInvokedUrlCommand*)command +{ + CDVPluginResult* pluginResult = nil; + + if ( ! _trackerStarted) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Tracker not started"]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + return; + } + + bool enabled = [[command.arguments objectAtIndex:0] boolValue]; + [[GAI sharedInstance] setTrackUncaughtExceptions:enabled]; + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; +} + +- (void) addCustomDimension: (CDVInvokedUrlCommand*)command +{ + CDVPluginResult* pluginResult = nil; + NSNumber* key = [command.arguments objectAtIndex:0]; + NSString* value = [command.arguments objectAtIndex:1]; + + if ( ! _customDimensions) { + _customDimensions = [[NSMutableDictionary alloc] init]; + } + + _customDimensions[key.stringValue] = value; + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; +} + +- (void) trackMetric: (CDVInvokedUrlCommand*)command +{ + CDVPluginResult* pluginResult = nil; + + if ( ! _trackerStarted) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Tracker not started"]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + return; + } + + [self.commandDelegate runInBackground:^{ + CDVPluginResult* pluginResult = nil; + NSNumber *key = nil; + NSString *value = nil; + + if ([command.arguments count] > 0) + key = [command.arguments objectAtIndex:0]; + + if ([command.arguments count] > 1) + value = [command.arguments objectAtIndex:1]; + + id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker]; + + [tracker set:[GAIFields customMetricForIndex:[key intValue]] value:value]; + + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + }]; +} + +- (void) trackEvent: (CDVInvokedUrlCommand*)command +{ + CDVPluginResult* pluginResult = nil; + + if ( ! _trackerStarted) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Tracker not started"]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + return; + } + + [self.commandDelegate runInBackground:^{ + CDVPluginResult* pluginResult = nil; + NSString *category = nil; + NSString *action = nil; + NSString *label = nil; + NSNumber *value = nil; + + if ([command.arguments count] > 0) + category = [command.arguments objectAtIndex:0]; + + if ([command.arguments count] > 1) + action = [command.arguments objectAtIndex:1]; + + if ([command.arguments count] > 2) + label = [command.arguments objectAtIndex:2]; + + if ([command.arguments count] > 3) + value = [command.arguments objectAtIndex:3]; + + bool newSession = [[command argumentAtIndex:4 withDefault:@(NO)] boolValue]; + + id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker]; + + [self addCustomDimensionsToTracker:tracker]; + + GAIDictionaryBuilder *builder = [GAIDictionaryBuilder + createEventWithCategory: category //required + action: action //required + label: label + value: value]; + if(newSession){ + [builder set:@"start" forKey:kGAISessionControl]; + } + [tracker send:[builder build]]; + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + + }]; + +} + +- (void) trackException: (CDVInvokedUrlCommand*)command +{ + CDVPluginResult* pluginResult = nil; + + if ( ! _trackerStarted) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Tracker not started"]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + return; + } + + [self.commandDelegate runInBackground:^{ + CDVPluginResult* pluginResult = nil; + NSString *description = nil; + NSNumber *fatal = nil; + + if ([command.arguments count] > 0) + description = [command.arguments objectAtIndex:0]; + + if ([command.arguments count] > 1) + fatal = [command.arguments objectAtIndex:1]; + + id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker]; + + [self addCustomDimensionsToTracker:tracker]; + + [tracker send:[[GAIDictionaryBuilder createScreenView] build]]; + + [tracker send:[[GAIDictionaryBuilder + createExceptionWithDescription: description + withFatal: fatal] build]]; + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + }]; +} + +- (void) trackView: (CDVInvokedUrlCommand*)command +{ + CDVPluginResult* pluginResult = nil; + + if ( ! _trackerStarted) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Tracker not started"]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + return; + } + + [self.commandDelegate runInBackground:^{ + CDVPluginResult* pluginResult = nil; + NSString* screenName = [command.arguments objectAtIndex:0]; + + id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker]; + [self addCustomDimensionsToTracker:tracker]; + + NSString* deepLinkUrl = [command.arguments objectAtIndex:1]; + GAIDictionaryBuilder* openParams = [[GAIDictionaryBuilder alloc] init]; + + if (deepLinkUrl && deepLinkUrl != (NSString *)[NSNull null]) { + [[openParams setCampaignParametersFromUrl:deepLinkUrl] build]; + } + + bool newSession = [[command argumentAtIndex:2 withDefault:@(NO)] boolValue]; + if(newSession){ + [openParams set:@"start" forKey:kGAISessionControl]; + } + + NSDictionary *hitParamsDict = [openParams build]; + + [tracker set:kGAIScreenName value:screenName]; + [tracker send:[[[GAIDictionaryBuilder createScreenView] setAll:hitParamsDict] build]]; + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + }]; +} + +- (void) trackTiming: (CDVInvokedUrlCommand*)command +{ + CDVPluginResult* pluginResult = nil; + + if ( ! _trackerStarted) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Tracker not started"]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + return; + } + + [self.commandDelegate runInBackground:^{ + CDVPluginResult* pluginResult = nil; + + NSString *category = nil; + NSNumber *intervalInMilliseconds = nil; + NSString *name = nil; + NSString *label = nil; + + if ([command.arguments count] > 0) + category = [command.arguments objectAtIndex:0]; + + if ([command.arguments count] > 1) + intervalInMilliseconds = [command.arguments objectAtIndex:1]; + + if ([command.arguments count] > 2) + name = [command.arguments objectAtIndex:2]; + + if ([command.arguments count] > 3) + label = [command.arguments objectAtIndex:3]; + + id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker]; + + [self addCustomDimensionsToTracker:tracker]; + + [tracker send:[[GAIDictionaryBuilder + createTimingWithCategory: category //required + interval: intervalInMilliseconds //required + name: name + label: label] build]]; + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + }]; +} + +- (void) addTransaction: (CDVInvokedUrlCommand*)command +{ + CDVPluginResult* pluginResult = nil; + + if ( ! _trackerStarted) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Tracker not started"]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + return; + } + + [self.commandDelegate runInBackground:^{ + CDVPluginResult* pluginResult = nil; + + NSString *transactionId = nil; + NSString *affiliation = nil; + NSNumber *revenue = nil; + NSNumber *tax = nil; + NSNumber *shipping = nil; + NSString *currencyCode = nil; + + + if ([command.arguments count] > 0) + transactionId = [command.arguments objectAtIndex:0]; + + if ([command.arguments count] > 1) + affiliation = [command.arguments objectAtIndex:1]; + + if ([command.arguments count] > 2) + revenue = [command.arguments objectAtIndex:2]; + + if ([command.arguments count] > 3) + tax = [command.arguments objectAtIndex:3]; + + if ([command.arguments count] > 4) + shipping = [command.arguments objectAtIndex:4]; + + if ([command.arguments count] > 5) + currencyCode = [command.arguments objectAtIndex:5]; + + id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker]; + + + [tracker send:[[GAIDictionaryBuilder createTransactionWithId:transactionId // (NSString) Transaction ID + affiliation:affiliation // (NSString) Affiliation + revenue:revenue // (NSNumber) Order revenue (including tax and shipping) + tax:tax // (NSNumber) Tax + shipping:shipping // (NSNumber) Shipping + currencyCode:currencyCode] build]]; // (NSString) Currency code + + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + }]; +} + + + +- (void) addTransactionItem: (CDVInvokedUrlCommand*)command +{ + CDVPluginResult* pluginResult = nil; + + if ( ! _trackerStarted) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Tracker not started"]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + return; + } + + [self.commandDelegate runInBackground:^{ + + CDVPluginResult* pluginResult = nil; + NSString *transactionId = nil; + NSString *name = nil; + NSString *sku = nil; + NSString *category = nil; + NSNumber *price = nil; + NSNumber *quantity = nil; + NSString *currencyCode = nil; + + + if ([command.arguments count] > 0) + transactionId = [command.arguments objectAtIndex:0]; + + if ([command.arguments count] > 1) + name = [command.arguments objectAtIndex:1]; + + if ([command.arguments count] > 2) + sku = [command.arguments objectAtIndex:2]; + + if ([command.arguments count] > 3) + category = [command.arguments objectAtIndex:3]; + + if ([command.arguments count] > 4) + price = [command.arguments objectAtIndex:4]; + + if ([command.arguments count] > 5) + quantity = [command.arguments objectAtIndex:5]; + + if ([command.arguments count] > 6) + currencyCode = [command.arguments objectAtIndex:6]; + + id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker]; + + + [tracker send:[[GAIDictionaryBuilder createItemWithTransactionId:transactionId // (NSString) Transaction ID + name:name // (NSString) Product Name + sku:sku // (NSString) Product SKU + category:category // (NSString) Product category + price:price // (NSNumber) Product price + quantity:quantity // (NSNumber) Product quantity + currencyCode:currencyCode] build]]; // (NSString) Currency code + + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + }]; +} + +@end diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/libAdIdAccess.a b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/libAdIdAccess.a Binary files differnew file mode 100644 index 00000000..9813beaf --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/libAdIdAccess.a diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/libGoogleAnalyticsServices.a b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/libGoogleAnalyticsServices.a Binary files differnew file mode 100644 index 00000000..45ca87e8 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-google-analytics/libGoogleAnalyticsServices.a diff --git a/StoneIsland/platforms/ios/Stone Island/config.xml b/StoneIsland/platforms/ios/Stone Island/config.xml index 19f7b057..89ade77f 100755 --- a/StoneIsland/platforms/ios/Stone Island/config.xml +++ b/StoneIsland/platforms/ios/Stone Island/config.xml @@ -86,4 +86,7 @@ <preference name="SplashMaintainAspectRatio" value="true" /> <preference name="ShowSplashScreenSpinner" value="false" /> <preference name="AutoHideSplashScreen" value="false" /> + <feature name="UniversalAnalytics"> + <param name="ios-package" value="UniversalAnalyticsPlugin" /> + </feature> </widget> diff --git a/StoneIsland/platforms/ios/frameworks.json b/StoneIsland/platforms/ios/frameworks.json index 6cb97880..dc881b1d 100644 --- a/StoneIsland/platforms/ios/frameworks.json +++ b/StoneIsland/platforms/ios/frameworks.json @@ -2,10 +2,14 @@ "AudioToolbox.framework": 1, "CoreLocation.framework": 1, "Social.framework": 1, - "SystemConfiguration.framework": 1, + "SystemConfiguration.framework": 2, "CoreTelephony.framework": 1, "MessageUI.framework": 1, "AddressBook.framework": 1, "libsqlite3.tbd": 1, - "libz.tbd": 1 + "libz.tbd": 1, + "CoreData.framework": 1, + "AdSupport.framework": 1, + "libz.dylib": 1, + "libsqlite3.dylib": 1 }
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/ios.json b/StoneIsland/platforms/ios/ios.json index 0a8ab85c..800f8e02 100644 --- a/StoneIsland/platforms/ios/ios.json +++ b/StoneIsland/platforms/ios/ios.json @@ -47,6 +47,10 @@ { "xml": "<feature name=\"PushNotification\"><param name=\"ios-package\" value=\"PushPlugin\" /></feature>", "count": 1 + }, + { + "xml": "<feature name=\"UniversalAnalytics\"><param name=\"ios-package\" value=\"UniversalAnalyticsPlugin\" /></feature>", + "count": 1 } ] } @@ -148,6 +152,9 @@ "phonegap-plugin-push": { "SENDER_ID": "XXXXXXX", "PACKAGE_NAME": "us.okfoc.stoneisland" + }, + "cordova-plugin-google-analytics": { + "PACKAGE_NAME": "us.okfoc.stoneisland" } }, "dependent_plugins": {}, @@ -282,6 +289,15 @@ "clobbers": [ "PushNotification" ] + }, + { + "id": "cordova-plugin-google-analytics.UniversalAnalytics", + "file": "plugins/cordova-plugin-google-analytics/www/analytics.js", + "pluginId": "cordova-plugin-google-analytics", + "clobbers": [ + "analytics", + "ga" + ] } ], "plugin_metadata": { @@ -297,6 +313,7 @@ "cordova-plugin-whitelist": "1.3.0", "cordova-plugin-x-socialsharing": "5.1.3", "ionic-plugin-keyboard": "2.2.1", - "phonegap-plugin-push": "1.9.2" + "phonegap-plugin-push": "1.9.2", + "cordova-plugin-google-analytics": "1.8.3" } }
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/platform_www/cordova_plugins.js b/StoneIsland/platforms/ios/platform_www/cordova_plugins.js index 4c67a219..878291ea 100644 --- a/StoneIsland/platforms/ios/platform_www/cordova_plugins.js +++ b/StoneIsland/platforms/ios/platform_www/cordova_plugins.js @@ -130,6 +130,15 @@ module.exports = [ "clobbers": [ "PushNotification" ] + }, + { + "id": "cordova-plugin-google-analytics.UniversalAnalytics", + "file": "plugins/cordova-plugin-google-analytics/www/analytics.js", + "pluginId": "cordova-plugin-google-analytics", + "clobbers": [ + "analytics", + "ga" + ] } ]; module.exports.metadata = @@ -147,7 +156,8 @@ module.exports.metadata = "cordova-plugin-whitelist": "1.3.0", "cordova-plugin-x-socialsharing": "5.1.3", "ionic-plugin-keyboard": "2.2.1", - "phonegap-plugin-push": "1.9.2" + "phonegap-plugin-push": "1.9.2", + "cordova-plugin-google-analytics": "1.8.3" }; // BOTTOM OF METADATA });
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-google-analytics/www/analytics.js b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-google-analytics/www/analytics.js new file mode 100644 index 00000000..b46b19ea --- /dev/null +++ b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-google-analytics/www/analytics.js @@ -0,0 +1,130 @@ +cordova.define("cordova-plugin-google-analytics.UniversalAnalytics", function(require, exports, module) { +function UniversalAnalyticsPlugin() {} + +UniversalAnalyticsPlugin.prototype.startTrackerWithId = function(id, dispatchPeriod, success, error) { + if (typeof dispatchPeriod === 'undefined' || dispatchPeriod === null) { + dispatchPeriod = 30; + } else if (typeof dispatchPeriod === 'function' && typeof error === 'undefined') { + // Called without dispatchPeriod but with a callback. + // Looks like the original API was used so shift parameters over to remain compatible. + error = success; + success = dispatchPeriod; + dispatchPeriod = 30; + } + cordova.exec(success, error, 'UniversalAnalytics', 'startTrackerWithId', [id, dispatchPeriod]); +}; + +UniversalAnalyticsPlugin.prototype.setAllowIDFACollection = function(enable, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'setAllowIDFACollection', [enable]); +}; + +UniversalAnalyticsPlugin.prototype.setUserId = function(id, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'setUserId', [id]); +}; + +UniversalAnalyticsPlugin.prototype.setAnonymizeIp = function(anonymize, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'setAnonymizeIp', [anonymize]); +}; + +UniversalAnalyticsPlugin.prototype.setOptOut = function(optout, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'setOptOut', [optout]); +}; + +UniversalAnalyticsPlugin.prototype.setAppVersion = function(version, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'setAppVersion', [version]); +}; + +UniversalAnalyticsPlugin.prototype.getVar = function(variable, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'getVar', [variable]); +}; + +UniversalAnalyticsPlugin.prototype.setVar = function(variable, value, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'setVar', [variable, value]); +}; + +UniversalAnalyticsPlugin.prototype.dispatch = function(success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'dispatch', []); +}; + +/* enables verbose logging */ +UniversalAnalyticsPlugin.prototype.debugMode = function(success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'debugMode', []); +}; + +UniversalAnalyticsPlugin.prototype.trackMetric = function(key, value, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'trackMetric', [key, value]); +}; + +UniversalAnalyticsPlugin.prototype.trackView = function(screen, campaignUrl, newSession, success, error) { + if (typeof campaignUrl === 'undefined' || campaignUrl === null) { + campaignUrl = ''; + } + + if (typeof newSession === 'undefined' || newSession === null) { + newSession = false; + } + + cordova.exec(success, error, 'UniversalAnalytics', 'trackView', [screen, campaignUrl, newSession]); +}; + +UniversalAnalyticsPlugin.prototype.addCustomDimension = function(key, value, success, error) { + if (typeof key !== "number") { + throw Error("key must be a valid integer not '" + typeof key + "'"); + } + cordova.exec(success, error, 'UniversalAnalytics', 'addCustomDimension', [key, value]); +}; + +UniversalAnalyticsPlugin.prototype.trackEvent = function(category, action, label, value, newSession, success, error) { + if (typeof label === 'undefined' || label === null) { + label = ''; + } + if (typeof value === 'undefined' || value === null) { + value = 0; + } + + if (typeof newSession === 'undefined' || newSession === null) { + newSession = false; + } + + cordova.exec(success, error, 'UniversalAnalytics', 'trackEvent', [category, action, label, value, newSession]); +}; + +/** + * https://developers.google.com/analytics/devguides/collection/android/v3/exceptions + */ +UniversalAnalyticsPlugin.prototype.trackException = function(description, fatal, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'trackException', [description, fatal]); +}; + +UniversalAnalyticsPlugin.prototype.trackTiming = function(category, intervalInMilliseconds, name, label, success, error) { + if (typeof intervalInMilliseconds === 'undefined' || intervalInMilliseconds === null) { + intervalInMilliseconds = 0; + } + if (typeof name === 'undefined' || name === null) { + name = ''; + } + if (typeof label === 'undefined' || label === null) { + label = ''; + } + + cordova.exec(success, error, 'UniversalAnalytics', 'trackTiming', [category, intervalInMilliseconds, name, label]); +}; + +/* Google Analytics e-Commerce Tracking */ +/* https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce */ +UniversalAnalyticsPlugin.prototype.addTransaction = function(transactionId, affiliation, revenue, tax, shipping, currencyCode, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'addTransaction', [transactionId, affiliation, revenue, tax, shipping, currencyCode]); +}; + +UniversalAnalyticsPlugin.prototype.addTransactionItem = function(transactionId, name ,sku, category, price, quantity, currencyCode, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'addTransactionItem', [transactionId, name ,sku, category, price, quantity, currencyCode]); +}; + +/* automatic uncaught exception tracking */ +UniversalAnalyticsPlugin.prototype.enableUncaughtExceptionReporting = function (enable, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'enableUncaughtExceptionReporting', [enable]); +}; + +module.exports = new UniversalAnalyticsPlugin(); + +}); diff --git a/StoneIsland/platforms/ios/www/cordova_plugins.js b/StoneIsland/platforms/ios/www/cordova_plugins.js index 4c67a219..878291ea 100644 --- a/StoneIsland/platforms/ios/www/cordova_plugins.js +++ b/StoneIsland/platforms/ios/www/cordova_plugins.js @@ -130,6 +130,15 @@ module.exports = [ "clobbers": [ "PushNotification" ] + }, + { + "id": "cordova-plugin-google-analytics.UniversalAnalytics", + "file": "plugins/cordova-plugin-google-analytics/www/analytics.js", + "pluginId": "cordova-plugin-google-analytics", + "clobbers": [ + "analytics", + "ga" + ] } ]; module.exports.metadata = @@ -147,7 +156,8 @@ module.exports.metadata = "cordova-plugin-whitelist": "1.3.0", "cordova-plugin-x-socialsharing": "5.1.3", "ionic-plugin-keyboard": "2.2.1", - "phonegap-plugin-push": "1.9.2" + "phonegap-plugin-push": "1.9.2", + "cordova-plugin-google-analytics": "1.8.3" }; // BOTTOM OF METADATA });
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/www/plugins/cordova-plugin-google-analytics/www/analytics.js b/StoneIsland/platforms/ios/www/plugins/cordova-plugin-google-analytics/www/analytics.js new file mode 100644 index 00000000..b46b19ea --- /dev/null +++ b/StoneIsland/platforms/ios/www/plugins/cordova-plugin-google-analytics/www/analytics.js @@ -0,0 +1,130 @@ +cordova.define("cordova-plugin-google-analytics.UniversalAnalytics", function(require, exports, module) { +function UniversalAnalyticsPlugin() {} + +UniversalAnalyticsPlugin.prototype.startTrackerWithId = function(id, dispatchPeriod, success, error) { + if (typeof dispatchPeriod === 'undefined' || dispatchPeriod === null) { + dispatchPeriod = 30; + } else if (typeof dispatchPeriod === 'function' && typeof error === 'undefined') { + // Called without dispatchPeriod but with a callback. + // Looks like the original API was used so shift parameters over to remain compatible. + error = success; + success = dispatchPeriod; + dispatchPeriod = 30; + } + cordova.exec(success, error, 'UniversalAnalytics', 'startTrackerWithId', [id, dispatchPeriod]); +}; + +UniversalAnalyticsPlugin.prototype.setAllowIDFACollection = function(enable, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'setAllowIDFACollection', [enable]); +}; + +UniversalAnalyticsPlugin.prototype.setUserId = function(id, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'setUserId', [id]); +}; + +UniversalAnalyticsPlugin.prototype.setAnonymizeIp = function(anonymize, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'setAnonymizeIp', [anonymize]); +}; + +UniversalAnalyticsPlugin.prototype.setOptOut = function(optout, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'setOptOut', [optout]); +}; + +UniversalAnalyticsPlugin.prototype.setAppVersion = function(version, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'setAppVersion', [version]); +}; + +UniversalAnalyticsPlugin.prototype.getVar = function(variable, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'getVar', [variable]); +}; + +UniversalAnalyticsPlugin.prototype.setVar = function(variable, value, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'setVar', [variable, value]); +}; + +UniversalAnalyticsPlugin.prototype.dispatch = function(success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'dispatch', []); +}; + +/* enables verbose logging */ +UniversalAnalyticsPlugin.prototype.debugMode = function(success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'debugMode', []); +}; + +UniversalAnalyticsPlugin.prototype.trackMetric = function(key, value, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'trackMetric', [key, value]); +}; + +UniversalAnalyticsPlugin.prototype.trackView = function(screen, campaignUrl, newSession, success, error) { + if (typeof campaignUrl === 'undefined' || campaignUrl === null) { + campaignUrl = ''; + } + + if (typeof newSession === 'undefined' || newSession === null) { + newSession = false; + } + + cordova.exec(success, error, 'UniversalAnalytics', 'trackView', [screen, campaignUrl, newSession]); +}; + +UniversalAnalyticsPlugin.prototype.addCustomDimension = function(key, value, success, error) { + if (typeof key !== "number") { + throw Error("key must be a valid integer not '" + typeof key + "'"); + } + cordova.exec(success, error, 'UniversalAnalytics', 'addCustomDimension', [key, value]); +}; + +UniversalAnalyticsPlugin.prototype.trackEvent = function(category, action, label, value, newSession, success, error) { + if (typeof label === 'undefined' || label === null) { + label = ''; + } + if (typeof value === 'undefined' || value === null) { + value = 0; + } + + if (typeof newSession === 'undefined' || newSession === null) { + newSession = false; + } + + cordova.exec(success, error, 'UniversalAnalytics', 'trackEvent', [category, action, label, value, newSession]); +}; + +/** + * https://developers.google.com/analytics/devguides/collection/android/v3/exceptions + */ +UniversalAnalyticsPlugin.prototype.trackException = function(description, fatal, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'trackException', [description, fatal]); +}; + +UniversalAnalyticsPlugin.prototype.trackTiming = function(category, intervalInMilliseconds, name, label, success, error) { + if (typeof intervalInMilliseconds === 'undefined' || intervalInMilliseconds === null) { + intervalInMilliseconds = 0; + } + if (typeof name === 'undefined' || name === null) { + name = ''; + } + if (typeof label === 'undefined' || label === null) { + label = ''; + } + + cordova.exec(success, error, 'UniversalAnalytics', 'trackTiming', [category, intervalInMilliseconds, name, label]); +}; + +/* Google Analytics e-Commerce Tracking */ +/* https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce */ +UniversalAnalyticsPlugin.prototype.addTransaction = function(transactionId, affiliation, revenue, tax, shipping, currencyCode, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'addTransaction', [transactionId, affiliation, revenue, tax, shipping, currencyCode]); +}; + +UniversalAnalyticsPlugin.prototype.addTransactionItem = function(transactionId, name ,sku, category, price, quantity, currencyCode, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'addTransactionItem', [transactionId, name ,sku, category, price, quantity, currencyCode]); +}; + +/* automatic uncaught exception tracking */ +UniversalAnalyticsPlugin.prototype.enableUncaughtExceptionReporting = function (enable, success, error) { + cordova.exec(success, error, 'UniversalAnalytics', 'enableUncaughtExceptionReporting', [enable]); +}; + +module.exports = new UniversalAnalyticsPlugin(); + +}); |
