Android 如何在Google Analytics电子商务中获取交易ID?
我正在为我的android应用程序实施Google Analytics Ecomerce跟踪 根据GA的文件(请参见下面的代码), 我需要创建一个新的事务。生成器需要“事务Id”。我发现Google没有返回交易Id,只有订单Id。 -问题是如何检索事务Id,或者我可以使用订单Id代替? 返回订单ID的示例格式为:12999763169054705758.1356245045384470Android 如何在Google Analytics电子商务中获取交易ID?,android,google-analytics,Android,Google Analytics,我正在为我的android应用程序实施Google Analytics Ecomerce跟踪 根据GA的文件(请参见下面的代码), 我需要创建一个新的事务。生成器需要“事务Id”。我发现Google没有返回交易Id,只有订单Id。 -问题是如何检索事务Id,或者我可以使用订单Id代替? 返回订单ID的示例格式为:12999763169054705758.1356245045384470 /** * The purchase was processed. We will send the tra
/**
* The purchase was processed. We will send the transaction and its associated line items to Google Analytics,
* but only if the purchase has been confirmed.
*/
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.sendTransaction(myTrans); // Send the transaction.
}
在google analytics sdk for android中,
交易id
指的是电子商务应用程序中每个客户交易的唯一标识符。在任何电子商务应用程序中,每笔客户交易都将有一个唯一的标识号,该标识号可以用作主键,同时将交易详细信息存储在站点数据库中。因此,在向analytics发送热门类型的电子商务时,您可以使用相同的唯一id,这似乎是您案例中的订单id
。
还请注意,在发送与交易对应的项目详细信息时,您应该使用相同的交易id/订单id,GA将使用该id链接交易和项目详细信息