Miq*_*uel 9 android google-analytics ios
我一直在阅读iOS的Custom Dimensions文档,并找到了以下示例:
// 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]];
Run Code Online (Sandbox Code Playgroud)
但是当在控制面板中创建维度时,建议的代码是:
NSString *dimensionValue = @"SOME_DIMENSION_VALUE";
[tracker set:[GAIFields customDimensionForIndex:1] value:dimensionValue];
Run Code Online (Sandbox Code Playgroud)
// 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()
);
Run Code Online (Sandbox Code Playgroud)
我的问题:
代码可以是:
[tracker set:[GAIFields customDimensionForIndex:1]
value:@"custom dimension value"]
[tracker send:[[[GAIDictionaryBuilder createAppView] set:@"custom dimension value"
forKey:[GAIFields customDimensionForIndex:1]]
Run Code Online (Sandbox Code Playgroud)
小智 3
有一个很好的教程,介绍如何使用 iOS 和 Android 的自定义维度以及如何设置自定义报告。
对于第一种情况,有两种不同的方法。它们彼此独立。
第一的:
id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];
[tracker set:[GAIFields customDimensionForIndex:index] value:@"value"];
tracker send:[[GAIDictionaryBuilder createScreenView] build]];
Run Code Online (Sandbox Code Playgroud)
第二:
id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];
[tracker send:[[[GAIDictionaryBuilder createScreenView] set:@"value"
forKey:[GAIFields customDimensionForIndex:index]] build]];
Run Code Online (Sandbox Code Playgroud)
如果您想跟踪自定义维度或自定义指标,则必须在GA 管理页面上创建它们。这里选择自定义。之后,在自定义选项卡上创建自定义报告,该报告将代表您的测量结果。
重要的是,您必须在谷歌分析注册后等待一两天,直到测量结果出现在您的自定义报告中。
| 归档时间: |
|
| 查看次数: |
1631 次 |
| 最近记录: |