Google Analytics Enhanced Ecommerce - setPrice 应该是总价还是单一价?
Google Analytics Enhanced Ecommerce - setPrice should be total or single?
我真的很惊讶我找不到这个问题的答案,我想这应该是一个很常见的问题。
我已经对我的应用程序实施了分析跟踪,但我无法弄清楚产品上设置的价格应该是单一产品价格,还是最终产品价格(数量 x 单一价格)?
所以基本上我应该从下面做哪一个?
假设我有一个产品数据和构建器:
String productId = "123";
String productName = "Grimlock Action Figure";
String productCategory = "Toys";
String productVariant = "Transformers Robots in Disguise";
String productBrand = "Hasbro";
int quantity = 3;
double singleToyPrice = 19.99;
HitBuilders.ScreenViewBuilder builder = new HitBuilders.ScreenViewBuilder();
ProductAction productAction = new ProductAction(ProductAction.ACTION_PURCHASE)
.setTransactionId("1234567890");
我应该
a) 只需添加一个单件价格的产品
Product product = new Product()
.setId(productId)
.setName(productName)
.setCategory(productCategory)
.setBrand(productBrand)
.setVariant(productVariant)
.setPrice(singleToyPrice) // 19.99
.setQuantity(quantity); // 3
builder.addProduct(product)
.setProductAction(productAction);
b) 将单个价格乘以数量
Product product = new Product()
.setId(productId)
.setName(productName)
.setCategory(productCategory)
.setBrand(productBrand)
.setVariant(productVariant)
.setPrice((double) quantity * singleToyPrice) // 3 * 19.99 = 59.97
.setQuantity(quantity); // 3
builder.addProduct(product)
.setProductAction(productAction);
c) 单笔价格添加商品数量倍数
for (int i = 0; i < quantity; i++) {
Product product = new Product()
.setId(productId)
.setName(productName)
.setCategory(productCategory)
.setBrand(productBrand)
.setVariant(productVariant)
.setPrice(singleToyPrice) // 19.99
.setQuantity(1); // 1
builder.addProduct(product)
.setProductAction(productAction);
}
只是想知道哪一个能让分析计算出正确的数量?
此致,
DPD
测试了一下,肯定是(a)。感谢@EikePierstoriff 的帮助。
String productId = "123";
String productName = "Grimlock Action Figure";
String productCategory = "Toys";
String productVariant = "Transformers Robots in Disguise";
String productBrand = "Hasbro";
int quantity = 3;
double singleToyPrice = 19.99;
HitBuilders.ScreenViewBuilder builder = new HitBuilders.ScreenViewBuilder();
ProductAction productAction = new ProductAction(ProductAction.ACTION_PURCHASE)
.setTransactionId("1234567890");
Product product = new Product()
.setId(productId)
.setName(productName)
.setCategory(productCategory)
.setBrand(productBrand)
.setVariant(productVariant)
.setPrice(singleToyPrice) // 19.99
.setQuantity(quantity); // 3
builder.addProduct(product)
.setProductAction(productAction);
这个现在可以resolved/closed了。
我真的很惊讶我找不到这个问题的答案,我想这应该是一个很常见的问题。
我已经对我的应用程序实施了分析跟踪,但我无法弄清楚产品上设置的价格应该是单一产品价格,还是最终产品价格(数量 x 单一价格)?
所以基本上我应该从下面做哪一个?
假设我有一个产品数据和构建器:
String productId = "123";
String productName = "Grimlock Action Figure";
String productCategory = "Toys";
String productVariant = "Transformers Robots in Disguise";
String productBrand = "Hasbro";
int quantity = 3;
double singleToyPrice = 19.99;
HitBuilders.ScreenViewBuilder builder = new HitBuilders.ScreenViewBuilder();
ProductAction productAction = new ProductAction(ProductAction.ACTION_PURCHASE)
.setTransactionId("1234567890");
我应该
a) 只需添加一个单件价格的产品
Product product = new Product()
.setId(productId)
.setName(productName)
.setCategory(productCategory)
.setBrand(productBrand)
.setVariant(productVariant)
.setPrice(singleToyPrice) // 19.99
.setQuantity(quantity); // 3
builder.addProduct(product)
.setProductAction(productAction);
b) 将单个价格乘以数量
Product product = new Product()
.setId(productId)
.setName(productName)
.setCategory(productCategory)
.setBrand(productBrand)
.setVariant(productVariant)
.setPrice((double) quantity * singleToyPrice) // 3 * 19.99 = 59.97
.setQuantity(quantity); // 3
builder.addProduct(product)
.setProductAction(productAction);
c) 单笔价格添加商品数量倍数
for (int i = 0; i < quantity; i++) {
Product product = new Product()
.setId(productId)
.setName(productName)
.setCategory(productCategory)
.setBrand(productBrand)
.setVariant(productVariant)
.setPrice(singleToyPrice) // 19.99
.setQuantity(1); // 1
builder.addProduct(product)
.setProductAction(productAction);
}
只是想知道哪一个能让分析计算出正确的数量?
此致, DPD
测试了一下,肯定是(a)。感谢@EikePierstoriff 的帮助。
String productId = "123";
String productName = "Grimlock Action Figure";
String productCategory = "Toys";
String productVariant = "Transformers Robots in Disguise";
String productBrand = "Hasbro";
int quantity = 3;
double singleToyPrice = 19.99;
HitBuilders.ScreenViewBuilder builder = new HitBuilders.ScreenViewBuilder();
ProductAction productAction = new ProductAction(ProductAction.ACTION_PURCHASE)
.setTransactionId("1234567890");
Product product = new Product()
.setId(productId)
.setName(productName)
.setCategory(productCategory)
.setBrand(productBrand)
.setVariant(productVariant)
.setPrice(singleToyPrice) // 19.99
.setQuantity(quantity); // 3
builder.addProduct(product)
.setProductAction(productAction);
这个现在可以resolved/closed了。