I have Google's standard ecommerce script implemented in the purchase page of a web site I admin. The standard script allows the revenue to be tracked, but it doesn't have a default data type to track the profit of each purchase.
I didn't know how to add a custom data type into the ecommerce script or how to handle its processing in Analytics, so I spent quite a while today and have learned a bit. However, I still have some questions...
My current ecommerce script is something like this (please note that I've left the value for each data type blank, just for demo purposes):
<script type="text/javascript">
ga('require', 'ecommerce');
ga('ecommerce:addTransaction', {
'id': '',
'affiliation': '',
'revenue': '',
'shipping': '',
'tax': ''
});
ga('ecommerce:addItem',
{
'id': '',
'name': '',
'sku': '',
'category': '',
'price': '',
'quantity': ''
});
ga('ecommerce:send');
</script>
I know that I should create a custom metric (since profit is an integer), but I'm not sure if the scope I select should be product-level or hit-level. I was thinking product-level because each product can have a different profit amount. Am I correct?
If yes, does that mean I should migrate over to the enhanced ecommerce code? (as I think that the product-level tracking is only supposed by the enhanced version, right?)
Does it even matter which scope type I select if each transaction only has a single product?
I have other questions, as far as how to implement the code for the metric in the tracking, and how to view the tracked data in Analytics (hopefully within one of the standard ecommerce views), but the questions about the scope and code version are the first steps to get this set up correctly.
Thanks!
You can't include custom metrics or dimensions with standard ecommerce, so you should switch to enhanced ecommerce, where you can include product-scoped metrics and dimensions quite easily.
Enhanced ecommerce offers much more flexibility in terms of the reports that are available (shopping behaviour, checkout behaviour, product list performances, sales, checkout funnel, etc.) and also gives you the ability to track custom data points through custom dimensions and custom metrics that wouldn't be available with standard tracking.