Skip to content

Instantly share code, notes, and snippets.

@suwa-yuki
Created December 15, 2014 10:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suwa-yuki/15952e16c53c6ab79569 to your computer and use it in GitHub Desktop.
Save suwa-yuki/15952e16c53c6ab79569 to your computer and use it in GitHub Desktop.
Google AnalyticsをUIViewControllerで使う
@implementation UIViewController (Analytics)
- (void)startScreen:(NSString*)screenName
{
// Google Analytics
id tracker = [[GAI sharedInstance] defaultTracker];
[tracker set:kGAIScreenName value:screenName];
[tracker send:[[GAIDictionaryBuilder createAppView] build]];
}
- (void)sendGaiEvent:(NSString *)category action:(NSString *)action label:(NSString *)label value:(NSNumber *)value
{
id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];
[tracker send:[[GAIDictionaryBuilder createEventWithCategory:category
action:action
label:label
value:value] build]];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment