Last active
December 21, 2015 16:18
-
-
Save izotx/6332113 to your computer and use it in GitHub Desktop.
Google Analytics How hard is to write it in a right way?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//That's a correct version of onLoad method it takes a NSNUmber as a time parameter, not NSTimeInterval. | |
With prior Google's implementation I couldn't even build the project without warnings or errors. | |
- (void)onLoad:(NSNumber *)loadTime name:(NSString *)name andLabel:(NSString *)label{ | |
// May return nil if a tracker has not already been initialized with a | |
// property ID. | |
id tracker = [[GAI sharedInstance] defaultTracker]; | |
[tracker send:[[GAIDictionaryBuilder createTimingWithCategory:@"resources" // Timing category (required) | |
interval:loadTime // Timing interval (required) | |
name:name // Timing name | |
label:label]build]];// Timing label | |
} | |
//To get rid of annoying warning remove the id<GAITracker> tracker and just leave the call to shared instance | |
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ | |
_appStart = [NSDate date]; | |
//Initialize tracker | |
[GAI sharedInstance].trackUncaughtExceptions = YES; | |
// Optional: set Logger to VERBOSE for debug information. | |
// [[[GAI sharedInstance] logger] setLogLevel:kGAILogLevelVerbose]; | |
// Initialize tracker. | |
[[GAI sharedInstance] trackerWithTrackingId:@"UA-43467716-1"]; | |
// rest of implementation | |
return YES; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment