9
我一直在阅读Custom Dimensions documentation for iOS,发现下面的例子:iOS版谷歌Analytics(分析)自定义尺寸
// May return nil if a tracker has not yet been initialized with a property ID.
id tracker = [[GAI sharedInstance] defaultTracker];
// 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]];
但在控制面板中创建的尺寸时,所提出的代码是:
NSString *dimensionValue = @"SOME_DIMENSION_VALUE";
[tracker set:[GAIFields customDimensionForIndex:1] value:dimensionValue];
我也一直在阅读documentation for Android,发现这个例子:
// Get tracker.
Tracker t = ((AnalyticsSampleApp) getActivity().getApplication()).getTracker(TrackerName.APP_TRACKER);
t.setScreen("Home Screen");
// Send the custom dimension value with a screen view.
// Note that the value only needs to be sent once.
t.send(new HitBuilders.AppViewBuilder()
.setCustomDimension(1, "premiumUser")
.build()
);
个我的问题:
- 这是设置尺寸的iOS正确的方法是什么?
- 如果是第一个(文档之一),为什么在iOS中我们需要在跟踪器和构建器中设置值?
- 为什么在iOS中,跟踪器(“高级用户”)中的维度值在生成器(“高级”)中设置为不同的值?
- 在跟踪器和构建器中设置相同的值是否正确?
- 在这种情况下,为什么要设置两次?我试图设置它只是在建设者,然后它崩溃与错误这个类是不符合密钥编码的密钥& cd1。将其设置为跟踪器不会支持该值(GA for iOS and custom dimensions)。
的代码可能是:
[tracker set:[GAIFields customDimensionForIndex:1]
value:@"custom dimension value"]
[tracker send:[[[GAIDictionaryBuilder createAppView] set:@"custom dimension value"
forKey:[GAIFields customDimensionForIndex:1]]
使用构建器时遇到确切的崩溃。你有没有达到任何解决方案?如果它很重要,我使用Swift。 – Sam 2015-01-22 21:39:13
设置两次:在[tracker set:]'和[tracker send:]'中,如最后一个代码所示。但仍然没有回应这个问题... – Miquel 2015-01-23 06:38:26