Created
August 7, 2012 18:56
-
-
Save dfox/3288321 to your computer and use it in GitHub Desktop.
The EventLogger Class
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
#import "EventLogger.h" | |
NSString *const EVENT_LOGGER_APPEARED = @"appeared"; | |
NSString *const EVENT_LOGGER_TOUCHED = @"touched"; | |
@implementation EventLogger | |
+(void)logEvent:(NSString *)type forObject:(NSObject *)object | |
{ | |
if ([object respondsToSelector:@selector(eventValue)] | |
&& [object respondsToSelector:@selector(eventType)]){ | |
NSString *eventValue = [object performSelector:@selector(eventValue)]; | |
NSString *eventType = [object performSelector:@selector(eventType)]; | |
if (eventValue != nil && (eventType == nil || [type isEqualToString:eventType])){ | |
if ([EVENT_LOGGER_APPEARED isEqualToString:eventType]){ | |
//[[LocalyticsSession sharedLocalyticsSession] tagScreen:eventValue]; | |
} | |
else if ([EVENT_LOGGER_TOUCHED isEqualToString:eventType]){ | |
//[[LocalyticsSession sharedLocalyticsSession] tagEvent:eventValue]; | |
} | |
NSLog(@"Event: %@: %@", eventType, eventValue); | |
} | |
} | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment