Tôi đã đọc Custom Dimensions documentation for iOS và tìm thấy các ví dụ sau:iOS tùy chỉnh của Google Analytics Kích thước
// 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]];
Nhưng khi kích thước được tạo ra trong bảng điều khiển, các mã được đề xuất là:
NSString *dimensionValue = @"SOME_DIMENSION_VALUE";
[tracker set:[GAIFields customDimensionForIndex:1] value:dimensionValue];
Tôi cũng đã đọc số documentation for Android và tìm thấy ví dụ này:
// 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()
);
Câu hỏi của tôi:
- Cách nào đúng để đặt thứ nguyên trong iOS?
- Trong trường hợp đầu tiên (tài liệu), tại sao trong iOS, chúng tôi cần đặt giá trị cả trong trình theo dõi và trình tạo?
- Tại sao trong iOS giá trị thứ nguyên trong bộ theo dõi ("Người dùng cao cấp") được đặt thành một giá trị khác trong trình tạo ("cao cấp")?
- Việc đặt cùng một giá trị trong trình theo dõi và trong trình xây dựng có đúng không?
- Trong trường hợp đó, tại sao lại đặt hai lần? Tôi đã cố gắng để thiết lập nó chỉ trong builder và sau đó nó chrashes với lỗi lớp này không phải là giá trị khóa mã hóa tuân thủ cho các phím & cd1. Đặt nó trong trình theo dõi sẽ không hỗ trợ lại giá trị (GA for iOS and custom dimensions).
Mã này có thể là:
[tracker set:[GAIFields customDimensionForIndex:1]
value:@"custom dimension value"]
[tracker send:[[[GAIDictionaryBuilder createAppView] set:@"custom dimension value"
forKey:[GAIFields customDimensionForIndex:1]]
Tôi gặp sự cố chính xác khi sử dụng trình tạo. Bạn đã đến bất kỳ giải pháp nào chưa? Tôi đang sử dụng Swift nếu nó quan trọng. – Sam
Đặt nó hai lần: trong '[tracker set:]' và trong '[tracker send:]' như được định hướng trong đoạn mã cuối cùng. Nhưng vẫn không có câu trả lời cho câu hỏi này ... – Miquel