配置 User Reporting
Customize user reports with fields, metadata, attachments, and metrics to match your game's feedback needs.
阅读时间5 分钟最后更新于 1 个月前
User Reporting 的默认设置适合一般使用,但随着项目的发展,您可能希望根据特定需求进行更改。您可以构建与应用程序相匹配的自定义 UI 以引入自定义字段,也可以更改用户报告表单的外观。软件包中提供的示例有效,但只是为了帮助您入门。 用户报告包含多种有用的信息,比如元数据、事件、抽样指标、屏幕截图和文件附件。例如,您可以将用户的游戏存档文件附加到其报告中,或者在每次玩家执行特定操作时记录一个事件。您还可以在性能要求高的游戏场景中对性能指标进行抽样。 使用 API 可以配置报告中每种数据类型的最大值。UserReportExample 文件(位于导入到 Unity 项目中的示例内)演示了向报告添加数据的不同方式。 例如,您可以自定义以下设置,以限制报告中特定数据类型的最大值:
- :一个测量是指标每个收集的样本中涵盖的一组帧。默认测量长度为 60 帧。
FramesPerMeasure - :一个测量是指标样本中涵盖的一组帧,并计算报告中的最大测量次数。默认值为 300 次测量。
MaximumMeasureCount - :此限制适用于报告中包含的事件数量。默认值为 100 个事件。
MaximumEventCount - :报告中附加的屏幕截图数量上限。默认值为 10 张屏幕截图。
MaximumScreenshotCount - :表示指标收集模式。在默认配置下,一些指标,例如每秒帧数 (Graphics.FramesPerSecond),可以通过自动模式包含在报告中。手动模式仅会在报告中包含您的自定义指标,而禁用模式将完全阻止发送报告中的任何采样指标。
MetricsGatheringMode
UserReportingService.Instance..Configure(UserReportingClientConfiguration configuration)var customConfig = new UserReportingClientConfiguration(5, 5, 100, 100, MetricsGatheringMode.Automatic);UserReportingService.Instance.UserReporting.Configure(customConfig);
创建和发送报告
要创建报告,请调用UserReportingService.Instance.UserReporting.CreateNewUserReport();UserReportingService.Instance.SendUserReport(Action<float> progressUpdate, Action<bool> result)添加元数据
使用元数据可以收集游戏特定的数据,这些数据默认会随设备元数据一起包含在用户报告中。 要添加自定义元数据,请调用UserReportingService.Instance.AddMetadata(string name, string value)记录事件
要记录自定义事件,请调用UserReportingService.Instance.LogEvent(UserReportEventLevel level, string message)添加采样指标
要添加自定义采样指标,请调用UserReportingService.Instance.SampleMetric(string name, double value)SampleMetric添加屏幕截图
要向报告中添加屏幕截图,请调用UserReportingService.Instance.TakeScreenshot(int maximumWidth, int maximumHeight)UserReportingService.Instance.TakeScreenshot(int maximumWidth, int maximumHeight, object source)添加附件
添加视频和场景图片等附件。 附件会以 Base64 对象的形式编码。 要添加附件,请使用UserReportingService.Instance.AddAttachmentToReport(string title, string filename, byte[] data)规划报告的维度
使用维度可以在 Unity Dashboard(Unity 后台)上过滤用户报告。在发送报告之前,您可以通过向维度属性添加项目来向报告中添加维度和指标。每个维度或指标都有一个名称和一个值。您可以通过调用以下方法来向报告中添加新的维度:UserReportingService.Instance.AddDimensionValue(string dimension, string value);名称 | 值 |
|---|---|
| Platform | Android |
| Version | 2 |
| Category | Graphics |
| Platform | WindowsPlayer |
| Version | 1 |
| Language | English |
| Platform | WindowsPlayer |
| Version | 1 |
| Platform.Version | WindowsPlayer.1 |
维度名称 | 维度值 |
|---|---|
| Category | Graphics |
| Language | English |
| Platform | Android |
| Platform | WindowsPlayer |
| Platform.Version | WindowsPlayer: 1 |
| Version | 1 |
| Version | 2 |
维度名称 | 维度值 |
|---|---|
| Hash Tag | FloorBug |