gpt4 book ai didi

android - 如何使用 Google 跟踪代码管理器 v5 跟踪电子商务事件到 Google Analytics?

转载 作者:行者123 更新时间:2023-11-29 02:18:33 25 4
gpt4 key购买 nike

我们目前将 Android 应用程序中的跟踪代码管理器从 v4 更新到 v5。我们看到的问题是,增强型电子商务事件现在仅在 Firebase Analytics 中可见,而在 Google Analytics 中不可见。

通过使用 v4,我们通过以下方式跟踪交易 (https://developers.google.com/tag-manager/android/v4/enhanced-ecommerce):

// Send transaction data with a screenview if possible.
// Otherwise, use an event when the transaction data becomes available.
dataLayer.push("ecommerce",
DataLayer.mapOf(
"purchase", DataLayer.mapOf(
"actionField", DataLayer.mapOf(
"id", "T12345", // Transaction ID. Required for purchases and refunds.
"affiliation", "Online Store",
"revenue", "35.43", // Total transaction value (incl. tax and shipping)
"tax", "4.90",
"shipping", "5.99",
"coupon", "SUMMER_SALE"),
"products", DataLayer.listOf( // List of productFieldObjects.
DataLayer.mapOf(
"name", "Triblend Android T-Shirt", // Name or ID is required.
"id", "12345",
"price", "15.25",
"brand", "Google",
"category", "Apparel",
"variant", "Gray",
"quantity", 1,
"coupon", ""), // Optional fields may be omitted or set to empty string.
DataLayer.mapOf(
"name", "Donut Friday Scented T-Shirt",
"id", "67890",
"price", "33.75",
"brand", "Google",
"category", "Apparel",
"variant", "Black",
"quantity", 1)))));

现在我们使用v5的方式来跟踪一笔交易( https://developers.google.com/tag-manager/android/v5/enhanced-ecommerce ):

// Define product with relevant parameters

Bundle product1 = new Bundle();
product1.putString( Param.ITEM_ID, "sku1234"); // ITEM_ID or ITEM_NAME is required
product1.putString( Param.ITEM_NAME, "Donut Friday Scented T-Shirt");
product1.putString( Param.ITEM_CATEGORY, "Apparel/Men/Shirts");
product1.putString( Param.ITEM_VARIANT, "Blue");
product1.putString( Param.ITEM_BRAND, "Google");
product1.putDouble( Param.PRICE, 29.99 );
product1.putString( Param.CURRENCY, "USD" ); // Item-level currency unused today
product1.putLong( Param.QUANTITY, 1 );

Bundle product2 = new Bundle();
product2.putString( Param.ITEM_ID, "sku5678");
product2.putString( Param.ITEM_NAME, "Android Workout Capris");
product2.putString( Param.ITEM_CATEGORY, "Apparel/Women/Pants");
product2.putString( Param.ITEM_VARIANT, "Black");
product2.putString( Param.ITEM_BRAND, "Google");
product2.putDouble( Param.PRICE, 39.99 );
product2.putString( Param.CURRENCY, "USD" ); // Item-level currency unused today
product2.putLong( Param.QUANTITY, 1 );

// Prepare ecommerce bundle

ArrayList items = new ArrayList();
items.add(product1);
items.add(product2);

Bundle ecommerceBundle = new Bundle();
ecommerceBundle.putParcelableArrayList( "items", items );

// Set relevant transaction-level parameters

ecommerceBundle.putString( Param.TRANSACTION_ID, "T12345" );
ecommerceBundle.putString( Param.AFFILIATION, "Google Store - Online" );
ecommerceBundle.putDouble( Param.VALUE, 37.39 ); // Revenue
ecommerceBundle.putDouble( Param.TAX, 2.85 );
ecommerceBundle.putDouble( Param.SHIPPING, 5.34 );
ecommerceBundle.putString( Param.CURRENCY, "USD" );
ecommerceBundle.putString( Param.COUPON, "SUMMER2017" );

// Log ecommerce_purchase event with ecommerce bundle

mFirebaseAnalytics.logEvent( Event.ECOMMERCE_PURCHASE, ecommerceBundle );

我们对 Event.ECOMMERCE_PURCHASE 事件的设置看起来是 this方式。

我们的目标是继续能够在此处查看 Google Analytics 中的交易:

但它并没有出现在那里。电子商务事件在 Firebase Analytics 中显示正常。其他事件也已成功发送到 Google Analytics,期待这个电子商务事件。

关于如何继续跟踪此 Google Analytics 交易事件的任何想法?我们问题的工作示例的资源也已经很有帮助了。所以基本上我正在寻找 https://support.google.com/tagmanager/answer/6107169?hl=en 的更新文档.感谢您的帮助!

最佳答案

您使用 google analytics 通用事件并要求它使用 fire base 事件发送电子商务数据,尝试将其更改为变量并使用您编写的变量?

关于android - 如何使用 Google 跟踪代码管理器 v5 跟踪电子商务事件到 Google Analytics?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58114840/

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