質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.47%
Objective-C

Objective-Cはオブジェクト指向型のプログラミング言語のひとつです。C言語をベースにSmalltalkが取り入れられています。

Google Analytics

Google AnalyticsはGoogleが開発した無料のウェブ分析のソリューションです。複数のクライアント側のAPIとデータをエクスポートし管理するREST APIも格納されています。

Xcode 4

Xcode 4はMac OS Xを使ってMac OSとiOSをターゲットとしたソフトウェアを開発するための主な開発ツールです。

Xcode

Xcodeはソフトウェア開発のための、Appleの統合開発環境です。Mac OSXに付随するかたちで配布されています。

Q&A

2回答

2203閲覧

google analyticsで計測ができない

hirahira10

総合スコア50

Objective-C

Objective-Cはオブジェクト指向型のプログラミング言語のひとつです。C言語をベースにSmalltalkが取り入れられています。

Google Analytics

Google AnalyticsはGoogleが開発した無料のウェブ分析のソリューションです。複数のクライアント側のAPIとデータをエクスポートし管理するREST APIも格納されています。

Xcode 4

Xcode 4はMac OS Xを使ってMac OSとiOSをターゲットとしたソフトウェアを開発するための主な開発ツールです。

Xcode

Xcodeはソフトウェア開発のための、Appleの統合開発環境です。Mac OSXに付随するかたちで配布されています。

0グッド

0クリップ

投稿2015/05/01 02:12

編集2015/05/01 02:42

iosアプリにanalyticsを導入したいのですが
うまく計測が出来ません。
エラーなどは解消されています。

まだエラーが消えて数時間しか経っていないのですが
iOS simulartorで確認しリアルタイムのサマリーで計測を確認しています。

シミュレーターでは計測されない、開発環境では計測されないなどもありましたらご指導頂けると幸いです

下記のようなコードになっています。
関係していると思う部分のみ抜粋してあります。
見づらくて申し訳ないのですがご指導いただけると幸いです

AppDelegate.m

#import "AppDelegate.h"
#import "GAI.h"

  • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.

    //insert value for variables
    tabIndexCurrent = 1 ; //the first tab of tabbar
    tabIndexBefore = -1 ;
    contest_type = 0; // none contest
    contest_id = @""; // none contest
    catID_flag = false; //tap on button catagories in tab My Page (true: tapped - false: not be tapped)
    catID = @"";
    catName = @"";
    strDeviceToken = @""; //none device token
    JxI = @"";
    JxUIX = @"";
    path = @""; //path for copy file configInfo.plist to Document folder
    isUpdate = @"NO"; //NO = has not been updated yet
    numberOfNotifications = @"0";
    isFirstRunContestTab = @"";
    _isFirstRunApp = @"";
    strURLTemp = tabContest;
    isPostingContest = false;
    isLeavedTab = false;
    imageName = @"icon_dissableCrow.png";
    isExistiOSTwitterAccount = false; //True: user already logined on system iOS twitter;
    screenNameTwitter = @"";
    twitter_enable = @"";
    twitter_text = @"";
    pushNotification_alert = @"";

    //Connect to GrowthPush Notification
    [EasyGrowthPush setApplicationId:2922 secret:@"QJrUUHQGHtDx9LpKcHiouPtEY4dRVIHg" environment:kGrowthPushEnvironment debug:YES];
    // Optional: automatically send uncaught exceptions to Google Analytics.
    [GAI sharedInstance].trackUncaughtExceptions = YES;

    // Optional: set Google Analytics dispatch interval to e.g. 20 seconds.
    [GAI sharedInstance].dispatchInterval = 20;

    // Optional: set Logger to VERBOSE for debug information.
    [[[GAI sharedInstance] logger] setLogLevel:kGAILogLevelVerbose];

    // Initialize tracker. Replace with your tracking ID.
    [[GAI sharedInstance] trackerWithTrackingId:@"トラッキングコード"];

    id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];

    // Check to see if this is an iOS 8 device.
    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
    {
    // Register for push in iOS 8.
    [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
    [[UIApplication sharedApplication] registerForRemoteNotifications];
    }
    else
    {
    // Register for push in iOS 7 and under.
    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
    }

    //Check version for HTML Source
    [self copyPlist];

    configInfoDict = [NSMutableDictionary dictionaryWithContentsOfFile:path];

    NSLog(@"configInfoDict: %@", configInfoDict);

    JxI = [configInfoDict objectForKey:@"JxI"];
    JxUIX = [configInfoDict objectForKey:@"JxUIX"];
    isUpdate = [configInfoDict objectForKey:@"isUpdate"];
    _currentVersionHTMLFromFile = [configInfoDict objectForKey:@"Version"];
    isFirstRunContestTab = [configInfoDict objectForKey:@"isFirstRunContestTab"];
    _isFirstRunApp = [configInfoDict objectForKey:@"isFirstRunApp"];

    //Create a fake UDID for device
    NSString *domain = @"www.aaatest.com";
    NSString *key = @"auaatest";
    secrect_udid = [SecureUDID UDIDForDomain:domain usingKey:key];

    //Get number of notifications
    [self.implementAPIBussiness getNumberOfNotificationsWithJxI:JxI];

    //update SecureUDID for server numbers of download aaa app
    if ([_isFirstRunApp isEqualToString:@"NO"])
    {
    [self newDownload:secrect_udid];

    [configInfoDict setValue:@"YES" forKey:@"isFirstRunApp"]; _isFirstRunApp = @"YES"; if ([configInfoDict writeToFile:path atomically:YES]) { NSLog(@"Edit file plist successfull"); }

    }

    //Get version HTML from server
    [self.implementAPIBussiness checkVersionHTML];

    [self performSelector:@selector(loadScreen) withObject:nil afterDelay:1.0];

    return YES;

}

TimelineViewController.h
#import "GAITrackedViewController.h"

@interface TimelineViewController : GAITrackedViewController <UIWebViewDelegate, UISearchBarDelegate, UIAlertViewDelegate, UIScrollViewDelegate, EGORefreshTableHeaderDelegate>

{
AppDelegate *mainDelegate;

EGORefreshTableHeaderView *_refreshHeaderView; UIScrollView *webScroller; BOOL _reloading;

}

TimelineViewController.m

#import "GAITrackedViewController.h"
@interface TimelineViewController (){
CGRect originalFrame;
}

@end

@implementation TimelineViewController
-(void)viewWillAppear:(BOOL)animated
{
_webView.delegate = self;

[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone]; [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveNotification:) name:@"numberNotification" object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveNotification:) name:@"tapTabTimelineAgain" object:nil]; [super viewWillAppear:animated];

self.screenName = [NSString stringWithFormat:@"%@", NSStringFromClass([self class])];
self.screenName = @"timeline";

}ボールドテキスト

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答2

0

ViewControllerをGoogleAnaliticsのものを継承しているので、ViewControllerが表示されたタイミングで計測したいと、予想します。

GAのViewControllerを継承すると自動で送信するのですが、そのためにはスクリーンネームを指定しないといけません。
viewDidLoad:あたりで、スクリーンネームを指定してみてください。

self.screenName = @"お好きな名前";

この「お好きな名前」がGAのサマリーで見えると思います。

投稿2015/07/18 02:16

tomato

総合スコア20

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

まず気になった箇所をいくつか指摘させてください

  • Objective-Cのハイライト表示にしてください、さすがに見辛いです
  • どういったタイミングのときにGAを送りたいのかを書いてくれると検討がつくかもしれません
  • 見せて頂いてるコードだとGAの送信処理がないように見えるので送信部分のコードがあれば見せて頂けると原因がわかるかもしれません

投稿2015/07/17 10:44

編集2015/07/17 10:44
__moai

総合スコア264

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.47%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問