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