-
Notifications
You must be signed in to change notification settings - Fork 0
/
Analytics.m
32 lines (24 loc) · 940 Bytes
/
Analytics.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//
// Constants.m
// OpenStack
//
// Created by Matthew Newberry on 05/18/11.
// The OpenStack project is provided under the Apache 2.0 license.
//
#import "Analytics.h"
#import <objc/runtime.h>
void TrackEvent(NSString *category, NSString *action){
[[GANTracker sharedTracker] trackEvent:category action:action label:nil value:-1 withError:nil];
}
void TrackViewController(UIViewController *vc){
NSError *error;
NSMutableString *className = [NSMutableString stringWithUTF8String:class_getName([vc class])];
[className replaceOccurrencesOfString:@"ViewController" withString:@"" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [className length])];
[className insertString:@"/" atIndex:0];
[[GANTracker sharedTracker] trackPageview:className withError:&error];
}
void DispatchAnalytics(){
# if (!TARGET_IPHONE_SIMULATOR)
[[GANTracker sharedTracker] dispatch];
# endif
}