在阅读了所有线程之后,我仍然没有弄清楚为什么我的 Android 应用程序没有将电子商务值发送到分析。(或者可能确实如此,但未显示)我确实在 GA 中激活了电子商务,我使用 v2 并在 orderComplete 上添加了以下代码:
GoogleAnalytics ga = GoogleAnalytics.getInstance(ctx);
Transaction cardTransaction = new Transaction.Builder(
String.valueOf(order.getOrderId()), // (String) Transaction Id, should be unique.
orderTotal // (long) Order total (in micros)
.setAffiliation(cardName) // (String) Affiliation
.setTotalTaxInMicros(0) // (long) Total tax (in micros)
.setShippingCostInMicros(0) // (long) Total shipping cost (in micros)
.setCurrencyCode("EUR") // (String) Setting the correct currency
.build();
cardTransaction.addItem(new Item.Builder(
caption, // (String) Product SKU (stock-keeping unit)
productName, // (String) Product name
price, // (long) Product price (in micros)
quantity) // (long) Product quantity
.setProductCategory(productCategorie) // (String) Product category
.build());
Tracker tracker = ga.getTracker(R.string.googleAnalyticsKey);
tracker.sendTransaction(cardTransaction); // Send the transaction.
GAServiceManager.getInstance().dispatch();
我记录了所有值,它们是正确的并且格式正确。
谁能解释我在哪里犯了错误?