6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Google Analytics SDK for iOS V3(バージョン3)のマクロを作ってみた

Last updated at Posted at 2014-01-31
  • スクリーンビューをGA_TRACK_VIEWで
  • 細かい機能ごとのデータをとりたいときはEVENTで
  • どのページを見ているかなどのデータは、CUSTOM DIMENSIONを使って保存している
#import "GAI.h"
#import "GAIFields.h"
#import "GAIDictionaryBuilder.h"
 
#define GA_TRACK_VIEW(PAGE) [[[GAI sharedInstance] defaultTracker] send:[[[GAIDictionaryBuilder createAppView] set:PAGE forKey:kGAIScreenName] build]];
#define GA_TRACK_VIEW_WITH_CUSTOM1(PAGE, CUSTOM) [[[GAI sharedInstance] defaultTracker] send:[[[[GAIDictionaryBuilder createAppView] set:PAGE forKey:kGAIScreenName] set:CUSTOM forKey:[GAIFields customDimensionForIndex:1]] build]];
#define GA_TRACK_EVENT(EVENT,ACTION,LABEL,VALUE) [[[GAI sharedInstance] defaultTracker] send:[[GAIDictionaryBuilder createEventWithCategory:EVENT action:ACTION label:LABEL value:VALUE] build]];
#define GA_TRACK_TIMING(CATEGORY,TIME,NAME,LABEL) [[GAI sharedInstance] defaultTracker] send:[GAIDictionaryBuilder createTimingWithCategory:CATEGORY interval:TIME name:NAME label:LABEL] build];
#define GA_TRACK_SOCIAL(NETWORK,ACTION,TARGET) [[[GAI sharedInstance] defaultTracker] send:[GAIDictionaryBuilder createSocialWithNetwork:NETWORK action:ACTION target:TARGET] build];
 
#define GA_TRACK_CLASS GA_TRACK_VIEW(NSStringFromClass([self class]));

参考
http://d.hatena.ne.jp/diveintounlimit/20120922/1348316659

6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?