我跟随这篇教程成功地在我的iOS应用中实现了应用内购买。
现在,我正在尝试使用以下代码来实现Google Analytics来跟踪购买情况。但是,在购买完成后我不确定从哪里获得实际的值。
非常感谢任何示例代码。
- (void)onPurchaseCompleted {
GAITransaction *transaction =
[GAITransaction transactionWithId:@"0_123456" // (NSString) Transaction ID, should be unique.
withAffiliation:@"In-App Store"]; // (NSString) Affiliation
transaction.taxMicros = (int64_t)(0.17 * 1000000); // (int64_t) Total tax (in micros)
transaction.shippingMicros = (int64_t)(0); // (int64_t) Total shipping (in micros)
transaction.revenueMicros = (int64_t)(2.16 * 1000000); // (int64_t) Total revenue (in micros)
[transaction addItemWithSKU:@"L_789" // (NSString) Product SKU
name:@"Level Pack: Space" // (NSString) Product name
category:@"Game expansions" // (NSString) Product category
priceMicros:(int64_t)(1.99 * 1000000) // (int64_t) Product price (in micros)
quantity:1]; // (NSInteger) Product quantity
[[GAI sharedInstance].defaultTracker sendTransaction:transaction]; // Send the transaction.
}