Purchase Product(s)

When users successfully complete a purchase of one or more products on your website, marking a conversion point in the user journey and indicating a successful transaction.

web_event.track("product", "purchase", {
    items: [
        {
            type: "product",            
            id: "{{product_sku}}",
            name: "{{product_name}}",
            sale_price: "{{product_sale_price}}",
            quantity: "{{product_quantity}}",
            line_item_quantity: "{{product_quantity}}",
            line_item_unit_price: "{{product_sale_price}}",
            line_item_discount_amount: "{{product_discount_amount}}",
            line_item_rounded_amount: "{{product_sale_price}}" - "{{product_discount_amount}}"
            line_item_promotion_code: "{{line_item_promotion_code}}"
        }
    ],
    dims: {
        customers: {
            customer_id: "{{customer_id}}",
            name: "{{customer_name}}",
            email: "{{customer_email}}",
            phone: "{{customer_phone}}",
            first_name: "{{customer_first_name}}",
            last_name: "{{customer_last_name}}",
            company: "{{customer_company}}",
            address_1: "{{customer_address_1}}",
            address_2: "{{customer_address_2}}",
            city: "{{customer_city}}",
            province: "{{customer_province}}",
            country: "{{customer_country}}",
            zip: "{{customer_zip}}",
            cdp_source: "Staging" // Staging/Production
        },
        purchase: {
            id: "{{order_id}}",
            name: "{{order_name}}",
            date_created: "{{order_date}}",
            subtotal_amount: "{{subtotal_amount}}",
            discount_amount: "{{discount_amount}}",
            shipping_amount: "{{shipping_amount}}",
            tax_amount: "{{tax_amount}}",
            total_amount: "{{revenue}}",
            revenue: "{{revenue}}",
            promotion_code: "{{promotion_code}}",
            customer_id: "{{customer_id}}",
            customer_name: "{{customer_name}}",
            customer_email: "{{customer_email}}",
            customer_phone: "{{customer_phone}}",
            billing_name: "{{billing_name}}",
            billing_address: "{{billing_address}}",
            billing_phone: "{{billing_phone}}",            
            shipping_name: "{{shipping_name}}",
            shipping_address: "{{shipping_address}}",
            shipping_phone: "{{shipping_phone}}",            
            shipping_method: "{{shipping_method}}",
            payment_method: "{{payment_method}}",            
            source: "Website",           
            cdp_source: "Staging" // Staging/Production
        }
    },
    extra: {
        order_id: "{{order_id}}",
        revenue: "{{revenue}}"
    }
});

Last updated