Google Analytics SDK を使ってみる

2012/09/06

[iOS][Google]10分でわかるGoogle Analytics SDK for iOS Google Analytics SDK

#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]) {
        // エラーハンドリング
    }
}

Google Analytics SDK