[iOS][Google]10分でわかるGoogle Analytics SDK for iOS
#ifdef __OBJC__
#import
#import
#import "GANTracker.h"
#endif
[[GANTracker sharedTracker] startTrackerWithAccountID:GOOGLE_ANALYTICS_ID
dispatchPeriod:10
delegate:nil];
- (void)trackAnalytics:(NSString *)key {
NSError *error;
key = [NSString stringWithFormat:@"/%@", key];
if ([[GANTracker sharedTracker] trackPageview:key withError:&error]) {
}
}
- (void)trackEventAnalytics:(NSString *)event :(NSString *)action :(NSString *)label {
NSError *error;
if (![[GANTracker sharedTracker] trackEvent:event
action:action
label:label
value:-1
withError:&error]) {
// エラーハンドリング
}
}