Developer Guide
API GuideDeveloper Guide
  • Overview
    • Getting Started
    • Customers and Visitors
    • Events and Business Objects (BOs)
      • Sample Event Templates
  • Website
    • Getting Started
      • Direct JS Implementation
      • JS Integration via GTM
      • Tracking Haravan website events
    • Tracking Users
    • Tracking Events
      • [Direct] Sample E-Commerce Events
        • View Product
        • Add a Product to the Shopping Cart
        • View the Shopping Cart
        • Remove a Product from the Shopping Cart
        • Search for Product(s)
        • Checkout Shopping Cart
        • Apply Promotion Code
        • Purchase Product(s)
      • [GTM] Sample E-Commerce Events
        • View Product
        • Add a Product to the Shopping Cart
        • View the Shopping Cart
        • Remove a Product from the Shopping Cart
        • Search for Product(s)
        • Checkout Shopping Cart
        • Apply Promotion Code
        • Purchase Product(s)
    • Web Push
  • Android
    • Getting Started
    • Tracking Users
    • Tracking Events
    • Push Messaging
    • App Inbox Messaging
  • iOS
    • Getting Started
      • Integration of Antsomi iOS SDK
    • Tracking Users
    • Tracking Events
    • Push Messaging
  • Hybrid Apps
    • React Native
      • Tracking Users
      • Tracking Events
        • Sample E-Commerce Events
          • View Product
          • Add a Product to the Shopping Cart
          • View the Shopping Cart
          • Remove a Product from the Shopping Cart
          • Search for Product(s)
          • Checkout Shopping Cart
          • Apply Promotion Code
          • Purchase Product(s)
      • Push Messaging
      • App Inbox Messaging
    • Flutter
      • Tracking Users
      • Tracking Events
        • Sample E-Commerce Events
          • View Product
          • Add a Product to the Shopping Cart
          • View the Shopping Cart
          • Remove a Product from the Shopping Cart
          • Search for Product(s)
          • Checkout Shopping Cart
          • Purchase Product(s)
      • Push Messaging
      • App Inbox Messaging
      • App In-line Content
  • Antsomi Service Integrations
    • Media Template
    • Media JSON
      • Sample E-Commerce Events
        • Search for Product(s)
        • View Product
        • Add a Product to the Shopping Cart
        • Checkout Shopping Cart
        • Purchase Product(s)
      • Sample User Events
        • Sign-in
        • Sign-up
      • Sample Opt-in Events
        • Subscribe to Email marketing
        • Subscribe to OneSignal channel
  • 3rd Party Integrations
    • Shopify
      • Tracking Shopify website events
    • LINE
      • Integrating LINE Login with your web app
    • Google Ad Manager
      • Targeting CDP365 segment via PPID(s)
Powered by GitBook
On this page
  1. Website
  2. Tracking Events
  3. [Direct] Sample E-Commerce Events

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}}"
    }
});

PreviousApply Promotion CodeNext[GTM] Sample E-Commerce Events

Last updated 1 year ago