Sub topic 8
Checkout events: begin_checkout, shipping, and payment
Assume you already understand GA4 events, JavaScript objects, and the items array. Checkout events describe progress after a shopper has added products to a cart. They help you measure where shoppers abandon checkout and which shipping or payment choices they use.
The checkout sequence
Send the recommended events in this order:
begin_checkoutwhen the shopper starts checkout.add_shipping_infowhen the shopper submits or confirms shipping details.add_payment_infowhen the shopper submits or confirms payment details.purchaseafter the order succeeds.
Each event should include the current cart in items. Include currency and value when the event represents a monetary cart value. The value should normally equal the sum of price * quantity for the items. Do not include tax or shipping in value; send those separately with the purchase event.
| Event | When to send it | Useful event parameters |
|---|---|---|
| `begin_checkout` | Checkout starts | `currency`, `value`, `coupon`, `items` |
| `add_shipping_info` | Shipping information is submitted | `shipping_tier`, `currency`, `value`, `coupon`, `items` |
| `add_payment_info` | Payment information is submitted | `payment_type`, `currency`, `value`, `coupon`, `items` |
Sending the events with gtag.js
The following example uses the same cart at each step. In production, build items from the shop's current cart rather than hard-coding it.
const checkoutData = {
currency: 'USD',
value: 49.98,
coupon: 'SUMMER_SALE',
items: [
{
item_id: 'SKU_1001',
item_name: 'Trail Running Shoe',
price: 24.99,
quantity: 2
}
]
};
gtag('event', 'begin_checkout', checkoutData);
gtag('event', 'add_shipping_info', {
...checkoutData,
shipping_tier: 'Express'
});
gtag('event', 'add_payment_info', {
...checkoutData,
payment_type: 'Credit Card'
});shipping_tier is the selected delivery option, such as Standard or Express. payment_type identifies the method, such as Credit Card, PayPal, or Gift Card. Use consistent labels so reports group the choices correctly.
Preventing inaccurate checkout data
Send each event once for the corresponding user action. A page refresh, back-button navigation, or repeated click should not create another checkout step. Use an application state check or a tag trigger that fires only after the relevant form succeeds.
Keep the item list synchronized. If the shopper removes a product or changes quantity, later checkout events must use the updated list. Do not send payment details, card numbers, or other personal data in event parameters.
Exercise
A shopper selects Express shipping but leaves before entering payment details. Which checkout event should be sent, and which parameter records the choice?
Show answer
Send addshippinginfo with shippingtier set to Express. Do not send addpayment_info or purchase.