gpt4 book ai didi

Android:应用内购买 - Google Analytics

转载 作者:行者123 更新时间:2023-11-30 04:03:00 25 4
gpt4 key购买 nike

我在安卓应用中成功实现了应用内购买。我只想在谷歌分析中记录购买事件。如果应用程序在前台,我可以通过 PurchaseObserver 记录事件。但是如果应用程序在后台,如何在谷歌分析中记录事件。目前我正在使用 EasyTracking 库来记录事件。

请帮助。提前致谢。

最佳答案

使用新的 v2 Google Analytics Android API 尝试类似的操作

public void onPurchaseCompleted() {
Transaction myTrans = new Transaction.Builder(
"0_123456", // (String) Transaction Id, should be unique.
(long) 2.16 * 1000000) // (long) Order total (in micros)
.setAffiliation("In-App Store") // (String) Affiliation
.setTotalTaxInMicros((long) 0.17 * 1000000) // (long) Total tax (in micros)
.setShippingCostInMicros(0) // (long) Total shipping cost (in micros)
.build();

myTrans.addItem(new Item.Builder(
"L_789", // (String) Product SKU
"Level Pack: Space", // (String) Product name
(long) 1.99 * 1000000, // (long) Product price (in micros)
(long) 1) // (long) Product quantity
.setProductCategory("Game expansions") // (String) Product category
.build());

Tracker myTracker = EasyTracker.getTracker(); // Get reference to tracker.
myTracker.trackTransaction(myTrans); // Track the transaction.
}

关于Android:应用内购买 - Google Analytics,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12198821/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com