Add a Product to the Shopping Cart

When a user adds a product to their shopping cart on your website, signifying their intent to purchase a specific item.

web_event.track("product", "add_to_cart", {
    items: [
        {
            type: "product",
            id: "{{product_sku}}",
            name: "{{product_name}}",
            sku: "{{product_sku}}",
            page_url: "{{product_page_url}}",
            image_url: "{{product_featured_image}}",
            price: "{{product_sale_price}}",
            original_price: "{{product_original_price}}",
            main_category: "{{product_main_category}}",
            variant: "{{product_variant_name}}",
            color: "{{product_color}}",
            size: "{{product_size}}",               
            parent_item_id: "{{product_parent_id}}",
            variant: "{{product_variant_name}}",
            status: "active",            
            is_parent: "false",
            quantity: "{{product_quantity}}",
            cdp_source: "Staging" // Staging/Production
        }
    ],
    dims: {
        customers: {
            customer_id: "{{customer_id}}",
            name: "{{customer_name}}",
            email: "{{customer_email}}",
            phone: "{{customer_phone}}",
            cdp_source: "Staging" // Staging/Production
        }
    },
    extra: {
        cart_subtotal: "{{cart_subtotal}}",
        cart_item_count: "{{cart_item_count}}"
    }
});

Last updated