Google documentation isn't great for ecommerce refunds. There's a lot of trial and error in figuring out exactly how refunds work and the limitations they have.
This package essentially automates the refund as specified in the GA event builder
There is just 1 function at present, simple_refundR_fun
.
This function will add a financial credit against the entire transaction amount.
This credit will appear against the specified transaction id, but will appear time-wise in the present. This is an important consideration as the refund may appear in a different reporting window from when the transaction was first recorded. Events can only be backdated 3 calendar days.
api.secret
generated within the GA4 web consolemeasurement.id
the GA4 measurement ID for the property recording ecommerce transactionsclient.id
GA client_id - you can find your GA client id in this articlet.order.id
the id of the order you want to refundt.value
the previously recorded transaction value but expressed as a negative numeric value eg. -29.99t.currency
the ISO currency the transaction was in eg. "USD"
The httr
package. Run install.packages("httr")
to install or follow the prompts in RStudio if / when asked.
- Wrap into an R package - near-term
- Add support for products - long-term