Skip to content

tracker.trackRefund()

Fires a GA4 refund event. Always GA4-only — conversionLabels.refund does not exist; Ads refund adjustments use a different API endpoint (uploadConversionAdjustments) that the SDK does not implement in v1.

tracker.trackRefund(input: BrowserRefundInput): Promise<void>;
type BrowserRefundInput = {
transactionId: string;
value?: number;
currency?: string;
items?: TrackbridgeItem[];
affiliation?: string;
coupon?: string;
shipping?: number;
tax?: number;
userData?: UserData;
};
FieldRequiredNotes
transactionIdyesMust match the original trackPurchase transactionId so GA4 ties the refund to the right purchase.
valuenoRefund amount in currency. Omit for full refunds (GA4 infers from transactionId).
currencynoISO 4217. Required by GA4 when value is set.
itemsnoTrackbridgeItem[] for partial refunds — pass the items being refunded.
affiliation, coupon, shipping, taxnoForwarded as GA4 params.
userDatanoHashed per enhanced conversions when supplied.

Promise<void>.

Throws synchronously if transactionId is missing or empty.

'use client';
import { tracker } from '@/lib/tracker.client';
await tracker.trackRefund({
transactionId: order.id,
value: refundAmount,
currency: order.currency,
items: refundedLines.map((line) => ({
itemId: line.sku,
quantity: line.quantity,
})),
});

Browser-side refunds are uncommon in practice — refunds usually originate from an admin panel or a payment-provider webhook. The server-side serverTracker.trackRefund() is the more common call site.