Created
February 5, 2013 01:45
-
-
Save jaybaird/4711433 to your computer and use it in GitHub Desktop.
Sensible analytics functions using LLVM's overloadable
This file contains hidden or 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
NSString * eventForCategoryAction(NSString *category, NSString *action) { | |
return [NSString stringWithFormat:@"%@:%@", (category) ? category : @"default", action] | |
} | |
void __attribute__((overloadable)) TrackEvent(NSString *category, NSString *action, NSDictionary *infoDict) { | |
[Flurry trackEvent:eventForCategory(category, action) withParameters:infoDict]; | |
} | |
void __attribute__((overloadable)) TrackEvent(NSString *category, NSString *action) { | |
TrackEvent(category, action, nil); | |
} | |
void __attribute__((overloadable)) TrackEvent(NSString *action) { | |
TrackEvent(nil, action, nil); | |
} | |
void __attribute__((overloadable)) TrackTimedEvent(NSString *category, NSString *action, NSDictionary *infoDict) { | |
[Flurry trackEvent:eventForCategoryAction(category, action) withParameters:infoDict timed:YES]; | |
} | |
void __attribute__((overloadable)) TrackTimedEvent(NSString *category, NSString *action) { | |
TrackTimedEvent(category, action, nil); | |
} | |
void __attribute__((overloadable)) TrackTimedEvent(NSString *action) { | |
TrackTimedEvent(nil, action, nil); | |
} | |
void __attribute__((overloadable)) StopTimedEvent(NSString *category, NSString *action, NSDictionary *infoDict) { | |
[Flurry endTimedEvent:eventForCategoryAction(category, action) withParameters:infoDict]; | |
} | |
void __attribute__((overloadable)) StopTimedEvent(NSString *category, NSString *action) { | |
StopTimedEvent(category, action, nil); | |
} | |
void __attribute__((overloadable)) StopTimedEvent(NSString *action) { | |
StopTimedEvent(nil, action, nil); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment