我希望使用Google AnalyticsSDK for iOS v2跟踪应用内购买,如Ecommerce Tracking指南中所述。使用Google Analytics iOS SDK进行应用内购买跟踪
目前我正在做接收SKPaymentTransactionStatePurchased
交易更新后的情况如下:
- (void) trackTransaction:(SKPaymentTransaction*)transaction
{
NSString *transactionIdentifier = transaction.transactionIdentifier;
GAITransaction *gaiTransaction = [GAITransaction transactionWithId:transactionIdentifier withAffiliation:@"App Store"];
SKPayment *payment = transaction.payment;
NSString *productIdentifier = payment.productIdentifier;
SKProduct *product = [self productForIdentifier:productIdentifier];
NSString *productTitle = product.localizedTitle;
int64_t priceInMicros = product.price.floatValue * 1000000; // FIXME: Doesn't consider different currencies
[gaiTransaction addItemWithCode:productIdentifier name:productTitle category:nil priceMicros:priceInMicros quantity:payment.quantity];
gaiTransaction.revenueMicros = priceInMicros * payment.quantity; // FIXME: doesn't consider Apple's cut
id<GAITracker> tracker = [GAI sharedInstance].defaultTracker;
[tracker trackTransaction:gaiTransaction];
}
是跟踪应用内购买的正道上面?我至少检测到两个问题:
SKProduct
返回一个本地化价格,如果我按原样追踪它,收入聚合将不正确。有没有办法使价格正常化?- 收入的回报并不考虑苹果公司的削减,这并不总是30%。是否有可能获得应用程序内的净收入?
不错的主意,@Seoras。 – hpique
这并不总是正好30%。它取决于App Store地区和货币。所以我会按照报告的方式留下收入,只是想着〜30%... – oleynikd
是。 2年后,现在有了一些经验,我可以指出日本是没有得到全面70%削减的好例子。日本保持20%的收入。除非您通过苹果提交免税表格,否则古埃及象形文字中的税款可能会如此混淆。 – Seoras