Google Analytics & iPhone

14,326 views

Published on

Google Analytics for iOSの使い方についてです

Google Analytics & iPhone

  1. 1. Google Analytics & iPhone id:ninjinkun, @ninjinkun
  2. 2. • Google Analytics• Google Analytics for iOS• iPhone•
  3. 3. Google Analytics • Web • • (PV), (UU) • • • Web JS •
  4. 4. Google Analytics • • • • AB •
  5. 5. Google Analytics for iOS • iOS Google Analytics • Android • Google Analytics UI • Web • Obj-C •
  6. 6. Google Analytics for iOS • • • UI • • • ( )
  7. 7. iPhone • Project • GATracker.h • GATracker.a • ( )sqlite •
  8. 8. iPhone • • application:didFinishLaunchingWithOptions: [[GANTracker sharedTracker] startTrackerWithAccountID:@"UA-XXXXXXXXX" dispatchPeriod:kGANDispatchPeriodSec delegate:nil]; • PV • viewDidLoad, viewWillAppear • (BK) / [[GANTracker sharedTracker] trackPageview:@"/page" withError:&error]
  9. 9. iPhone • • Delegate [[GANTracker sharedTracker] trackEvent:@"my_category" action:@"my_action" label:@"my_label" value:-1 withError:&error] • • applicationWillTerminate applicationDidEnterBackground: • (BK) [[GANTracker sharedTracker] stopTracker];
  10. 10. iPhone • • • - (void)viewWillAppear:(BOOL)animated { GA_TRACK_CLASS } • -(void)configButtonPushed:(id)sender { GA_TRACK_METHOD }
  11. 11. • 1 ,1 ,1•
  12. 12. • View
  13. 13. •• ViewController• ≠ •
  14. 14. • Google Analytics for iOS•••
  15. 15. #define GA_TRACKPAGE(PAGE) { NSError *error; if (![[GANTracker sharedTracker]trackPageview:[NSString stringWithFormat:@"/%@", PAGE] withError:&error]) { LOG(@"%@",error.helpAnchor); } LOG(@"GA /%@", PAGE); };#define GA_TRACKEVENT(EVENT,ACTION,LABEL,VALUE) { NSError *error; if (![[GANTrackersharedTracker] trackEvent:EVENT action:ACTION label:LABEL value:VALUE withError:&error]){ LOG(@"%@",error.helpAnchor); } LOG(@"GA %@/%@/%@", EVENT, ACTION, LABEL); };#define GA_TRACK_CLASS GA_TRACKPAGE(NSStringFromClass([self class]));#define GA_TRACK_METHOD GA_TRACKEVENT(NSStringFromClass([self class]),NSStringFromSelector(_cmd), @””, -1); }

×