TagSpy

purchase

Recommended

Log this event when one or more items are purchased. Use a unique transaction_id to help prevent duplicate purchase reporting. customer_type can identify new versus returning customers.

Platforms
web, app
When it fires
You send it when the action happens.
Official docs

Parameters (8)

ParameterTypeRequiredDescriptionExample
currencystringYes*Currency of the items associated with the event, in 3-letter ISO 4217 format. * If you set value then currency is required for revenue metrics to be computed accurately.USD
transaction_idstringYesThe unique identifier of a transaction. The transaction_id parameter helps you avoid getting duplicate events for a purchase.T_12345
valuenumberYes*The monetary value of the event. * value is required for meaningful reporting and to populate the purchasers predictive audience. * currency is required if you set value.12.21
customer_typestringNoWhether the conversion is from a new or returning customer. Use new or returning; omit when uncertain.new
couponstringNoThe coupon name/code associated with the event. Event-level and item-level coupon parameters are independent.SUMMER_FUN
shippingnumberNoShipping cost associated with a transaction.3.33
taxnumberNoTax cost associated with a transaction.1.11
itemsArray<Item>YesThe items for the event.-

Example

gtag.js
gtag('event', 'purchase', {
  currency: 'USD',
  transaction_id: 'T_12345',
  value: 12.21,
  items: [{ item_id: 'SKU_12345', item_name: 'Stan and Friends Tee', price: 9.99, quantity: 1 }],
  customer_type: 'new',
  coupon: 'SUMMER_FUN',
  shipping: 3.33,
  tax: 1.11,
});
GTM dataLayer
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
  event: 'purchase',
  currency: 'USD',
  transaction_id: 'T_12345',
  value: 12.21,
  items: [{ item_id: 'SKU_12345', item_name: 'Stan and Friends Tee', price: 9.99, quantity: 1 }],
  customer_type: 'new',
  coupon: 'SUMMER_FUN',
  shipping: 3.33,
  tax: 1.11,
});

Also see