Analytics
2K members online now
2K members online now
Learn how to set up goals and Ecommerce tracking, verify accuracy of attribution traffic sources, and discuss funnel visualization, Multi-Channel Funnels, the Goal Flow Report, and Enhanced Ecommerce
 
Guide Me
star_border
Reply

Revenue in sales performance report a multiply of product revenue

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi,

 

I'm having trouble understanding what goes wrong in our mobile app's enhanced eCommerce implementation. Often, but not always, the reported revenue is a multiply of product revenue.

 

For example, this is what I get in the sales report listing:

Screen Shot 2017-03-30 at 15.06.41.pngThe sales report listing

When I open the listing for item #3 with a revenue of €67.20, it shows (correctly, verified with user explorer), the real order, which has only 5 products instead of 15 with a sum of €22.40.

Screen Shot 2017-03-30 at 15.02.38.pngItem #3 from listing opened

This is the details for item #4 in the listing. Here the revenue and quantity is doubled in the listing compared to the correct figures (8 vs 16 and €32.90 vs €65.80)

Screen Shot 2017-03-30 at 15.00.24.pngItem #4 from listing opened

1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Juha R
July

Re: Revenue in sales performance report a multiply of product revenue

[ Edited ]
Follower ✭ ✭ ☆
# 2
Follower ✭ ✭ ☆

I observed the same strange behaviour and it was driving me mad.

 

I did have a transaction that comes in correct with its values under sales performace:

  • transaction ID
  • revenue
  • quantity of each product

But when I looked under product performance those products' revenue is the total of the real revenue multiplied with the quantity. So I did have correct totals of the transactions but as soon as I looked into them in detail I get way too high values.

 

What I actually did (and I fixed it while writing this reply as another cry for help) was recalculating my prices per piece right before it was pushed to the dataLayer. Forgive me if my code looks rubbish, but my IT guy is on a long vacation and I had to come up with it in some way:

 

function prepareCheckout() {
  var products = [];
  for (var i=0; i < {{cart}}.products.length; i++) {
    var product = {{cart}}.products[i];
    var prodtotal = {{cart}}.products[i].amount.net.replace(",",".");
    var prodquantity = {{cart}}.products[i].quantity;
    var priceperpiece = singleprice(prodtotal, prodquantity);
    function singleprice(prodtotal,prodquantity) {
      return Number(prodtotal) / Number(prodquantity);
    }
  	products.push({
      'name': product.name,       // Name or ID is required.
      'id': product.ordernumber,
      'price': ''+priceperpiece,
      //'brand': product.supplier,
      'category': '',
      'variant': '',
      'quantity': Number(product.quantity)
    });
  }
  
  dataLayer.push({
    'event': 'checkout',
    'ecommerce': {
      'checkout': {
        'actionField': {'step': {{page.action}}, 'option': ''},
        'products': products
      }
    }
  });
}

While this piece of code does the job now:

    var prodtotal = {{cart}}.products[i].amount.net.replace(",",".");
    var prodquantity = {{cart}}.products[i].quantity;
    var priceperpiece = singleprice(prodtotal, prodquantity);
    function singleprice(prodtotal,prodquantity) {
      return Number(prodtotal) / Number(prodquantity);
    }

All I in the end did was dividing the product's total by its quantity (sounds logical, doesn't it?) and now I finally seem to get proper total revenues for the transactions and correct single prices per product in this transaction.

 

The Chrome plugin "Analytics Pros dataLayer Inspector+" was a huge help along with the GTM preview mode.

 

Hope it helps somebody and feel free to make my stuff look nicer, I won't touch my running system now Smiley LOL

 

Note: The code was taken from the checkout confirmation, of course I packed it inside the purchase part too.

View solution in original post

Marked as Best Answer.
Solution
Accepted by topic author Juha R
July

Re: Revenue in sales performance report a multiply of product revenue

[ Edited ]
Follower ✭ ✭ ☆
# 2
Follower ✭ ✭ ☆

I observed the same strange behaviour and it was driving me mad.

 

I did have a transaction that comes in correct with its values under sales performace:

  • transaction ID
  • revenue
  • quantity of each product

But when I looked under product performance those products' revenue is the total of the real revenue multiplied with the quantity. So I did have correct totals of the transactions but as soon as I looked into them in detail I get way too high values.

 

What I actually did (and I fixed it while writing this reply as another cry for help) was recalculating my prices per piece right before it was pushed to the dataLayer. Forgive me if my code looks rubbish, but my IT guy is on a long vacation and I had to come up with it in some way:

 

function prepareCheckout() {
  var products = [];
  for (var i=0; i < {{cart}}.products.length; i++) {
    var product = {{cart}}.products[i];
    var prodtotal = {{cart}}.products[i].amount.net.replace(",",".");
    var prodquantity = {{cart}}.products[i].quantity;
    var priceperpiece = singleprice(prodtotal, prodquantity);
    function singleprice(prodtotal,prodquantity) {
      return Number(prodtotal) / Number(prodquantity);
    }
  	products.push({
      'name': product.name,       // Name or ID is required.
      'id': product.ordernumber,
      'price': ''+priceperpiece,
      //'brand': product.supplier,
      'category': '',
      'variant': '',
      'quantity': Number(product.quantity)
    });
  }
  
  dataLayer.push({
    'event': 'checkout',
    'ecommerce': {
      'checkout': {
        'actionField': {'step': {{page.action}}, 'option': ''},
        'products': products
      }
    }
  });
}

While this piece of code does the job now:

    var prodtotal = {{cart}}.products[i].amount.net.replace(",",".");
    var prodquantity = {{cart}}.products[i].quantity;
    var priceperpiece = singleprice(prodtotal, prodquantity);
    function singleprice(prodtotal,prodquantity) {
      return Number(prodtotal) / Number(prodquantity);
    }

All I in the end did was dividing the product's total by its quantity (sounds logical, doesn't it?) and now I finally seem to get proper total revenues for the transactions and correct single prices per product in this transaction.

 

The Chrome plugin "Analytics Pros dataLayer Inspector+" was a huge help along with the GTM preview mode.

 

Hope it helps somebody and feel free to make my stuff look nicer, I won't touch my running system now Smiley LOL

 

Note: The code was taken from the checkout confirmation, of course I packed it inside the purchase part too.