Lesson 11 of 16
Refunds
① Connect your GTM container
Paste your container ID to load it into this page. It only ever runs here.
Advanced: use a specific environment
Revenue is only half the story, GA4 also wants the money that goes back out. The refund event mirrors purchase: it carries the same transaction_id so GA4 can match the refund to the original order and net it out of your reports.
A full refund just names the order and its value. A partial refund adds an items array listing exactly what came back. Both push the same event name, so one trigger and tag handle both.
Goal
Fire a GA4 refund tag on the refund event, reading the ecommerce object for full and partial refunds.
Build it in GTM
Know what the page pushes
Both buttons push{ event: "refund", ecommerce: { transaction_id, currency, value, ... } }. The full refund omitsitems; the partial refund includes the returneditems. GTM sees an event namedrefundeither way.Create the Custom Event trigger
Triggers → New → Custom Event, event namerefund. It must match the pushed string exactly, so one trigger covers both full and partial refunds.Fire a GA4 refund tag on it
Build a GA4 Event tag namedrefundthat reads theecommerceobject (maptransaction_id,valueand theitemsarray when present), and set the trigger above as its firing trigger. The course'sCustom HTML - Teststand-in with<script></script>is an accepted placeholder.
Debug in Tag Assistant
Copy this lesson's live URL and paste it into GTM Preview, that is the page Tag Assistant connects to. It has the clickable elements, so this page stays clean for reading.
- In your GTM, click Preview.
- Paste the live URL above and click Connect.
- Interact with the live page and watch your tag fire in Tag Assistant.
What you should expect to see
refund event appears in the left rail, and your GA4 refund tag shows under Tags Fired carrying the same transaction_id as the original order.Verify your container
Built it? Export your container, Admin → Export Container, choose your workspace, then drop the JSON here to check it against this lesson.
Drop your container .json here
or browse · checked in your browser, nothing is uploaded