2010年12月26日 星期日

[iPhone SDK] Google Analystics

1. Register your analytics ID

2. Download Google Analytics SDK Library

3. Add libGoogleAnalytics.a and GANTracker.h into project

4. Add this in code
#import "GANTracker.h"

[[GANTracker sharedTracker] startTrackerWithAccountID:@"Analystics ID"
dispatchPeriod:kGANDispatchPeriodSec
delegate:nil];

NSError *error;
if (![[GANTracker sharedTracker] trackPageview:@"/TrackerTitle" withError:&error])
{
// Handle error here
NSLog(@"RootViewController - GANTracker error!");
}

基本上他就會自己上傳analystics的資訊了
一開始不會顯示ready, 要過幾天才會有綠色的勾勾

沒有留言:

張貼留言