小编Rie*_* C.的帖子

GANTracker for iPhone SDK自定义变量给出错误195946409

我想使用谷歌分析来跟踪某些用户的浏览量和会话.为此,我(想)使用最新(v1.1)GANTracker版本支持的自定义变量.

在我的appHeader中我有这个代码:

[[GANTracker sharedTracker] startTrackerWithAccountID:@"UA-xxxxxxxx-x"
                                       dispatchPeriod:10
                                             delegate:nil];

NSError *error1;
if(![[GANTracker sharedTracker] setCustomVariableAtIndex:0
                                                    name:@"userSession"
                                                   value:@"username"
                                                   scope:kGANSessionScope
                                               withError:&error1]){
    NSLog(@"error1 %@", error1);
}

NSError *error2;
if(![[GANTracker sharedTracker] setCustomVariableAtIndex:1
                                                    name:@"userSession"
                                                   value:@"username"
                                                   scope:kGANPageScope
                                               withError:&error2]){
    NSLog(@"error2 %@", error2);
}
Run Code Online (Sandbox Code Playgroud)

当我启动我的应用程序时,我得到这些错误:

error1: Error Domain=com.google.googleanalytics.GANTrackerError Code=195946409 "The operation couldn’t be completed. (com.google.googleanalytics.GANTrackerError error 195946409.)"
error2: Error Domain=com.google.googleanalytics.GANTrackerError Code=195946409 "The operation couldn’t be completed. (com.google.googleanalytics.GANTrackerError error 195946409.)"
Run Code Online (Sandbox Code Playgroud)

在打开我要跟踪的页面的函数中我把它放入:

NSError * error;
if(![[GANTracker sharedTracker] trackPageview:@"/pagename"]
                                    withError:&error]){
        NSLog(@"%@", error);
}
Run Code Online (Sandbox Code Playgroud)

这不会返回任何错误

如果我省略了setCustomVariableAtIndex函数,则会在分析中记录页面视图,但是使用自定义变量我什么也得不到.

有没有人知道如何解决这个问题?

google-analytics-api ipad ios

6
推荐指数
1
解决办法
3400
查看次数

添加禁用(和选定)选项以选择带有表单助手的项目

嗨,我正在尝试使用表单助手向选择框添加禁用选项我使用此代码生成一个额外的空字段,但我希望禁用此字段.

echo $this->Form->input('User.usertype_id',array('type'=>'select', 'empty'=>'usertype');
Run Code Online (Sandbox Code Playgroud)

这会产生:

<div class="input select">
    <label for="UserUsertypeId">Usertype</label>
    <select name="data[User][usertype_id]" id="UserUsertypeId">
        <option value="">usertype</option>
        <option value="1">athlete</option>
        <option value="2">trainer</option>
    </select>
</div>
Run Code Online (Sandbox Code Playgroud)

但我想要这个:

<div class="input select">
    <label for="UserUsertypeId">Usertype</label>
    <select name="data[User][usertype_id]" id="UserUsertypeId">
        <option value="" disabled="disabled" selected="selected">usertype</option>
        <option value="1">athlete</option>
        <option value="2">trainer</option>
    </select>
</div>
Run Code Online (Sandbox Code Playgroud)

有没有办法简单地做到这一点,或者我应该只使用一些js?

cakephp formhelper

4
推荐指数
2
解决办法
2万
查看次数

标签 统计

cakephp ×1

formhelper ×1

google-analytics-api ×1

ios ×1

ipad ×1