iOS版Google Analytics(分析) – 使用字典作为createEventWithCategory发送自定义事件数据仅允许发送4个参数

我决定在Flurry使用Google Analytics(分析),因为Flurry停止更新跟踪事件,而Flurry支持小组的任何人都不会回复我的查询.我的要求如下:

>“每当用户单击选项卡时,我需要创建一个包含Tab Name,User ID,Time Stamp的事件.来自Flurry事件日志的屏幕截图可以更清楚地描述它.

所以,在Google Analytics(分析)Event Tracking function createEventWithCategory中,几乎没有必要,但是不允许我添加用户ID,时间戳等自定义参数.

[tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"ui_action"     // Event category (required)
                                                  action:@"button_press"  // Event action (required)
                                                   label:@"play"          // Event label
                                                   value:nil] build]];    // Event value

我尝试了两个解决方案,他们都没有达到我的期望,这给我带来了两个问题:

Attempt 1: Custom Dimensions:

文档具有如下示例代码

// Set the custom dimension value on the tracker using its index.

 tracker set:[Gaifields customDimensionForIndex:1]value:@"Premium user"]
[tracker set:kGAIScreenName value:@"Home screen"];

// Send the custom dimension value with a screen view.
// Note that the value only needs to be sent once,so it is set on the Map,// not the tracker.

 [tracker send:[[[GAIDictionaryBuilder createAppView] set:@"premium"
                                              forKey:[Gaifields customDimensionForIndex:1]] build]];

[自定义维度值可以使用任何Google Analytics(分析)命中类型发送,包括屏幕视图,事件,电子商务交易,用户计时和社交互动.]

所以,我决定使用createEventWithCategory方法使用自定义维度,最后做如下所示的工作,但是没有显示Flurry显示的数据. **

Nsstring *dimensionValue = @"USER_ID";
[tracker set:[Gaifields customDimensionForIndex:1] value:dimensionValue];
[tracker send:[[[GAIDictionaryBuilder createEventWithCategory:@"TAB_CLICK"
                                                           action:@"Tab Hit"
                                                            label:clickedTabName
                                                            value:nil]
              set:currentUserEmail forKey:[Gaifields customDimensionForIndex:1]] build]];

Attempt 2: Setting and Sending Data using Dictionaries:

我遵循文档,并尝试发送NSDictionary对象到 – (void)send:(NSDictionary *)参数;在GAITracker.h中声明的方法.

但我不知道这些数据将在仪表板中显示.行为不是实时的,它显示任何更新.

id<GAITracker> tracker = [[GAI sharedInstance] trackerWithTrackingId:@"UA-XXXX-X"]; 
 NSDictionary *dataToSendGoogleAnalytics = [NSDictionary dictionaryWithObjectsAndKeys:currentTime,@"TIME_STAMP",clickedTabName,@"TAB_NAME",currentUserEmail,@"USER_ID",nil];   
 [tracker send:dataToSendGoogleAnalytics];

问题:我不能直接使用Flurry这样的东西,这将给我像图像那样的结果,并允许我在每一个事件中都有事件参数,如USER_EMAIL,Time_Stamp,TAB_NAME:

使用像这样接受NSDictionary对象的简单函数

[Flurry logEvent:@"TAB_CLICKED" withParameters:dataToSendFlurry timed:YES];

任何建议或提示将不胜感激.谢谢.

解决方法

您可以使用自定义维度将自定义数据发送到Google Analytics(分析).

you need to add custom dimension from your dashboard
after adding that you will get the code..

只需将其整合到您的项目中,并按照以下链接查看值.

http://www.lunametrics.com/blog/2013/09/10/access-custom-dimensions-google-analytics/#sr=g&m=o&cp=or&ct=-tmc&st=hpphmf%20dvtupn%20ejnfotjpo&ts=1384845402

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...