简体   繁体   English

我如何计算iOS中应用内购买的失败率

[英]How can i count the failure rate of in-app purchase in iOS

Recently i was told to count the failure rate of my app's(An Objective-C App) in-app purchase.最近我被告知要计算我的应用程序(一个 Objective-C 应用程序)应用内购买的失败率。

Is there any tool or any open-source lib that i can use?我可以使用任何工具或任何开源库吗? Do u have any idea?你有什么想法吗?

You should use your analytics tool to do that (Firebase, Amplitude, your custom tool…).您应该使用您的分析工具来做到这一点(Firebase、Amplitude、您的自定义工具……)。 To compute that ratio you will need to track 2 events failure and success to get that ratio.要计算该比率,您需要跟踪 2 个事件的failuresuccess以获得该比率。

To do that you will need to track the failures in your SKPaymentTransactionObserver .为此,您需要跟踪SKPaymentTransactionObserver中的故障。 Failures can be identified by checking the transactionState .可以通过检查transactionState来识别失败。 You should be tracking both SKPaymentTransactionStateFailed and SKPaymentTransactionStateDeferred .您应该同时跟踪SKPaymentTransactionStateFailedSKPaymentTransactionStateDeferred The deferred state occurs when your user needs the parental authorisation to purchase.当您的用户需要父母授权购买时,会出现延迟 state。 You should also track the error code and message as your event properties to be able to categorised your errors.您还应该将错误代码和消息作为事件属性进行跟踪,以便能够对错误进行分类。

I attached an example of the fail rate on an application computed by Purchasely我附上了一个由Purchasely计算的应用程序的失败率示例失败率示例

You have to keep track of any transactions coming back on the SKPaymentTransactionObserver protocol method您必须跟踪SKPaymentTransactionObserver protocol方法返回的任何交易

- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray<SKPaymentTransaction *> *)transactions

  1. Keep track of the total number of transactions that have state SKPaymentTransactionStatePurchasing跟踪具有 state SKPaymentTransactionStatePurchasing的交易总数
  2. Keep track of the total number of transactions that have state SKPaymentTransactionStateFailed跟踪具有 state SKPaymentTransactionStateFailed的交易总数

Keep in mind that if the user cancels the payment sheet you'll get a failed transaction back, so you might want to examine the user info on that transaction.error to determine if that failed transaction is of interest or not.请记住,如果用户取消付款表,您将收到失败的交易,因此您可能需要检查有关该transaction.error的用户信息,以确定该失败的交易是否值得关注。

Another thing is that if parental controls are enabled, the transactions will come back as SKPaymentTransactionStateDeferred and if no action is taken from the owner, they will silently fail without any information coming back at the delegate method.另一件事是,如果启用了家长控制,交易将以SKPaymentTransactionStateDeferred的形式返回,如果所有者没有采取任何操作,它们将静默失败,而委托方法不会返回任何信息。

I'd suggest sending those events on your backend or analytics tool and make the comparison logic there我建议在您的后端或分析工具上发送这些事件并在那里进行比较逻辑

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM