impress-org/give-google-analytics

fix: associate a value/revenue amount on refunded donations

Closed this issue · 3 comments

Bug Report

User Story

As a site admin, I want refunded donations to reflect a negative revenue amount so that my revenue amounts are accurate.

Current Behavior

Currently the revenue amount remains the same even after a refund. The refund beacon is sent, and received, but nothing to do with revenue is stored.

Expected Behavior

I expect (for example that if I refund $20 that the reports would show a -20 next to the revenue for that day.

Bug Type

  • I am not sure whether this functionality ever worked as expected.

Steps to Reproduce

  1. Refund a donation
  2. Check the donation notes to confirm the refund beacon was sent.
  3. Check Google analytics and see the refund shows up as an event
  4. Check the revenue and see that it is unaffected by the event.

Possible Solution

In the array here:

$args = array(
'v' => 1,
'tid' => $ua_code, // Tracking ID required.
'cid' => ! empty( $client_id ) ? $client_id : give_analytics_gen_uuid(), // Client ID. Required (Set random if does not find client id ).
't' => 'event', // Event hit type.
'ec' => 'Fundraising', // Event Category. Required.
'ea' => 'Donation Refund', // Event Action. Required.
'ti' => $donation_id, // Transaction ID.
'pa' => 'refund',
'ni' => '1',
);

Pass a tr parameter (per https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#tr )

Not sure if that number needs to be positive or negative.

Related

https://secure.helpscout.net/conversation/909253693/43843?folderId=848135

Acceptance Criteria

  • Refunds are associated with a negative revenue event in GA
  • If there is a reason for why this is not possible, or there's a better way, the Support team understands how to communicate that to customers

@Benunc Has there been any forward momentum here? The customer has followed up asking for an update

@Benunc I research on this and found that refund does not directly remove from revenue.
https://babbagesystems.com/2015/01/06/refunds-in-google-analytics/

I think we have to do Refund data import to reduce the amount from revenue. since my account does not have permission, so I can not test this functionality.
https://support.google.com/analytics/answer/6066862?hl=en
https://support.google.com/analytics/topic/6064627
https://support.google.com/analytics/answer/6014861?hl=en&ref_topic=6231190

cc: @DevinWalker

@Benunc @ravinderk and myself discussed this on Slack and the issue isn't with our code, it's with:

  1. Understanding of how GA works on our team
  2. Educating our team and providing text to send to customers who don't understand
  3. Writing of the documentation to educate customers on how it works. The blog post above is a great reference point.

Here's the Doc on that: https://app.asana.com/0/1143212002851345/1156274118675737