Version: 2021.1
Unity Analytics A/B 测试
收据验证

变现

Unity Analytics 允许您通过变现功能监控游戏内的收入。通过实现收据验证,很快就能发现合法或欺诈交易。

Unity Analytics 提供 Analytics.Transaction 方法来跟踪通过应用内购 (IAP) 发起的变现事件。每次玩家触发变现事件时都应调用此方法。Analytics.Transaction 方法需要价格参数、货币和可选的 Apple iTunes/Google Play 收据字符串。

  // 引用 Unity Analytics 命名空间
    using UnityEngine.Analytics;

    // 对玩家触发变现事件的每个位置使用此调用
    Analytics.Transaction(string productId, decimal price,
    string currency, string receipt,
    string signature);
Analytics.Transaction Input Parameters
Name Type Description
productId string The id of the purchased item.
price decimal The price of the item.
currency string Abbreviation of the currency used for the transaction. For example “USD” (United States Dollars). See here for a standardized list of currency abbreviations.
receipt string Receipt data (iOS) or receipt ID (Android) for in-app purchases to verify purchases with Apple iTunes or Google play. Use null in the absence of receipts. For more details see Receipt Verification.
signature string Android receipt signature. If using native Android use the INAPP_DATA_SIGNATURE string containing the signature of the purchase data that was signed with the private key of the developer. The data signature uses the RSASSA-PKCS1-v1_5 scheme. Pass in null in the absence of a signature.

以下示例是不含收据验证的 0.99 美元交易。

Analytics.Transaction("12345abcde", 0.99m, "USD", null, null);
Unity Analytics A/B 测试
收据验证
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961