purchase Event
The purchase
event is the final step in the ecommerce funnel. It records successful transactions, including order details, customer information, and itemized product data. This event is vital for conversion tracking, revenue reporting, and campaign attribution.
The purchase model
This model captures complete purchase data for analytics and advertising platforms.
Properties
- Name
event
- Type
- string
- Description
Must be set to
purchase
.
- Name
transaction_id
- Type
- string
- Description
Unique identifier for the purchase/order.
- Name
user_id
- Type
- string
- Description
ID of the user who completed the purchase.
- Name
session_id
- Type
- string
- Description
Session ID for attribution.
- Name
ecommerce.currency
- Type
- string
- Description
Currency of the transaction (ISO 4217).
- Name
ecommerce.value
- Type
- float
- Description
Total transaction value (including tax and shipping).
- Name
ecommerce.tax
- Type
- float
- Description
Tax amount included in the transaction.
- Name
ecommerce.shipping
- Type
- float
- Description
Shipping amount charged.
- Name
ecommerce.coupon
- Type
- string
- Description
Optional — applied coupon code.
- Name
ecommerce.items
- Type
- array
- Description
Array of purchased item objects.
- Name
ecommerce.items[].item_id
- Type
- string
- Description
Product or SKU ID.
- Name
ecommerce.items[].item_name
- Type
- string
- Description
Product name.
- Name
ecommerce.items[].item_brand
- Type
- string
- Description
Brand name.
- Name
ecommerce.items[].item_category
- Type
- string
- Description
Product category.
- Name
ecommerce.items[].item_variant
- Type
- string
- Description
Variant (e.g., size, color).
- Name
ecommerce.items[].price
- Type
- float
- Description
Price per unit.
- Name
ecommerce.items[].quantity
- Type
- int
- Description
Quantity purchased.
Push event to the dataLayer
dataLayer.push example
dataLayer.push({
event: 'purchase',
transaction_id: 'ORDER-20250401-XYZ',
user_id: 'user-2024',
session_id: 'session-abc999',
ecommerce: {
currency: 'USD',
value: 158.97,
tax: 10.50,
shipping: 5.00,
coupon: 'SPRING20',
items: [
{
item_id: 'SKU-555',
item_name: 'Bluetooth Speaker',
item_brand: 'SoundBlast',
item_category: 'Audio',
item_variant: 'Black',
price: 79.99,
quantity: 2
}
]
}
});
Best Practices
- Always include a unique
transaction_id
. - Use consistent item structure from
add_to_cart
andview_item
. - Track
coupon
usage to measure promotions and ROI.
Use Cases
The purchase
event supports:
- Conversion tracking and revenue analysis
- Ad platform optimization (GA4, Meta, TikTok)
- Attribution modeling and ROAS reporting
- LTV and cohort performance analysis