Created
December 10, 2013 12:23
-
-
Save eggmobile/7889810 to your computer and use it in GitHub Desktop.
iOS向けGoogle Analytics v3の設定についてメモ ref: http://qiita.com/eggmobile/items/ebffa22a1afb0d930f32
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef __OBJC__ | |
#import <UIKit/UIKit.h> | |
#import <Foundation/Foundation.h> | |
... | |
// Google アナリティクス | |
#import "GAI.h" //※ここを追記 | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// オプション: 例外を自動的にGoogle Analyticsに送る. | |
[GAI sharedInstance].trackUncaughtExceptions = YES; | |
// オプション: トラッキング間隔 20秒 | |
[GAI sharedInstance].dispatchInterval = 20; | |
// オプション: よくわかんないからコメントアウトした | |
//[GAI sharedInstance].debug = YES; | |
// トラッカーのインスタンス作成 | |
id<GAITracker> tracker = [[GAI sharedInstance] trackerWithTrackingId:@"トラッキングIDを記入"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// GAITrackedViewController.hをインポート | |
#import "GAITrackedViewController.h" | |
//UIViewControllerのサブクラスから、GAITrackedViewControllerに変更する | |
@interface HogeViewController : GAITrackedViewController | |
//viewDidAppear:に以下の一文を追加 | |
self.screenName = @"HogeViewController"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// インポート | |
#import "GAIFields.h" | |
#import "GAIDictionaryBuilder.h" | |
//viewDidLoad:に以下を追加 | |
[[[GAI sharedInstance] defaultTracker] set:kGAIScreenName value:@"HogeTableViewController"]; | |
[[[GAI sharedInstance] defaultTracker] send:[[GAIDictionaryBuilder createAppView] build]]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment