Google Analytics | Exclude Shipping from Revenue

Serafeim
New Member
7 0 0

Hello does anyone know how can I Exclude Shipping from Revenue?

 

I found this piece of code but doesn't work

 

(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-xxxxxxxxx', 'auto');
ga('require', 'ecommerce');

ga('ecommerce:addTransaction', {
"id": {{order_name|handleize}}, // Transaction ID. Required.
"affiliation": 'store name', // Affiliation or store name.
"revenue": {{order.subtotal_price|money_without_currency}},
"coupon": "{{ line_item.quantity }}",
"tax": "{{ order.tax_price|money_without_currency }}",
"shipping": "{{ order.shipping_price|money_without_currency }}",
"currency": "{{shop.currency }}"
});
{% for line_item in line_items %}
{% assign list_position = forloop.index + 1 %}
{% assign product_category = '' %}
ga('ecommerce:addItem', {
"id": {{order_name|handleize}}, // Transaction ID. Required.
"sku": "{{ line_item.sku }}",
"name": "{{line_item.title}}",
"list_name": "Search Results",
"brand": "Brand Name",
"category": "{{ line_item.product.collections[0].title }}",
"variant": "{{line_item.variant}}",
"list_position": "1",
"quantity": "{{ line_item.quantity }}",
"currencyCode": "{{shop.currency }}",
"price": "{{ line_item.line_price | money_without_currency}}"
});
{% endfor %}
ga('ecommerce:send');

 

Replies 0 (0)