I'm looking to reverse cancelled orders from GA4 to get analytics more or less tallying with the cart numbers. I'm already using the cart's API to identify cancelled orders which presents a seemingly straightforward task of how to use the GA4 API to 'refund' those orders.
The problem is the orders still show in the e-commerce reports. I'm expecting the transactions to not show.
I've used the event builder here:
... which allows you to validate and generate an event and copy the payload.
All good so far - I've even created a function in R to construct the
POST call for each order to be refunded.
When it's run the
refund event appears in GA4 realtime reports with the parameters present.
However, the transaction still appears in the reports.
From a GA3 reference here:
... it seems as if the POST payload doesn't require all of the transaction parameters. The parameters I've included are:
- transaction_id (eg. 45678)
- timestamp_micros (eg. 1677969832400844)
- value (eg. -40000.15)
- currency (eg. USD)
My questions are:
- Do refunds actually disappear from e-commerce transaction reports? Documentation says they should for GA3.
- Have I missed something major that's preventing the reversal / refund from happening?
- Should the refund amount have a minus sign? I've seen conflicting information on this online.
- Should the transaction be prefixed with "T_"? Eg. order transaction ID 45678 would be sent in the payload as "T_45678". The reason I ask this is because in the Google examples and the helper text in the builder field, this is the format shown, but not explicitly mentioned.