4

I've resolved all issues with sending data, but receive issue when trying to refund.

I've sent this array to measurement protocol :

        'v' => '1',
        'tid' => $tid,
        'cid' => $cid,
        'ti' => '12345', // this transaction exist in google
        't' => 'event',
        'ec'=> 'Ecommerce',
        'ea'=> 'Refund',
        'ni'=> '1',
        'pa'=> 'refund'

But without any result. So my question is what's wrong? Maybe I need some additional call to measurement system, please advice. BTW Google hit debugger return 'valid'.

  • 2
    You are doing event tracking. This will (probably) register in the behaviour->events section but will not do refunds, you'd need to look into product actions for that (https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters?hl=en#pa) or do refunds batchwise via data uploads. – Eike Pierstorff Sep 03 '15 at 13:48
  • I also pass 'pa' parametr, as you can see above, but with no luck. Regarding manual data uploads, it's not acceptable for my project, as we need all script to work automated. –  Sep 03 '15 at 18:45
  • Yeah, looks like I'm having a slow day today - your code should work, especially since it's identical to the example from the documentation. Refunds only work if enhanced e-commerce tracking is enabled in the account (you probably know that, but since you did not mention it in your question I might as well point that out). – Eike Pierstorff Sep 03 '15 at 20:06
  • Yes, it's enabled, but still not work. That made me trouble as in Google Developers Docs, exactly the same example and it should work. –  Sep 04 '15 at 14:40
  • @TolyaDouble any success on this problem? I have the same issue – Constantine Oct 02 '15 at 09:49
  • @Constantine yep, I resolve this, will write in the topic, so you can check :) –  Oct 03 '15 at 11:31

2 Answers2

1

For full refund you need to send the following

'v'='1',
't'='pageview',
'tid'='UA-3333333-8', 
'cid'='382537459.1455511043',
'pa'='refund',
'ti'='000000038',
'dp'='admin/order/refund'

for partial refund you need to send

'v'='1',
't'='pageview',
'tid'='UA-3333333-8', 
'cid'='382537459.1455511043',
'pa'='refund',
'ti'='000000038',
'dp'='admin/order/refund',
'pr1id' => '24-WB04',
'pr1qt' => 1

Hope it helps!

stevensagaar
  • 626
  • 4
  • 15
0

I've resolve it in this way :

I've sent new transaction with negative val

            'v' => '1',
            'tid' => $tid,
            'cid' => $cid,
            'ti' => $order,
            't' => 'transaction',
            'tr' => '-'.$order_total

Then send event with negative value

            'v' => '1',
            'tid' => $tid,
            'cid' => $cid,
            'ti' => $order,
            't' => 'item',
            'in' => $product['name'],
            'ip' => '-'.$order_total,
            'ic' => $products['sku'],
            'iq' => -1

And it works, transactions disappear from google reports, btw also want to note that I switch script to use GET ( https://www.google-analytics.com/collect?payload_data& ) instead of POST.

  • 1
    Thanks for your comment. I think what you did technically falls under "Reversing a transaction" (https://support.google.com/analytics/answer/1037443?hl=en) , not "Refunding" like the OP asked about. With your method, there is still no "Refund amount" displaying in Google Analytics, even if you have succeeded in setting the original transaction amount to $0.00. Do you have a fix for that? Would be much appreciated as I am having the same problem as OP. – m4rlo Nov 08 '16 at 20:02