Skip to content

Instantly share code, notes, and snippets.

@dfox
Created August 7, 2012 18:56
Show Gist options
  • Save dfox/3288321 to your computer and use it in GitHub Desktop.
Save dfox/3288321 to your computer and use it in GitHub Desktop.
The EventLogger Class
#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