>“每当用户单击选项卡时,我需要创建一个包含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
我尝试了两个解决方案,他们都没有达到我的期望,这给我带来了两个问题:
文档具有如下示例代码:
// 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];
任何建议或提示将不胜感激.谢谢.
解决方法
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