Skip to main content

Merchant Help


Affirm Merchant Help

Confirmation Page function

Before adding Enhanced Analytics functions, you need to add the Affirm.js embed code to your global page template if you haven't already done so.

<!-- Affirm -->
 _affirm_config = {
   public_api_key:  "YOUR_PUBLIC_KEY",
   script:          "",
   session_id:      "YOUR_VISITOR_SESSION_ID"
 (function(l,g,m,e,a,f,b){var d,c=l[m]||{},h=document.createElement(f),n=document.getElementsByTagName(f)[0],k=function(a,b,c){return function(){a[b]._.push([c,arguments])}};c[e]=k(c,e,"set");d=c[e];c[a]={};c[a]._=[];d._=[];c[a][b]=k(c,a,b);a=0;for(b="set add save post open empty reset on off trigger ready setProduct".split(" ");a<b.length;a++)d[b[a]]=k(c,e,b[a]);a=0;for(b=["get","token","url","items"];a<b.length;a++)d[b[a]]=function(){};h.async=!0;h.src=g[f];n.parentNode.insertBefore(h,n);delete g[f];d(g);l[m]=c})(window,_affirm_config,"affirm","checkout","ui","script","ready");
// Use your live public API Key and script to point to Affirm production environment.
<!-- End Affirm -->

The trackOrderConfirmed event triggers when a customer completes their purchase. It measures the sale of one or more products.


  • order (object) - The order
  • products (array) - Products sold to the customer


  • null


    "storeName": "Affirm Store",
    "coupon": "SUMMER2018",
    "currency": "USD",
    "discount": 0,
    "paymentMethod": "Visa",
    "revenue": 2920,
    "shipping": 534,
    "shippingMethod": "Fedex",
    "tax": 285,
    "orderId": "T12345",
    "total": 3739
}, [{
    "brand": "Affirm",
    "category": "Apparel",
    "coupon": "SUMMER2018",
    "name": "Affirm T-Shirt",
    "price": 730,
    "productId": "SKU-1234",
    "quantity": 1,
    "variant": "Black"
}, {
    "brand": "Affirm",
    "category": "Apparel",
    "coupon": "SUMMER2018",
    "name": "Affirm Turtleneck Sweater",
    "price": 2190,
    "productId": "SKU-5678",
    "quantity": 1,
    "variant": "Black"

Data types

Order object

The Order object defines the customer's order when they begin the checkout process. It also includes transaction information when the customer completes checkout.

Parameter Type Description
storeName string Your store name. Maximum 500 characters. Required
checkoutId string Your internal unique identifier representing the checkout if it’s distinct from the order ID. If they are the same, only orderID is needed. Maximum 500 characters. Optional
coupon string The coupon code applied to the order (e.g., SUMMER2018). Maximum 500 characters. Optional
currency string USD Optional
discount integer The total discount applied to the order, stated in USD cents (e.g., $100 = 10000). Optional
orderId string Your internal unique identifier representing the order. Maximum 500 characters. Required
paymentMethod string The payment method chosen by the customer (e.g., Visa). Maximum 150 characters. Optional
revenue integer The net revenue amount of the order excluding shipping, total tax and discounts, stated in USD cents (e.g., $100 = 10000). Optional
shipping integer The shipping cost associated with the order. Optional
shippingMethod string The shipping method chosen by the customer (e.g., Fedex). Maximum 150 characters. Optional
tax integer The total tax amount associated with the order, stated in USD cents (e.g., $100 = 10000). Optional
total integer The total amount of the transaction including tax and shipping, stated in USD cents (e.g., $100 = 10000). If not sent, the total amount will be calculated using the product quantity and price fields of each product object passed. Optional

Product object

The Product object defines the product offered by the merchant.

Parameter Type Description
brand string The brand of the product (e.g., Affirm). Maximum 500 characters. Optional
category string The product category (e.g., apparel). Maximum 500 characters. Optional
coupon string Any coupon code applied to this particular product. Maximum 500 characters. Optional
name string The full name of the product (e.g., Affirm T-Shirt). Maximum 500 characters. Optional
price integer The price of the purchased product, stated in USD cents (e.g., $100 = 10000). Optional
productId string Your unique internal identifier representing the product, such as the SKU or an internal database identifier. Maximum 500 characters. Required
quantity integer The quantity of the purchased product. Optional
variant string The variant of the product (e.g. black). Maximum 500 characters. Optional