We have implemented the google analytics ecommerce tracking: https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce
我们已实施了Google分析电子商务跟踪:https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce
The standard ecommerce tracking gives us the options to send the following data to analytics from our "order complete" page:
标准电子商务跟踪为我们提供了从“订购完成”页面将以下数据发送到分析的选项:
ga('ecommerce:addTransaction', {
'id': '1234', // Transaction ID. Required.
'affiliation': 'Acme Clothing', // Affiliation or store name.
'revenue': '11.99', // Grand Total.
'shipping': '5', // Shipping.
'tax': '1.29' // Tax.
});
And for each item in the transaction:
并且对于交易中的每个项目:
ga('ecommerce:addItem', {
'id': '1234', // Transaction ID. Required.
'name': 'Fluffy Pink Bunnies', // Product name. Required.
'sku': 'DD23444', // SKU/code.
'category': 'Party Toys', // Category or variation.
'price': '11.99', // Unit price.
'quantity': '1' // Quantity.
});
We also want to send the profit/margin for each transaction/item. To solve this we have used custom metrics. So now our ecommerce tracking script looks like this:
我们还希望发送每笔交易/项目的利润/保证金。为解决此问题,我们使用了自定义指标。现在,我们的电子商务跟踪脚本如下所示:
<script type="text/javascript">
ga('require', 'ecommerce', 'ecommerce.js');
ga('ecommerce:addTransaction', {
'id': '1078163', // Transaction ID. Required.
'affiliation': 'www.website.com', // Affiliation or store name.
'revenue': '138' // Grand Total.
});
//Dimension
var dimensionValue = 'www.website.com';
ga('set', 'dimension1', dimensionValue);
//Revenue
var metricValue = '138';
ga('set', 'metric1', metricValue);
//Profit:
var metricValue = '55';
ga('set', 'metric2', metricValue);
ga('ecommerce:addItem', {
'id': '1078163',
'name': 'F-91W',
'sku': 'F-91W',
'category': 'Casio Watches',
'price': '138',
'quantity': '1'
}); ga('ecommerce:addItem', {
'id': '1078163',
'name': 'Fragt2-FI',
'sku': 'Fragt2-FI',
'Category': 'Fragt',
'price': '0',
'quantity': '1'
});
ga('ecommerce:send');
</script>
This implementation gives us the opportunity to see the profit for specific days/channels etc. But we have two concerns. First of all the data collected in our custom report are incorrect. Second, we would like to have the profit as a dimension in the standard ecommerce report. Any idea if this is possible?
这种实施使我们有机会看到特定日期/渠道等的利润。但我们有两个问题。首先,我们的自定义报告中收集的数据不正确。其次,我们希望将利润作为标准电子商务报告中的一个维度。知道这是否可行?
The custom metrics are set up with scope=hit, and formatting type=currency.
自定义指标设置为scope = hit,格式type = currency。
NB. we want the profit to show direcly in the code even though competitors could utilize this.
NB。我们希望利润在代码中直接显示,即使竞争对手可以利用这一点。
1 个解决方案
#1
- If you data in custom report is incorrect, make sense to give more details about this. As you said, that each transaction counted 3 times, then you should have higher revenue, count of products sold, ecommerce conversion rate, etc. that should be. To fix that you should fire your code above only one time for each transaction. For example, if user reloaded your thank you page, this code shouldn't fire again. Because GA counting transactions each time, when code was fired on page, even if transactions are duplicating.
- If you want to see profit for each transaction in standart Ecommerce report, then you may use "Secondary dimension" at this report. But before you should also send your profit as custom dimension(simple string, hit level) in addition to custom metric. But in fact you should be possible to use that now in custom report(if apply custom metric2 as column).
如果自定义报告中的数据不正确,请提供有关此内容的更多详细信息。正如你所说,每笔交易计算3次,那么你应该有更高的收入,销售的产品数量,电子商务转换率等等。要解决此问题,您应该为每个事务仅激活一次上面的代码。例如,如果用户重新加载了感谢页面,则此代码不应再次触发。因为GA每次计算事务,当代码在页面上触发时,即使事务是重复的。
如果您想在标准电子商务报告中查看每笔交易的利润,则可以在此报告中使用“辅助维度”。但除了自定义指标之外,您还应将利润作为自定义维度(简单字符串,命中级别)发送。但事实上,您现在应该可以在自定义报告中使用它(如果将自定义metric2作为列应用)。
#1
- If you data in custom report is incorrect, make sense to give more details about this. As you said, that each transaction counted 3 times, then you should have higher revenue, count of products sold, ecommerce conversion rate, etc. that should be. To fix that you should fire your code above only one time for each transaction. For example, if user reloaded your thank you page, this code shouldn't fire again. Because GA counting transactions each time, when code was fired on page, even if transactions are duplicating.
- If you want to see profit for each transaction in standart Ecommerce report, then you may use "Secondary dimension" at this report. But before you should also send your profit as custom dimension(simple string, hit level) in addition to custom metric. But in fact you should be possible to use that now in custom report(if apply custom metric2 as column).
如果自定义报告中的数据不正确,请提供有关此内容的更多详细信息。正如你所说,每笔交易计算3次,那么你应该有更高的收入,销售的产品数量,电子商务转换率等等。要解决此问题,您应该为每个事务仅激活一次上面的代码。例如,如果用户重新加载了感谢页面,则此代码不应再次触发。因为GA每次计算事务,当代码在页面上触发时,即使事务是重复的。
如果您想在标准电子商务报告中查看每笔交易的利润,则可以在此报告中使用“辅助维度”。但除了自定义指标之外,您还应将利润作为自定义维度(简单字符串,命中级别)发送。但事实上,您现在应该可以在自定义报告中使用它(如果将自定义metric2作为列应用)。