├── .gitignore ├── CONTRIBUTING.md ├── GoogleAnalytics ├── GAI.h ├── GAIDictionaryBuilder.h ├── GAIEcommerceFields.h ├── GAIEcommerceProduct.h ├── GAIEcommerceProductAction.h ├── GAIEcommercePromotion.h ├── GAIFields.h ├── GAILogger.h ├── GAITrackedViewController.h ├── GAITracker.h ├── libAdIdAccess.a └── libGoogleAnalyticsServices.a ├── HelloWorldExample.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── HelloWorldExample ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── ViewController.h ├── ViewController.m └── main.m ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # OS or Editor folders 2 | .DS_Store 3 | *~ 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | 24 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Want to contribute? Great! First, read this page (including the small print at the end). 2 | 3 | ### Before you contribute 4 | Before we can use your code, you must sign the 5 | [Google Individual Contributor License Agreement](https://developers.google.com/open-source/cla/individual?csw=1) 6 | (CLA), which you can do online. The CLA is necessary mainly because you own the 7 | copyright to your changes, even after your contribution becomes part of our 8 | codebase, so we need your permission to use and distribute your code. We also 9 | need to be sure of various other things—for instance that you'll tell us if you 10 | know that your code infringes on other people's patents. You don't have to sign 11 | the CLA until after you've submitted your code for review and a member has 12 | approved it, but you must do it before we can put your code into our codebase. 13 | Before you start working on a larger contribution, you should get in touch with 14 | us first through the issue tracker with your idea so that we can help out and 15 | possibly guide you. Coordinating up front makes it much easier to avoid 16 | frustration later on. 17 | 18 | ### Code reviews 19 | All submissions, including submissions by project members, require review. We 20 | use Github pull requests for this purpose. 21 | 22 | ### The small print 23 | Contributions made by corporations are covered by a different agreement than 24 | the one above, the Software Grant and Corporate Contributor License Agreement. 25 | -------------------------------------------------------------------------------- /GoogleAnalytics/GAI.h: -------------------------------------------------------------------------------- 1 | /*! 2 | @header GAI.h 3 | @abstract Google Analytics iOS SDK Header 4 | @version 3.11 5 | @copyright Copyright 2013 Google Inc. All rights reserved. 6 | */ 7 | 8 | #import 9 | 10 | #import "GAILogger.h" 11 | #import "GAITrackedViewController.h" 12 | #import "GAITracker.h" 13 | 14 | typedef NS_ENUM(NSUInteger, GAIDispatchResult) { 15 | kGAIDispatchNoData, 16 | kGAIDispatchGood, 17 | kGAIDispatchError 18 | }; 19 | 20 | /*! Google Analytics product string. */ 21 | extern NSString *const kGAIProduct; 22 | 23 | /*! Google Analytics version string. */ 24 | extern NSString *const kGAIVersion; 25 | 26 | /*! 27 | NSError objects returned by the Google Analytics SDK may have this error domain 28 | to indicate that the error originated in the Google Analytics SDK. 29 | */ 30 | extern NSString *const kGAIErrorDomain; 31 | 32 | /*! Google Analytics error codes. */ 33 | typedef enum { 34 | // This error code indicates that there was no error. Never used. 35 | kGAINoError = 0, 36 | 37 | // This error code indicates that there was a database-related error. 38 | kGAIDatabaseError, 39 | 40 | // This error code indicates that there was a network-related error. 41 | kGAINetworkError, 42 | } GAIErrorCode; 43 | 44 | /*! 45 | Google Analytics iOS top-level class. Provides facilities to create trackers 46 | and set behaviorial flags. 47 | */ 48 | @interface GAI : NSObject 49 | 50 | /*! 51 | For convenience, this class exposes a default tracker instance. 52 | This is initialized to `nil` and will be set to the first tracker that is 53 | instantiated in trackerWithTrackingId:. It may be overridden as desired. 54 | 55 | The GAITrackedViewController class will, by default, use this tracker instance. 56 | */ 57 | @property(nonatomic, assign) id defaultTracker; 58 | 59 | /*! 60 | The GAILogger to use. 61 | */ 62 | @property(nonatomic, retain) id logger; 63 | 64 | /*! 65 | When this is true, no tracking information will be gathered; tracking calls 66 | will effectively become no-ops. When set to true, all tracking information that 67 | has not yet been submitted. The value of this flag will be persisted 68 | automatically by the SDK. Developers can optionally use this flag to implement 69 | an opt-out setting in the app to allows users to opt out of Google Analytics 70 | tracking. 71 | 72 | This is set to `NO` the first time the Google Analytics SDK is used on a 73 | device, and is persisted thereafter. 74 | */ 75 | @property(nonatomic, assign) BOOL optOut; 76 | 77 | /*! 78 | If this value is positive, tracking information will be automatically 79 | dispatched every dispatchInterval seconds. Otherwise, tracking information must 80 | be sent manually by calling dispatch. 81 | 82 | By default, this is set to `120`, which indicates tracking information should 83 | be dispatched automatically every 120 seconds. 84 | */ 85 | @property(nonatomic, assign) NSTimeInterval dispatchInterval; 86 | 87 | /*! 88 | When set to true, the SDK will record the currently registered uncaught 89 | exception handler, and then register an uncaught exception handler which tracks 90 | the exceptions that occurred using defaultTracker. If defaultTracker is not 91 | `nil`, this function will track the exception on the tracker and attempt to 92 | dispatch any outstanding tracking information for 5 seconds. It will then call 93 | the previously registered exception handler, if any. When set back to false, 94 | the previously registered uncaught exception handler will be restored. 95 | */ 96 | @property(nonatomic, assign) BOOL trackUncaughtExceptions; 97 | 98 | /*! 99 | When this is 'YES', no tracking information will be sent. Defaults to 'NO'. 100 | */ 101 | @property(nonatomic, assign) BOOL dryRun; 102 | 103 | /*! Get the shared instance of the Google Analytics for iOS class. */ 104 | + (GAI *)sharedInstance; 105 | 106 | /*! 107 | Creates or retrieves a GAITracker implementation with the specified name and 108 | tracking ID. If the tracker for the specified name does not already exist, then 109 | it will be created and returned; otherwise, the existing tracker will be 110 | returned. If the existing tracker for the respective name has a different 111 | tracking ID, that tracking ID is not changed by this method. If defaultTracker 112 | is not set, it will be set to the tracker instance returned here. 113 | 114 | @param name The name of this tracker. Must not be `nil` or empty. 115 | 116 | @param trackingID The tracking ID to use for this tracker. It should be of 117 | the form `UA-xxxxx-y`. 118 | 119 | @return A GAITracker associated with the specified name. The tracker 120 | can be used to send tracking data to Google Analytics. The first time this 121 | method is called with a particular name, the tracker for that name will be 122 | returned, and subsequent calls with the same name will return the same 123 | instance. It is not necessary to retain the tracker because the tracker will be 124 | retained internally by the library. 125 | 126 | If an error occurs or the name is not valid, this method will return 127 | `nil`. 128 | */ 129 | - (id)trackerWithName:(NSString *)name 130 | trackingId:(NSString *)trackingId; 131 | 132 | /*! 133 | Creates or retrieves a GAITracker implementation with name equal to 134 | the specified tracking ID. If the tracker for the respective name does not 135 | already exist, it is created, has it's tracking ID set to |trackingId|, 136 | and is returned; otherwise, the existing tracker is returned. If the existing 137 | tracker for the respective name has a different tracking ID, that tracking ID 138 | is not changed by this method. If defaultTracker is not set, it is set to the 139 | tracker instance returned here. 140 | 141 | @param trackingID The tracking ID to use for this tracker. It should be of 142 | the form `UA-xxxxx-y`. The name of the tracker will be the same as trackingID. 143 | 144 | @return A GAITracker associated with the specified trackingID. The tracker 145 | can be used to send tracking data to Google Analytics. The first time this 146 | method is called with a particular trackingID, the tracker for the respective 147 | name will be returned, and subsequent calls with the same trackingID 148 | will return the same instance. It is not necessary to retain the tracker 149 | because the tracker will be retained internally by the library. 150 | 151 | If an error occurs or the trackingId is not valid, this method will return 152 | `nil`. 153 | */ 154 | - (id)trackerWithTrackingId:(NSString *)trackingId; 155 | 156 | /*! 157 | Remove a tracker from the trackers dictionary. If it is the default tracker, 158 | clears the default tracker as well. 159 | 160 | @param name The name of the tracker. 161 | */ 162 | - (void)removeTrackerByName:(NSString *)name; 163 | 164 | /*! 165 | Dispatches any pending tracking information. 166 | 167 | Note that this does not have any effect on dispatchInterval, and can be used in 168 | conjunction with periodic dispatch. */ 169 | - (void)dispatch; 170 | 171 | /*! 172 | Dispatches the next tracking beacon in the queue, calling completionHandler when 173 | the tracking beacon has either been sent (returning kGAIDispatchGood) or an error has resulted 174 | (returning kGAIDispatchError). If there is no network connection or there is no data to send, 175 | kGAIDispatchNoData is returned. 176 | 177 | Note that calling this method with a non-nil completionHandler disables periodic dispatch. 178 | Periodic dispatch can be reenabled by setting the dispatchInterval to a positive number when 179 | the app resumes from the background. 180 | 181 | Calling this method with a nil completionHandler is the same as calling the dispatch 182 | above. 183 | 184 | This method can be used for background data fetching in iOS 7.0 or later. It would be wise to 185 | call this when the application is exiting to initiate the submission of any unsubmitted 186 | tracking information. 187 | 188 | @param completionHandler The block to run after a single dispatch request. The GAIDispatchResult 189 | param indicates whether the dispatch succeeded, had an error, or had no hits to dispatch. 190 | */ 191 | - (void)dispatchWithCompletionHandler:(void (^)(GAIDispatchResult result))completionHandler; 192 | @end 193 | -------------------------------------------------------------------------------- /GoogleAnalytics/GAIDictionaryBuilder.h: -------------------------------------------------------------------------------- 1 | /*! 2 | @header GAIDictionaryBuilder.h 3 | @abstract Google Analytics iOS SDK Hit Format Header 4 | @copyright Copyright 2013 Google Inc. All rights reserved. 5 | */ 6 | 7 | #import 8 | 9 | #import "GAIEcommerceProduct.h" 10 | #import "GAIEcommerceProductAction.h" 11 | #import "GAIEcommercePromotion.h" 12 | 13 | /*! 14 | * Helper class to build a dictionary of hit parameters and values. 15 | *
16 | * Examples: 17 | * 18 | * id t = // get a tracker. 19 | * [t send:[[[GAIDictionaryBuilder createEventWithCategory:@"EventCategory" 20 | * action:@"EventAction" 21 | * label:nil 22 | * value:nil] 23 | * set:@"dimension1" forKey:[GAIFields customDimensionForIndex:1]] build]]; 24 | * 25 | * This will send an event hit type with the specified parameters 26 | * and a custom dimension parameter. 27 | *
28 | * If you want to send a parameter with all hits, set it on GAITracker directly. 29 | * 30 | * [t set:kGAIScreenName value:@"Home"]; 31 | * [t send:[[GAIDictionaryBuilder createSocialWithNetwork:@"Google+" 32 | * action:@"PlusOne" 33 | * target:@"SOME_URL"] build]]; 34 | * [t send:[[GAIDictionaryBuilder createSocialWithNetwork:@"Google+" 35 | * action:@"Share" 36 | * target:@"SOME_POST"] build]]; 37 | * [t send:[[GAIDictionaryBuilder createSocialWithNetwork:@"Google+" 38 | * action:@"HangOut" 39 | * target:@"SOME_CIRCLE"] 40 | * build]]; 41 | * 42 | * You can override a value set on the tracker by adding it to the dictionary. 43 | * 44 | * [t set:kGAIScreenName value:@"Home"]; 45 | * [t send:...]; 46 | * [t send[[[GAIDictionaryBuilder createEventWithCategory:@"click" 47 | * action:@"popup" 48 | * label:nil 49 | * value:nil] 50 | * set:@"popup title" forKey:kGAIScreenName] build]]; 51 | * 52 | * The values set via [GAIDictionaryBuilder set] or 53 | * [GAIDictionaryBuilder setAll] will override any existing values in the 54 | * GAIDictionaryBuilder object (i.e. initialized by 55 | * [GAIDictionaryBuilder createXYZ]). e.g. 56 | * 57 | * GAIDictionaryBuilder *m = 58 | * GAIDictionaryBuilder createTimingWithCategory:@"category" 59 | * interval:@0 60 | * name:@"name" 61 | * label:nil]; 62 | * [t send:[m.set:@"10" forKey:kGAITimingVar] build]; 63 | * [t send:[m.set:@"20" forKey:kGAITimingVar] build]; 64 | * 65 | */ 66 | @interface GAIDictionaryBuilder : NSObject 67 | 68 | - (GAIDictionaryBuilder *)set:(NSString *)value 69 | forKey:(NSString *)key; 70 | 71 | /*! 72 | * Copies all the name-value pairs from params into this object, ignoring any 73 | * keys that are not NSString and any values that are neither NSString or 74 | * NSNull. 75 | */ 76 | - (GAIDictionaryBuilder *)setAll:(NSDictionary *)params; 77 | 78 | /*! 79 | * Returns the value for the input parameter paramName, or nil if paramName 80 | * is not present. 81 | */ 82 | - (NSString *)get:(NSString *)paramName; 83 | 84 | /*! 85 | * Return an NSMutableDictionary object with all the parameters set in this 86 | */ 87 | - (NSMutableDictionary *)build; 88 | 89 | /*! 90 | * Parses and translates utm campaign parameters to analytics campaign param 91 | * and returns them as a map. 92 | * 93 | * @param params url containing utm campaign parameters. 94 | * 95 | * Valid campaign parameters are: 96 | *
    97 | *
  • utm_id
  • 98 | *
  • utm_campaign
  • 99 | *
  • utm_content
  • 100 | *
  • utm_medium
  • 101 | *
  • utm_source
  • 102 | *
  • utm_term
  • 103 | *
  • dclid
  • 104 | *
  • gclid
  • 105 | *
  • gmob_t
  • 106 | *
  • aclid
  • 107 | *
  • anid
  • 108 | *
109 | *

110 | * Example: 111 | * http://my.site.com/index.html?utm_campaign=wow&utm_source=source 112 | * utm_campaign=wow&utm_source=source. 113 | *

114 | * For more information on auto-tagging, see 115 | * http://support.google.com/googleanalytics/bin/answer.py?hl=en&answer=55590 116 | *

117 | * For more information on manual tagging, see 118 | * http://support.google.com/googleanalytics/bin/answer.py?hl=en&answer=55518 119 | */ 120 | - (GAIDictionaryBuilder *)setCampaignParametersFromUrl:(NSString *)urlString; 121 | 122 | /*! 123 | Returns a GAIDictionaryBuilder object with parameters specific to an appview 124 | hit. 125 | 126 | Note that using this method will not set the screen name for followon hits. To 127 | do that you need to call set:kGAIDescription value: on the 128 | GAITracker instance. 129 | 130 | This method is deprecated. Use createScreenView instead. 131 | */ 132 | + (GAIDictionaryBuilder *)createAppView DEPRECATED_MSG_ATTRIBUTE("Use createScreenView instead."); 133 | 134 | /*! 135 | Returns a GAIDictionaryBuilder object with parameters specific to a screenview 136 | hit. 137 | 138 | Note that using this method will not set the screen name for followon hits. To 139 | do that you need to call set:kGAIDescription value: on the 140 | GAITracker instance. 141 | */ 142 | + (GAIDictionaryBuilder *)createScreenView; 143 | 144 | /*! 145 | Returns a GAIDictionaryBuilder object with parameters specific to an event hit. 146 | */ 147 | + (GAIDictionaryBuilder *)createEventWithCategory:(NSString *)category 148 | action:(NSString *)action 149 | label:(NSString *)label 150 | value:(NSNumber *)value; 151 | 152 | /*! 153 | Returns a GAIDictionaryBuilder object with parameters specific to an exception 154 | hit. 155 | */ 156 | + (GAIDictionaryBuilder *)createExceptionWithDescription:(NSString *)description 157 | withFatal:(NSNumber *)fatal; 158 | 159 | /*! 160 | Returns a GAIDictionaryBuilder object with parameters specific to an item hit. 161 | */ 162 | + (GAIDictionaryBuilder *)createItemWithTransactionId:(NSString *)transactionId 163 | name:(NSString *)name 164 | sku:(NSString *)sku 165 | category:(NSString *)category 166 | price:(NSNumber *)price 167 | quantity:(NSNumber *)quantity 168 | currencyCode:(NSString *)currencyCode; 169 | 170 | /*! 171 | Returns a GAIDictionaryBuilder object with parameters specific to a social hit. 172 | */ 173 | + (GAIDictionaryBuilder *)createSocialWithNetwork:(NSString *)network 174 | action:(NSString *)action 175 | target:(NSString *)target; 176 | 177 | /*! 178 | Returns a GAIDictionaryBuilder object with parameters specific to a timing hit. 179 | */ 180 | + (GAIDictionaryBuilder *)createTimingWithCategory:(NSString *)category 181 | interval:(NSNumber *)intervalMillis 182 | name:(NSString *)name 183 | label:(NSString *)label; 184 | 185 | /*! 186 | Returns a GAIDictionaryBuilder object with parameters specific to a transaction 187 | hit. 188 | */ 189 | + (GAIDictionaryBuilder *)createTransactionWithId:(NSString *)transactionId 190 | affiliation:(NSString *)affiliation 191 | revenue:(NSNumber *)revenue 192 | tax:(NSNumber *)tax 193 | shipping:(NSNumber *)shipping 194 | currencyCode:(NSString *)currencyCode; 195 | 196 | /*! 197 | Set the product action field for this hit. 198 | */ 199 | - (GAIDictionaryBuilder *)setProductAction:(GAIEcommerceProductAction *)productAction; 200 | 201 | /*! 202 | Adds a product to this hit. 203 | */ 204 | - (GAIDictionaryBuilder *)addProduct:(GAIEcommerceProduct *)product; 205 | 206 | /*! 207 | Add a product impression to this hit. 208 | */ 209 | - (GAIDictionaryBuilder *)addProductImpression:(GAIEcommerceProduct *)product 210 | impressionList:(NSString *)name 211 | impressionSource:(NSString *)source; 212 | 213 | /*! 214 | Add a promotion to this hit. 215 | */ 216 | - (GAIDictionaryBuilder *)addPromotion:(GAIEcommercePromotion *)promotion; 217 | @end 218 | -------------------------------------------------------------------------------- /GoogleAnalytics/GAIEcommerceFields.h: -------------------------------------------------------------------------------- 1 | /*! 2 | @header GAIEcommerceFields.h 3 | @abstract Google Analytics iOS SDK Ecommerce Hit Format Header 4 | @copyright Copyright 2014 Google Inc. All rights reserved. 5 | */ 6 | 7 | #import 8 | 9 | /*! 10 | This class provides several fields and methods useful as wire format parameters for 11 | Enhanced Ecommerce. See the online developer guides for Enhanced Ecommerce for details 12 | on how to use the Enhanced Ecommerce features. 13 | */ 14 | 15 | // Enhanced Ecommerce Product fields 16 | extern NSString *const kGAIProductId; 17 | extern NSString *const kGAIProductName; 18 | extern NSString *const kGAIProductBrand; 19 | extern NSString *const kGAIProductCategory; 20 | extern NSString *const kGAIProductVariant; 21 | extern NSString *const kGAIProductPrice; 22 | extern NSString *const kGAIProductQuantity; 23 | extern NSString *const kGAIProductCouponCode; 24 | extern NSString *const kGAIProductPosition; 25 | 26 | extern NSString *const kGAIProductAction; 27 | 28 | // product action values 29 | extern NSString *const kGAIPADetail; 30 | extern NSString *const kGAIPAClick; 31 | extern NSString *const kGAIPAAdd; 32 | extern NSString *const kGAIPARemove; 33 | extern NSString *const kGAIPACheckout; 34 | extern NSString *const kGAIPACheckoutOption; 35 | extern NSString *const kGAIPAPurchase; 36 | extern NSString *const kGAIPARefund; 37 | 38 | // product action fields 39 | // used for 'purchase' and 'refund' actions 40 | extern NSString *const kGAIPATransactionId; 41 | extern NSString *const kGAIPAAffiliation; 42 | extern NSString *const kGAIPARevenue; 43 | extern NSString *const kGAIPATax; 44 | extern NSString *const kGAIPAShipping; 45 | extern NSString *const kGAIPACouponCode; 46 | // used for 'checkout' action 47 | extern NSString *const kGAICheckoutStep; 48 | extern NSString *const kGAICheckoutOption; 49 | // used for 'detail' and 'click' actions 50 | extern NSString *const kGAIProductActionList; 51 | extern NSString *const kGAIProductListSource; 52 | 53 | // Enhanced Ecommerce Impressions fields 54 | extern NSString *const kGAIImpressionName; 55 | extern NSString *const kGAIImpressionListSource; 56 | extern NSString *const kGAIImpressionProduct; 57 | extern NSString *const kGAIImpressionProductId; 58 | extern NSString *const kGAIImpressionProductName; 59 | extern NSString *const kGAIImpressionProductBrand; 60 | extern NSString *const kGAIImpressionProductCategory; 61 | extern NSString *const kGAIImpressionProductVariant; 62 | extern NSString *const kGAIImpressionProductPosition; 63 | extern NSString *const kGAIImpressionProductPrice; 64 | 65 | // Enhanced Ecommerce Promotions fields 66 | extern NSString *const kGAIPromotionId; 67 | extern NSString *const kGAIPromotionName; 68 | extern NSString *const kGAIPromotionCreative; 69 | extern NSString *const kGAIPromotionPosition; 70 | 71 | // Promotion actions 72 | extern NSString *const kGAIPromotionAction; 73 | extern NSString *const kGAIPromotionView; 74 | extern NSString *const kGAIPromotionClick; 75 | 76 | @interface GAIEcommerceFields : NSObject 77 | 78 | /*! 79 | Generates an enhanced ecommerce product field. Note that field names generated by 80 | customDimensionForIndex and customMetricForIndex can be used as suffixes. 81 | 82 | @param index the index of the product 83 | @param suffix the product field suffix (such as kGAIProductPrice). 84 | 85 | @return an NSString representing the product field parameter 86 | */ 87 | + (NSString *)productFieldForIndex:(NSUInteger)index suffix:(NSString *)suffix; 88 | 89 | /*! 90 | Genrates an enhanced ecommerce impression list field name with an index. The return value of 91 | this method should also be used as input to the productImpressionForList method below. 92 | 93 | @param index the index of the impression list 94 | 95 | @return an NSString representing the impression list parameter 96 | */ 97 | + (NSString *)impressionListForIndex:(NSUInteger)index; 98 | 99 | /*! 100 | Generates an enhanced ecommerce product impression field with the impression list, product index 101 | and product suffix as parameters. The output of the method impressionListForIndex above should be 102 | used as the input list for this method. The output of customDimensionForIndex and 103 | customMetricForIndex can be used as suffixes. 104 | 105 | @param list the impression list for this product impression 106 | @param index the index of this product in the impression list 107 | @param suffix the product impression suffix for this field 108 | 109 | @return an NSString representing this product impression field parameter 110 | */ 111 | + (NSString *)productImpressionForList:(NSString *)list 112 | index:(NSUInteger)index 113 | suffix:(NSString *)Suffix; 114 | 115 | /*! 116 | Generates an enhanced ecommerce promotion field with an index and suffix. 117 | 118 | @param index the index of the promotion 119 | @param suffix the promotion suffix (such as kGAIPromotionId) 120 | 121 | @return an NSString representing this promotion field paramter 122 | */ 123 | + (NSString *)promotionForIndex:(NSUInteger)index suffix:(NSString *)suffix; 124 | @end 125 | -------------------------------------------------------------------------------- /GoogleAnalytics/GAIEcommerceProduct.h: -------------------------------------------------------------------------------- 1 | /*! 2 | @header GAIEcommerceProduct.h 3 | @abstract Google Analytics iOS SDK Hit Format Header 4 | @copyright Copyright 2014 Google Inc. All rights reserved. 5 | */ 6 | 7 | #import 8 | 9 | /*! 10 | * Class to construct product related information for a Google Analytics beacon. Use this class to 11 | * report information about products sold by merchants or impressions of products seen by users. 12 | * Instances of this class can be associated with both Product Actions and Product 13 | * Impression Lists. 14 | *
15 | * Typical usage: 16 | * 17 | * [tracker set:kGAIScreenName value:@"MyScreen"]; 18 | * GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createScreenView]; 19 | * GAIEcommerceProduct *product = [[GAIEcommerceProduct alloc] init]; 20 | * [product setId:@""PID-1234""]; 21 | * [product setName:@"Space Monkeys!"]; 22 | * [product setPrice:@100]; 23 | * [product setQuantity:@2]; 24 | * [builder addProductImpression:product impressionList:@"listName"]; 25 | * [tracker send:[builder build]]; 26 | * 27 | */ 28 | @interface GAIEcommerceProduct : NSObject 29 | 30 | /*! 31 | Sets the id that is used to identify a product in GA reports. 32 | */ 33 | - (GAIEcommerceProduct *)setId:(NSString *)productId; 34 | 35 | /*! 36 | Sets the name that is used to indentify the product in GA reports. 37 | */ 38 | - (GAIEcommerceProduct *)setName:(NSString *)productName; 39 | 40 | /*! 41 | Sets the brand associated with the product in GA reports. 42 | */ 43 | - (GAIEcommerceProduct *)setBrand:(NSString *)productBrand; 44 | 45 | /*! 46 | Sets the category associated with the product in GA reports. 47 | */ 48 | - (GAIEcommerceProduct *)setCategory:(NSString *)productCategory; 49 | 50 | /*! 51 | Sets the variant of the product. 52 | */ 53 | - (GAIEcommerceProduct *)setVariant:(NSString *)productVariant; 54 | 55 | /*! 56 | Sets the price of the product. 57 | */ 58 | - (GAIEcommerceProduct *)setPrice:(NSNumber *)productPrice; 59 | 60 | /*! 61 | Sets the quantity of the product. This field is usually not used with product impressions. 62 | */ 63 | - (GAIEcommerceProduct *)setQuantity:(NSNumber *)productQuantity; 64 | 65 | /*! 66 | Sets the coupon code associated with the product. This field is usually not used with product 67 | impressions. 68 | */ 69 | - (GAIEcommerceProduct *)setCouponCode:(NSString *)productCouponCode; 70 | 71 | /*! 72 | Sets the position of the product on the screen/product impression list, etc. 73 | */ 74 | - (GAIEcommerceProduct *)setPosition:(NSNumber *)productPosition; 75 | 76 | /*! 77 | Sets the custom dimension associated with this product. 78 | */ 79 | - (GAIEcommerceProduct *)setCustomDimension:(NSUInteger)index value:(NSString *)value; 80 | 81 | /*! 82 | Sets the custom metric associated with this product. 83 | */ 84 | - (GAIEcommerceProduct *)setCustomMetric:(NSUInteger)index value:(NSNumber *)value; 85 | 86 | /*! 87 | Builds an NSDictionary of fields stored in this instance suitable for a product action. The 88 | index parameter is the index of this product in the product action list. 89 |
90 | Normally, users will have no need to call this method. 91 | */ 92 | - (NSDictionary *)buildWithIndex:(NSUInteger)index; 93 | 94 | /*! 95 | Builds an NSDictionary of fields stored in this instance suitable for an impression list. The 96 | lIndex parameter is the index of the product impression list while the index parameter is the 97 | index of this product in that impression list. 98 |
99 | Normally, users will have no need to call this method. 100 | */ 101 | - (NSDictionary *)buildWithListIndex:(NSUInteger)lIndex index:(NSUInteger)index; 102 | @end 103 | -------------------------------------------------------------------------------- /GoogleAnalytics/GAIEcommerceProductAction.h: -------------------------------------------------------------------------------- 1 | /*! 2 | @header GAIProductAction.h 3 | @abstract Google Analytics iOS SDK Hit Format Header 4 | @copyright Copyright 2014 Google Inc. All rights reserved. 5 | */ 6 | 7 | #import 8 | 9 | /*! 10 | * Class to construct transaction/checkout or other product interaction related information for a 11 | * Google Analytics hit. Use this class to report information about products sold, viewed or 12 | * refunded. This class is intended to be used with GAIDictionaryBuilder. 13 | *
14 | * Typical usage: 15 | * 16 | * [tracker set:kGAIScreenName value:@"MyScreen"]; 17 | * GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createScreenView]; 18 | * GAIEcommerceProductAction *action = [[GAIEcommerceProductAction alloc] init]; 19 | * [action setAction:kGAIPAPurchase]; 20 | * [action setTransactionId:@"TT-1234"]; 21 | * [action setRevenue:@3.14]; 22 | * [action setCouponCode:@"EXTRA100"]; 23 | * [builder setProductAction:action]; 24 | * GAIEcommerceProduct *product = [[GAIEcommerceProduct alloc] init]; 25 | * [product setId:@""PID-1234""]; 26 | * [product setName:@"Space Monkeys!"]; 27 | * [product setPrice:@100]; 28 | * [product setQuantity:@2]; 29 | * [builder addProduct:product]; 30 | * [tracker send:[builder build]]; 31 | * 32 | */ 33 | @interface GAIEcommerceProductAction : NSObject 34 | 35 | /*! 36 | Sets the product action field for this product action. Valid values can be found in 37 | GAIEcommerceFields.h under "product action values". 38 | */ 39 | - (GAIEcommerceProductAction *)setAction:(NSString *)productAction; 40 | 41 | /*! 42 | The unique id associated with the transaction. This value is used for kGAIPAPurchase and 43 | kGAIPARefund product actions. 44 | */ 45 | - (GAIEcommerceProductAction *)setTransactionId:(NSString *)transactionId; 46 | 47 | /*! 48 | Sets the transaction's affiliation value. This value is used for kGAIPAPurchase and 49 | kGAIPARefund product actions. 50 | */ 51 | - (GAIEcommerceProductAction *)setAffiliation:(NSString *)affiliation; 52 | 53 | /*! 54 | Sets the transaction's total revenue. This value is used for kGAIPAPurchase and kGAIPARefund 55 | product actions. 56 | */ 57 | - (GAIEcommerceProductAction *)setRevenue:(NSNumber *)revenue; 58 | 59 | /*! 60 | Sets the transaction's total tax. This value is used for kGAIPAPurchase and kGAIPARefund 61 | product actions. 62 | */ 63 | - (GAIEcommerceProductAction *)setTax:(NSNumber *)tax; 64 | 65 | /*! 66 | Sets the transaction's total shipping costs. This value is used for kGAIPAPurchase and 67 | kGAIPARefund product actions. 68 | */ 69 | - (GAIEcommerceProductAction *)setShipping:(NSNumber *)shipping; 70 | 71 | /*! 72 | Sets the coupon code used in this transaction. This value is used for kGAIPAPurchase and 73 | kGAIPARefund product actions. 74 | */ 75 | - (GAIEcommerceProductAction *)setCouponCode:(NSString *)couponCode; 76 | 77 | /*! 78 | Sets the checkout process's progress. This value is used for kGAICheckout and 79 | kGAICheckoutOptions product actions. 80 | */ 81 | - (GAIEcommerceProductAction *)setCheckoutStep:(NSNumber *)checkoutStep; 82 | 83 | /*! 84 | Sets the option associated with the checkout. This value is used for kGAICheckout and 85 | kGAICheckoutOptions product actions. 86 | */ 87 | - (GAIEcommerceProductAction *)setCheckoutOption:(NSString *)checkoutOption; 88 | 89 | /*! 90 | Sets the list name associated with the products in Google Analytics beacons. This value is 91 | used in kGAIPADetail and kGAIPAClick product actions. 92 | */ 93 | - (GAIEcommerceProductAction *)setProductActionList:(NSString *)productActionList; 94 | 95 | /*! 96 | Sets the list source name associated with the products in Google Analytics beacons. This value 97 | is used in kGAIPADetail and kGAIPAClick product actions. 98 | */ 99 | - (GAIEcommerceProductAction *)setProductListSource:(NSString *)productListSource; 100 | 101 | /*! 102 | Builds an NSDictionary of fields stored in this instance representing this product action. 103 |
104 | Normally, users will have no need to call this method. 105 | */ 106 | - (NSDictionary *)build; 107 | @end 108 | -------------------------------------------------------------------------------- /GoogleAnalytics/GAIEcommercePromotion.h: -------------------------------------------------------------------------------- 1 | /*! 2 | @header GAIEcommercePromotion.h 3 | @abstract Google Analytics iOS SDK Hit Format Header 4 | @copyright Copyright 2014 Google Inc. All rights reserved. 5 | */ 6 | 7 | #import 8 | 9 | /*! 10 | * Class to construct promotion related fields for Google Analytics hits. The fields from this class 11 | * can be used to represent internal promotions that run within an app, such as banners, banner ads 12 | * etc. 13 | * 14 | * Typical usage: 15 | * 16 | * GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createScreenView]; 17 | * GAIEcommercePromotion *promotion = [[GAIEcommercePromotion alloc] init]; 18 | * [promotion setId:@"PROMO-ID1234"]; 19 | * [promotion setName:@"Home screen banner"]; 20 | * [builder set:kGAIPromotionClick forKey:kGAIPromotionAction]; 21 | * [builder addPromotion:promotion]; 22 | * [tracker send:builder.build]]; 23 | * 24 | */ 25 | @interface GAIEcommercePromotion : NSObject 26 | 27 | /*! 28 | Sets the id that is used to identify a promotion in GA reports. 29 | */ 30 | - (GAIEcommercePromotion *)setId:(NSString *)pid; 31 | 32 | /*! 33 | Sets the name that is used to identify a promotion in GA reports. 34 | */ 35 | - (GAIEcommercePromotion *)setName:(NSString *)name; 36 | 37 | /*! 38 | Sets the name of the creative associated with the promotion. 39 | */ 40 | - (GAIEcommercePromotion *)setCreative:(NSString *)creative; 41 | 42 | /*! 43 | Sets the position of the promotion. 44 | */ 45 | - (GAIEcommercePromotion *)setPosition:(NSString *)position; 46 | 47 | /*! 48 | Builds an NSDictionary of fields stored in this instance. The index parameter is the 49 | index of this promotion in that promotion list. 50 |
51 | Normally, users will have no need to call this method. 52 | */ 53 | - (NSDictionary *)buildWithIndex:(NSUInteger)index; 54 | @end 55 | -------------------------------------------------------------------------------- /GoogleAnalytics/GAIFields.h: -------------------------------------------------------------------------------- 1 | /*! 2 | @header GAIFields.h 3 | @abstract Google Analytics iOS SDK Hit Format Header 4 | @copyright Copyright 2013 Google Inc. All rights reserved. 5 | */ 6 | 7 | #import 8 | 9 | /*! 10 | These fields can be used for the wire format parameter names required by 11 | the |GAITracker| get, set and send methods as well as the set methods in the 12 | |GAIDictionaryBuilder| class. 13 | */ 14 | extern NSString *const kGAIUseSecure; 15 | 16 | extern NSString *const kGAIHitType; 17 | extern NSString *const kGAITrackingId; 18 | extern NSString *const kGAIClientId; 19 | extern NSString *const kGAIDataSource; 20 | extern NSString *const kGAIAnonymizeIp; 21 | extern NSString *const kGAISessionControl; 22 | extern NSString *const kGAIDeviceModelVersion; 23 | extern NSString *const kGAIScreenResolution; 24 | extern NSString *const kGAIViewportSize; 25 | extern NSString *const kGAIEncoding; 26 | extern NSString *const kGAIScreenColors; 27 | extern NSString *const kGAILanguage; 28 | extern NSString *const kGAIJavaEnabled; 29 | extern NSString *const kGAIFlashVersion; 30 | extern NSString *const kGAINonInteraction; 31 | extern NSString *const kGAIReferrer; 32 | extern NSString *const kGAILocation; 33 | extern NSString *const kGAIHostname; 34 | extern NSString *const kGAIPage; 35 | extern NSString *const kGAIDescription; // synonym for kGAIScreenName 36 | extern NSString *const kGAIScreenName; // synonym for kGAIDescription 37 | extern NSString *const kGAITitle; 38 | extern NSString *const kGAIAdMobHitId; 39 | extern NSString *const kGAIAppName; 40 | extern NSString *const kGAIAppVersion; 41 | extern NSString *const kGAIAppId; 42 | extern NSString *const kGAIAppInstallerId; 43 | extern NSString *const kGAIUserId; 44 | 45 | extern NSString *const kGAIEventCategory; 46 | extern NSString *const kGAIEventAction; 47 | extern NSString *const kGAIEventLabel; 48 | extern NSString *const kGAIEventValue; 49 | 50 | extern NSString *const kGAISocialNetwork; 51 | extern NSString *const kGAISocialAction; 52 | extern NSString *const kGAISocialTarget; 53 | 54 | extern NSString *const kGAITransactionId; 55 | extern NSString *const kGAITransactionAffiliation; 56 | extern NSString *const kGAITransactionRevenue; 57 | extern NSString *const kGAITransactionShipping; 58 | extern NSString *const kGAITransactionTax; 59 | extern NSString *const kGAICurrencyCode; 60 | 61 | extern NSString *const kGAIItemPrice; 62 | extern NSString *const kGAIItemQuantity; 63 | extern NSString *const kGAIItemSku; 64 | extern NSString *const kGAIItemName; 65 | extern NSString *const kGAIItemCategory; 66 | 67 | extern NSString *const kGAICampaignSource; 68 | extern NSString *const kGAICampaignMedium; 69 | extern NSString *const kGAICampaignName; 70 | extern NSString *const kGAICampaignKeyword; 71 | extern NSString *const kGAICampaignContent; 72 | extern NSString *const kGAICampaignId; 73 | extern NSString *const kGAICampaignAdNetworkClickId; 74 | extern NSString *const kGAICampaignAdNetworkId; 75 | 76 | extern NSString *const kGAITimingCategory; 77 | extern NSString *const kGAITimingVar; 78 | extern NSString *const kGAITimingValue; 79 | extern NSString *const kGAITimingLabel; 80 | 81 | extern NSString *const kGAIExDescription; 82 | extern NSString *const kGAIExFatal; 83 | 84 | extern NSString *const kGAISampleRate; 85 | 86 | extern NSString *const kGAIIdfa; 87 | extern NSString *const kGAIAdTargetingEnabled; 88 | 89 | // hit types 90 | extern NSString *const kGAIAppView DEPRECATED_MSG_ATTRIBUTE("Use kGAIScreenView instead."); 91 | extern NSString *const kGAIScreenView; 92 | extern NSString *const kGAIEvent; 93 | extern NSString *const kGAISocial; 94 | extern NSString *const kGAITransaction; 95 | extern NSString *const kGAIItem; 96 | extern NSString *const kGAIException; 97 | extern NSString *const kGAITiming; 98 | 99 | /*! 100 | This class provides several fields and methods useful as wire format parameter 101 | names. The methods are used for wire format parameter names that are indexed. 102 | */ 103 | 104 | @interface GAIFields : NSObject 105 | 106 | /*! 107 | Generates the correct parameter name for a content group with an index. 108 | 109 | @param index the index of the content group. 110 | 111 | @return an NSString representing the content group parameter for the index. 112 | */ 113 | + (NSString *)contentGroupForIndex:(NSUInteger)index; 114 | 115 | /*! 116 | Generates the correct parameter name for a custon dimension with an index. 117 | 118 | @param index the index of the custom dimension. 119 | 120 | @return an NSString representing the custom dimension parameter for the index. 121 | */ 122 | + (NSString *)customDimensionForIndex:(NSUInteger)index; 123 | 124 | /*! 125 | Generates the correct parameter name for a custom metric with an index. 126 | 127 | @param index the index of the custom metric. 128 | 129 | @return an NSString representing the custom metric parameter for the index. 130 | */ 131 | + (NSString *)customMetricForIndex:(NSUInteger)index; 132 | 133 | @end 134 | -------------------------------------------------------------------------------- /GoogleAnalytics/GAILogger.h: -------------------------------------------------------------------------------- 1 | /*! 2 | @header GAILogger.h 3 | @abstract Google Analytics iOS SDK Source 4 | @copyright Copyright 2011 Google Inc. All rights reserved. 5 | */ 6 | 7 | #import 8 | 9 | typedef NS_ENUM(NSUInteger, GAILogLevel) { 10 | kGAILogLevelNone = 0, 11 | kGAILogLevelError = 1, 12 | kGAILogLevelWarning = 2, 13 | kGAILogLevelInfo = 3, 14 | kGAILogLevelVerbose = 4 15 | }; 16 | 17 | /*! 18 | Protocol to be used for logging debug and informational messages from the SDK. 19 | Implementations of this protocol can be provided to the |GAI| class, 20 | to be used as the logger by the SDK. See the |logger| property in GAI.h. 21 | */ 22 | @protocol GAILogger 23 | @required 24 | 25 | /*! 26 | Only messages of |logLevel| and below are logged. 27 | */ 28 | @property (nonatomic, assign) GAILogLevel logLevel; 29 | 30 | /*! 31 | Logs message with log level |kGAILogLevelVerbose|. 32 | */ 33 | - (void)verbose:(NSString *)message; 34 | 35 | /*! 36 | Logs message with log level |kGAILogLevelInfo|. 37 | */ 38 | - (void)info:(NSString *)message; 39 | 40 | /*! 41 | Logs message with log level |kGAILogLevelWarning|. 42 | */ 43 | - (void)warning:(NSString *)message; 44 | 45 | /*! 46 | Logs message with log level |kGAILogLevelError|. 47 | */ 48 | - (void)error:(NSString *)message; 49 | @end 50 | -------------------------------------------------------------------------------- /GoogleAnalytics/GAITrackedViewController.h: -------------------------------------------------------------------------------- 1 | /*! 2 | @header GAITrackedViewController.h 3 | @abstract Google Analytics for iOS Tracked View Controller Header 4 | @copyright Copyright 2012 Google Inc. All rights reserved. 5 | */ 6 | 7 | #import 8 | #import 9 | 10 | @protocol GAITracker; 11 | 12 | /*! 13 | Extends UIViewController to generate Google Analytics screenview calls 14 | whenever the view appears; this is done by overriding the `viewDidAppear:` 15 | method. The screen name must be set for any tracking calls to be made. 16 | 17 | By default, this will use [GAI defaultTracker] for tracking calls, but one can 18 | override this by setting the tracker property. 19 | */ 20 | @interface GAITrackedViewController : UIViewController 21 | 22 | /*! 23 | The tracker on which view tracking calls are be made, or `nil`, in which case 24 | [GAI defaultTracker] will be used. 25 | */ 26 | @property(nonatomic, assign) id tracker; 27 | /*! 28 | The screen name, for purposes of Google Analytics tracking. If this is `nil`, 29 | no tracking calls will be made. 30 | */ 31 | @property(nonatomic, copy) NSString *screenName; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /GoogleAnalytics/GAITracker.h: -------------------------------------------------------------------------------- 1 | /*! 2 | @header GAITracker.h 3 | @abstract Google Analytics iOS SDK Tracker Header 4 | @copyright Copyright 2013 Google Inc. All rights reserved. 5 | */ 6 | 7 | #import 8 | 9 | /*! 10 | Google Analytics tracking interface. Obtain instances of this interface from 11 | [GAI trackerWithTrackingId:] to track screens, events, transactions, timing, 12 | and exceptions. The implementation of this interface is thread-safe, and no 13 | calls are expected to block or take a long time. All network and disk activity 14 | will take place in the background. 15 | */ 16 | @protocol GAITracker 17 | 18 | /*! 19 | Name of this tracker. 20 | */ 21 | @property(nonatomic, readonly) NSString *name; 22 | 23 | /*! 24 | Allow collection of IDFA and related fields if set to true. Default is false. 25 | */ 26 | @property(nonatomic) BOOL allowIDFACollection; 27 | 28 | /*! 29 | Set a tracking parameter. 30 | 31 | @param parameterName The parameter name. 32 | 33 | @param value The value to set for the parameter. If this is nil, the 34 | value for the parameter will be cleared. 35 | */ 36 | - (void)set:(NSString *)parameterName 37 | value:(NSString *)value; 38 | 39 | /*! 40 | Get a tracking parameter. 41 | 42 | @param parameterName The parameter name. 43 | 44 | @returns The parameter value, or nil if no value for the given parameter is 45 | set. 46 | */ 47 | - (NSString *)get:(NSString *)parameterName; 48 | 49 | /*! 50 | Queue tracking information with the given parameter values. 51 | 52 | @param parameters A map from parameter names to parameter values which will be 53 | set just for this piece of tracking information, or nil for none. 54 | */ 55 | - (void)send:(NSDictionary *)parameters; 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /GoogleAnalytics/libAdIdAccess.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleanalytics/hello-world-ios-app/f3d065032f94b3fca1f2aac9f876a90ed57e3638/GoogleAnalytics/libAdIdAccess.a -------------------------------------------------------------------------------- /GoogleAnalytics/libGoogleAnalyticsServices.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleanalytics/hello-world-ios-app/f3d065032f94b3fca1f2aac9f876a90ed57e3638/GoogleAnalytics/libGoogleAnalyticsServices.a -------------------------------------------------------------------------------- /HelloWorldExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 96F83C551AF9673100738B76 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 96F83C541AF9673100738B76 /* main.m */; }; 11 | 96F83C581AF9673100738B76 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 96F83C571AF9673100738B76 /* AppDelegate.m */; }; 12 | 96F83C5B1AF9673100738B76 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 96F83C5A1AF9673100738B76 /* ViewController.m */; }; 13 | 96F83C5E1AF9673100738B76 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 96F83C5C1AF9673100738B76 /* Main.storyboard */; }; 14 | 96F83C601AF9673100738B76 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 96F83C5F1AF9673100738B76 /* Images.xcassets */; }; 15 | 96F83C631AF9673100738B76 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 96F83C611AF9673100738B76 /* LaunchScreen.xib */; }; 16 | 96F83C881AF968EA00738B76 /* libGoogleAnalyticsServices.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 96F83C871AF968EA00738B76 /* libGoogleAnalyticsServices.a */; }; 17 | 96F83C8A1AF9690000738B76 /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96F83C891AF9690000738B76 /* CoreData.framework */; }; 18 | 96F83C8C1AF9690900738B76 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 96F83C8B1AF9690900738B76 /* libz.dylib */; }; 19 | 96F83C8E1AF9690E00738B76 /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 96F83C8D1AF9690E00738B76 /* libsqlite3.dylib */; }; 20 | 96F83C901AF969D700738B76 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96F83C8F1AF969D700738B76 /* SystemConfiguration.framework */; }; 21 | 96F83C951AF9784200738B76 /* libAdIdAccess.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 96F83C941AF9784200738B76 /* libAdIdAccess.a */; }; 22 | 96F83C971AF9785F00738B76 /* AdSupport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96F83C961AF9785F00738B76 /* AdSupport.framework */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXFileReference section */ 26 | 96F83C4F1AF9673000738B76 /* helloworldexample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = helloworldexample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 27 | 96F83C531AF9673000738B76 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 28 | 96F83C541AF9673100738B76 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 29 | 96F83C561AF9673100738B76 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 30 | 96F83C571AF9673100738B76 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 31 | 96F83C591AF9673100738B76 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 32 | 96F83C5A1AF9673100738B76 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 33 | 96F83C5D1AF9673100738B76 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 34 | 96F83C5F1AF9673100738B76 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 35 | 96F83C621AF9673100738B76 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 36 | 96F83C7D1AF9680100738B76 /* GAI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GAI.h; sourceTree = ""; }; 37 | 96F83C7E1AF9680100738B76 /* GAIDictionaryBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GAIDictionaryBuilder.h; sourceTree = ""; }; 38 | 96F83C7F1AF9680100738B76 /* GAIEcommerceFields.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GAIEcommerceFields.h; sourceTree = ""; }; 39 | 96F83C801AF9680100738B76 /* GAIEcommerceProduct.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GAIEcommerceProduct.h; sourceTree = ""; }; 40 | 96F83C811AF9680100738B76 /* GAIEcommerceProductAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GAIEcommerceProductAction.h; sourceTree = ""; }; 41 | 96F83C821AF9680100738B76 /* GAIEcommercePromotion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GAIEcommercePromotion.h; sourceTree = ""; }; 42 | 96F83C831AF9680100738B76 /* GAIFields.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GAIFields.h; sourceTree = ""; }; 43 | 96F83C841AF9680100738B76 /* GAILogger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GAILogger.h; sourceTree = ""; }; 44 | 96F83C851AF9680100738B76 /* GAITrackedViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GAITrackedViewController.h; sourceTree = ""; }; 45 | 96F83C861AF9680100738B76 /* GAITracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GAITracker.h; sourceTree = ""; }; 46 | 96F83C871AF968EA00738B76 /* libGoogleAnalyticsServices.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libGoogleAnalyticsServices.a; sourceTree = ""; }; 47 | 96F83C891AF9690000738B76 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; 48 | 96F83C8B1AF9690900738B76 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; 49 | 96F83C8D1AF9690E00738B76 /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = usr/lib/libsqlite3.dylib; sourceTree = SDKROOT; }; 50 | 96F83C8F1AF969D700738B76 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; 51 | 96F83C941AF9784200738B76 /* libAdIdAccess.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libAdIdAccess.a; sourceTree = ""; }; 52 | 96F83C961AF9785F00738B76 /* AdSupport.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AdSupport.framework; path = System/Library/Frameworks/AdSupport.framework; sourceTree = SDKROOT; }; 53 | /* End PBXFileReference section */ 54 | 55 | /* Begin PBXFrameworksBuildPhase section */ 56 | 96F83C4C1AF9673000738B76 /* Frameworks */ = { 57 | isa = PBXFrameworksBuildPhase; 58 | buildActionMask = 2147483647; 59 | files = ( 60 | 96F83C881AF968EA00738B76 /* libGoogleAnalyticsServices.a in Frameworks */, 61 | 96F83C951AF9784200738B76 /* libAdIdAccess.a in Frameworks */, 62 | 96F83C971AF9785F00738B76 /* AdSupport.framework in Frameworks */, 63 | 96F83C8A1AF9690000738B76 /* CoreData.framework in Frameworks */, 64 | 96F83C901AF969D700738B76 /* SystemConfiguration.framework in Frameworks */, 65 | 96F83C8E1AF9690E00738B76 /* libsqlite3.dylib in Frameworks */, 66 | 96F83C8C1AF9690900738B76 /* libz.dylib in Frameworks */, 67 | ); 68 | runOnlyForDeploymentPostprocessing = 0; 69 | }; 70 | /* End PBXFrameworksBuildPhase section */ 71 | 72 | /* Begin PBXGroup section */ 73 | 96F83C461AF9673000738B76 = { 74 | isa = PBXGroup; 75 | children = ( 76 | 96F83C961AF9785F00738B76 /* AdSupport.framework */, 77 | 96F83C891AF9690000738B76 /* CoreData.framework */, 78 | 96F83C8F1AF969D700738B76 /* SystemConfiguration.framework */, 79 | 96F83C8D1AF9690E00738B76 /* libsqlite3.dylib */, 80 | 96F83C8B1AF9690900738B76 /* libz.dylib */, 81 | 96F83C7C1AF9680100738B76 /* GoogleAnalytics */, 82 | 96F83C511AF9673000738B76 /* HelloWorldExample */, 83 | 96F83C501AF9673000738B76 /* Products */, 84 | ); 85 | sourceTree = ""; 86 | }; 87 | 96F83C501AF9673000738B76 /* Products */ = { 88 | isa = PBXGroup; 89 | children = ( 90 | 96F83C4F1AF9673000738B76 /* helloworldexample.app */, 91 | ); 92 | name = Products; 93 | sourceTree = ""; 94 | }; 95 | 96F83C511AF9673000738B76 /* HelloWorldExample */ = { 96 | isa = PBXGroup; 97 | children = ( 98 | 96F83C561AF9673100738B76 /* AppDelegate.h */, 99 | 96F83C571AF9673100738B76 /* AppDelegate.m */, 100 | 96F83C591AF9673100738B76 /* ViewController.h */, 101 | 96F83C5A1AF9673100738B76 /* ViewController.m */, 102 | 96F83C5C1AF9673100738B76 /* Main.storyboard */, 103 | 96F83C5F1AF9673100738B76 /* Images.xcassets */, 104 | 96F83C611AF9673100738B76 /* LaunchScreen.xib */, 105 | 96F83C521AF9673000738B76 /* Supporting Files */, 106 | ); 107 | path = HelloWorldExample; 108 | sourceTree = ""; 109 | }; 110 | 96F83C521AF9673000738B76 /* Supporting Files */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 96F83C531AF9673000738B76 /* Info.plist */, 114 | 96F83C541AF9673100738B76 /* main.m */, 115 | ); 116 | name = "Supporting Files"; 117 | sourceTree = ""; 118 | }; 119 | 96F83C7C1AF9680100738B76 /* GoogleAnalytics */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | 96F83C871AF968EA00738B76 /* libGoogleAnalyticsServices.a */, 123 | 96F83C941AF9784200738B76 /* libAdIdAccess.a */, 124 | 96F83C7D1AF9680100738B76 /* GAI.h */, 125 | 96F83C7E1AF9680100738B76 /* GAIDictionaryBuilder.h */, 126 | 96F83C7F1AF9680100738B76 /* GAIEcommerceFields.h */, 127 | 96F83C801AF9680100738B76 /* GAIEcommerceProduct.h */, 128 | 96F83C811AF9680100738B76 /* GAIEcommerceProductAction.h */, 129 | 96F83C821AF9680100738B76 /* GAIEcommercePromotion.h */, 130 | 96F83C831AF9680100738B76 /* GAIFields.h */, 131 | 96F83C841AF9680100738B76 /* GAILogger.h */, 132 | 96F83C851AF9680100738B76 /* GAITrackedViewController.h */, 133 | 96F83C861AF9680100738B76 /* GAITracker.h */, 134 | ); 135 | path = GoogleAnalytics; 136 | sourceTree = ""; 137 | }; 138 | /* End PBXGroup section */ 139 | 140 | /* Begin PBXNativeTarget section */ 141 | 96F83C4E1AF9673000738B76 /* helloworldexample */ = { 142 | isa = PBXNativeTarget; 143 | buildConfigurationList = 96F83C721AF9673200738B76 /* Build configuration list for PBXNativeTarget "helloworldexample" */; 144 | buildPhases = ( 145 | 96F83C4B1AF9673000738B76 /* Sources */, 146 | 96F83C4C1AF9673000738B76 /* Frameworks */, 147 | 96F83C4D1AF9673000738B76 /* Resources */, 148 | ); 149 | buildRules = ( 150 | ); 151 | dependencies = ( 152 | ); 153 | name = helloworldexample; 154 | productName = HelloWorld; 155 | productReference = 96F83C4F1AF9673000738B76 /* helloworldexample.app */; 156 | productType = "com.apple.product-type.application"; 157 | }; 158 | /* End PBXNativeTarget section */ 159 | 160 | /* Begin PBXProject section */ 161 | 96F83C471AF9673000738B76 /* Project object */ = { 162 | isa = PBXProject; 163 | attributes = { 164 | LastUpgradeCheck = 0610; 165 | ORGANIZATIONNAME = "Google Inc"; 166 | TargetAttributes = { 167 | 96F83C4E1AF9673000738B76 = { 168 | CreatedOnToolsVersion = 6.1.1; 169 | }; 170 | }; 171 | }; 172 | buildConfigurationList = 96F83C4A1AF9673000738B76 /* Build configuration list for PBXProject "HelloWorldExample" */; 173 | compatibilityVersion = "Xcode 3.2"; 174 | developmentRegion = English; 175 | hasScannedForEncodings = 0; 176 | knownRegions = ( 177 | en, 178 | Base, 179 | ); 180 | mainGroup = 96F83C461AF9673000738B76; 181 | productRefGroup = 96F83C501AF9673000738B76 /* Products */; 182 | projectDirPath = ""; 183 | projectRoot = ""; 184 | targets = ( 185 | 96F83C4E1AF9673000738B76 /* helloworldexample */, 186 | ); 187 | }; 188 | /* End PBXProject section */ 189 | 190 | /* Begin PBXResourcesBuildPhase section */ 191 | 96F83C4D1AF9673000738B76 /* Resources */ = { 192 | isa = PBXResourcesBuildPhase; 193 | buildActionMask = 2147483647; 194 | files = ( 195 | 96F83C5E1AF9673100738B76 /* Main.storyboard in Resources */, 196 | 96F83C631AF9673100738B76 /* LaunchScreen.xib in Resources */, 197 | 96F83C601AF9673100738B76 /* Images.xcassets in Resources */, 198 | ); 199 | runOnlyForDeploymentPostprocessing = 0; 200 | }; 201 | /* End PBXResourcesBuildPhase section */ 202 | 203 | /* Begin PBXSourcesBuildPhase section */ 204 | 96F83C4B1AF9673000738B76 /* Sources */ = { 205 | isa = PBXSourcesBuildPhase; 206 | buildActionMask = 2147483647; 207 | files = ( 208 | 96F83C5B1AF9673100738B76 /* ViewController.m in Sources */, 209 | 96F83C581AF9673100738B76 /* AppDelegate.m in Sources */, 210 | 96F83C551AF9673100738B76 /* main.m in Sources */, 211 | ); 212 | runOnlyForDeploymentPostprocessing = 0; 213 | }; 214 | /* End PBXSourcesBuildPhase section */ 215 | 216 | /* Begin PBXVariantGroup section */ 217 | 96F83C5C1AF9673100738B76 /* Main.storyboard */ = { 218 | isa = PBXVariantGroup; 219 | children = ( 220 | 96F83C5D1AF9673100738B76 /* Base */, 221 | ); 222 | name = Main.storyboard; 223 | sourceTree = ""; 224 | }; 225 | 96F83C611AF9673100738B76 /* LaunchScreen.xib */ = { 226 | isa = PBXVariantGroup; 227 | children = ( 228 | 96F83C621AF9673100738B76 /* Base */, 229 | ); 230 | name = LaunchScreen.xib; 231 | sourceTree = ""; 232 | }; 233 | /* End PBXVariantGroup section */ 234 | 235 | /* Begin XCBuildConfiguration section */ 236 | 96F83C701AF9673200738B76 /* Debug */ = { 237 | isa = XCBuildConfiguration; 238 | buildSettings = { 239 | ALWAYS_SEARCH_USER_PATHS = NO; 240 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 241 | CLANG_CXX_LIBRARY = "libc++"; 242 | CLANG_ENABLE_MODULES = YES; 243 | CLANG_ENABLE_OBJC_ARC = YES; 244 | CLANG_WARN_BOOL_CONVERSION = YES; 245 | CLANG_WARN_CONSTANT_CONVERSION = YES; 246 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 247 | CLANG_WARN_EMPTY_BODY = YES; 248 | CLANG_WARN_ENUM_CONVERSION = YES; 249 | CLANG_WARN_INT_CONVERSION = YES; 250 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 251 | CLANG_WARN_UNREACHABLE_CODE = YES; 252 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 253 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 254 | COPY_PHASE_STRIP = NO; 255 | ENABLE_STRICT_OBJC_MSGSEND = YES; 256 | GCC_C_LANGUAGE_STANDARD = gnu99; 257 | GCC_DYNAMIC_NO_PIC = NO; 258 | GCC_OPTIMIZATION_LEVEL = 0; 259 | GCC_PREPROCESSOR_DEFINITIONS = ( 260 | "DEBUG=1", 261 | "$(inherited)", 262 | ); 263 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 264 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 265 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 266 | GCC_WARN_UNDECLARED_SELECTOR = YES; 267 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 268 | GCC_WARN_UNUSED_FUNCTION = YES; 269 | GCC_WARN_UNUSED_VARIABLE = YES; 270 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 271 | MTL_ENABLE_DEBUG_INFO = YES; 272 | ONLY_ACTIVE_ARCH = YES; 273 | SDKROOT = iphoneos; 274 | TARGETED_DEVICE_FAMILY = "1,2"; 275 | }; 276 | name = Debug; 277 | }; 278 | 96F83C711AF9673200738B76 /* Release */ = { 279 | isa = XCBuildConfiguration; 280 | buildSettings = { 281 | ALWAYS_SEARCH_USER_PATHS = NO; 282 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 283 | CLANG_CXX_LIBRARY = "libc++"; 284 | CLANG_ENABLE_MODULES = YES; 285 | CLANG_ENABLE_OBJC_ARC = YES; 286 | CLANG_WARN_BOOL_CONVERSION = YES; 287 | CLANG_WARN_CONSTANT_CONVERSION = YES; 288 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 289 | CLANG_WARN_EMPTY_BODY = YES; 290 | CLANG_WARN_ENUM_CONVERSION = YES; 291 | CLANG_WARN_INT_CONVERSION = YES; 292 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 293 | CLANG_WARN_UNREACHABLE_CODE = YES; 294 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 295 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 296 | COPY_PHASE_STRIP = YES; 297 | ENABLE_NS_ASSERTIONS = NO; 298 | ENABLE_STRICT_OBJC_MSGSEND = YES; 299 | GCC_C_LANGUAGE_STANDARD = gnu99; 300 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 301 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 302 | GCC_WARN_UNDECLARED_SELECTOR = YES; 303 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 304 | GCC_WARN_UNUSED_FUNCTION = YES; 305 | GCC_WARN_UNUSED_VARIABLE = YES; 306 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 307 | MTL_ENABLE_DEBUG_INFO = NO; 308 | SDKROOT = iphoneos; 309 | TARGETED_DEVICE_FAMILY = "1,2"; 310 | VALIDATE_PRODUCT = YES; 311 | }; 312 | name = Release; 313 | }; 314 | 96F83C731AF9673200738B76 /* Debug */ = { 315 | isa = XCBuildConfiguration; 316 | buildSettings = { 317 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 318 | INFOPLIST_FILE = HelloWorldExample/Info.plist; 319 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 320 | LIBRARY_SEARCH_PATHS = ( 321 | "$(inherited)", 322 | "$(PROJECT_DIR)", 323 | "$(PROJECT_DIR)/GoogleAnalytics", 324 | ); 325 | OTHER_LDFLAGS = ( 326 | "-force_load", 327 | GoogleAnalytics/libAdIdAccess.a, 328 | ); 329 | PRODUCT_NAME = "$(TARGET_NAME)"; 330 | }; 331 | name = Debug; 332 | }; 333 | 96F83C741AF9673200738B76 /* Release */ = { 334 | isa = XCBuildConfiguration; 335 | buildSettings = { 336 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 337 | INFOPLIST_FILE = HelloWorldExample/Info.plist; 338 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 339 | LIBRARY_SEARCH_PATHS = ( 340 | "$(inherited)", 341 | "$(PROJECT_DIR)", 342 | "$(PROJECT_DIR)/GoogleAnalytics", 343 | ); 344 | OTHER_LDFLAGS = ( 345 | "-force_load", 346 | GoogleAnalytics/libAdIdAccess.a, 347 | ); 348 | PRODUCT_NAME = "$(TARGET_NAME)"; 349 | }; 350 | name = Release; 351 | }; 352 | /* End XCBuildConfiguration section */ 353 | 354 | /* Begin XCConfigurationList section */ 355 | 96F83C4A1AF9673000738B76 /* Build configuration list for PBXProject "HelloWorldExample" */ = { 356 | isa = XCConfigurationList; 357 | buildConfigurations = ( 358 | 96F83C701AF9673200738B76 /* Debug */, 359 | 96F83C711AF9673200738B76 /* Release */, 360 | ); 361 | defaultConfigurationIsVisible = 0; 362 | defaultConfigurationName = Release; 363 | }; 364 | 96F83C721AF9673200738B76 /* Build configuration list for PBXNativeTarget "helloworldexample" */ = { 365 | isa = XCConfigurationList; 366 | buildConfigurations = ( 367 | 96F83C731AF9673200738B76 /* Debug */, 368 | 96F83C741AF9673200738B76 /* Release */, 369 | ); 370 | defaultConfigurationIsVisible = 0; 371 | defaultConfigurationName = Release; 372 | }; 373 | /* End XCConfigurationList section */ 374 | }; 375 | rootObject = 96F83C471AF9673000738B76 /* Project object */; 376 | } 377 | -------------------------------------------------------------------------------- /HelloWorldExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /HelloWorldExample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface AppDelegate : UIResponder 4 | 5 | @property (strong, nonatomic) UIWindow *window; 6 | 7 | 8 | @end 9 | 10 | -------------------------------------------------------------------------------- /HelloWorldExample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | 3 | #import "GAI.h" 4 | 5 | @interface AppDelegate () 6 | 7 | @end 8 | 9 | @implementation AppDelegate 10 | 11 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 12 | // Override point for customization after application launch. 13 | 14 | // Initialize the default tracker. After initialization, [GAI sharedInstance].defaultTracker 15 | // returns this same tracker. 16 | // TODO: Replace the tracker-id with your app one from https://www.google.com/analytics/web/ 17 | id tracker = [[GAI sharedInstance] trackerWithTrackingId:@"UA-54478999-2"]; 18 | 19 | // Provide unhandled exceptions reports. 20 | [GAI sharedInstance].trackUncaughtExceptions = YES; 21 | 22 | // Enable Remarketing, Demographics & Interests reports. Requires the libAdIdAccess library 23 | // and the AdSupport framework. 24 | // https://developers.google.com/analytics/devguides/collection/ios/display-features 25 | tracker.allowIDFACollection = YES; 26 | 27 | return YES; 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /HelloWorldExample/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /HelloWorldExample/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /HelloWorldExample/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /HelloWorldExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.google.analytics.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundleDisplayName 16 | Hello World Example 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /HelloWorldExample/ViewController.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "GAITrackedViewController.h" 4 | 5 | // Extend GAITrackedViewController to enable automatic screenview tracking for this view controller. 6 | // Set the view controller's screen name in viewDidLoad. 7 | @interface ViewController : GAITrackedViewController 8 | 9 | @end 10 | 11 | -------------------------------------------------------------------------------- /HelloWorldExample/ViewController.m: -------------------------------------------------------------------------------- 1 | #import "ViewController.h" 2 | 3 | #import "GAI.h" 4 | #import "GAIDictionaryBuilder.h" 5 | 6 | @interface ViewController () 7 | 8 | @end 9 | 10 | @implementation ViewController 11 | 12 | - (void)viewDidLoad { 13 | [super viewDidLoad]; 14 | // Do any additional setup after loading the view, typically from a nib. 15 | 16 | // Set the screen name for automatic screenview tracking. 17 | self.screenName = @"Main"; 18 | } 19 | 20 | - (IBAction)settingsDidClick:(id)sender { 21 | // Log setting open event with category="ui", action="open", and label="settings". 22 | [[GAI sharedInstance].defaultTracker send: 23 | [[GAIDictionaryBuilder createEventWithCategory:@"ui" 24 | action:@"open" 25 | label:@"settings" 26 | value:nil] build]]; 27 | 28 | // Show an alert. 29 | [[[UIAlertView alloc] initWithTitle:@"Alert" 30 | message:@"Clicked settings" 31 | delegate:nil 32 | cancelButtonTitle:nil 33 | otherButtonTitles:@"OK", nil] show]; 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /HelloWorldExample/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import "AppDelegate.h" 3 | 4 | int main(int argc, char * argv[]) { 5 | @autoreleasepool { 6 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DEPRECATED 2 | 3 | This project is no longer actively maintained. Please refer to the [Google Analytics iOS Quickstart app](https://github.com/googlesamples/google-services/tree/master/ios/analytics) in the [google-services](https://github.com/googlesamples/google-services) project. 4 | 5 | Google Analytics Hello World App 6 | ================================ 7 | 8 | Example minimal iOS app using Google Analytics. See [Google Analytics Getting Started Guide](https://developers.google.com/analytics/devguides/collection/ios/) for detailed instructions on how to add Google Analytics to your app. 9 | --------------------------------------------------------------------------------