Analyses de la page de confirmation

Feature is now deprecated.

❗️

Deprecated

The Confirmation Analytics Feature is now deprecated.

Aperçu

Our Affirm.js library includes Confirmation Page Analytics. Confirmation Page Analytics offers insight into how customers interact with your site on the confirmation page. When a customer completes their purchase, you can send their order and product information to Affirm for tracking A/B testing, which will help you optimize your site and comprehensively measure the eCommerce lifecycle. You can send this information by adding the Confirmation Page function to your order confirmation page.

1. Ajouter Affirm.js

Avant d’ajouter la fonction Enhanced Analytics, vous devez ajouter le code Affirm.js incorporé à votre modèle de page globale ou dans l’en-tête global si vous ne l’avez pas déjà fait :

<!-- Affirm -->
<script>
 _affirm_config = {
   public_api_key:  "YOUR_PUBLIC_KEY",
   script:          "https://cdn1-sandbox.affirm.com/js/v2/affirm.js",
 };
 (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 https://cdn1.affirm.com/js/v2/affirm.js script to point to Affirm production environment.
</script>
<!-- End Affirm -->

2. Ajouter une fonction de page de confirmation

The trackOrderConfirmed event triggers when a customer completes their purchase. It measures the sale of one or more products. This function should be populated with order and products argument before adding it to the order confirmation page. All the values in the order and product arguments must be based on the order that was placed. We only require orderId, total, productId, and quantity for A/B testing.

Paramètres :

  • Object order - La commande
  • arrayproducts - Produits vendus au client

Retours :

  • null

Exemple

affirm.ui.ready(function(){
affirm.analytics.trackOrderConfirmed({
    "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"
}]);
});

Types de données

Objet de commande

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

Paramètre

Description

storeName Obligatoire

string
500 caractères maximum.

Le nom de votre boutique.

checkoutId
optional

string
500 caractères maximum.

Votre identifiant unique interne représentant le paiement s'il est distinct de l'identifiant de commande. S'ils sont identiques, seul l'Identifiant de commande est nécessaire.

coupon
optionnel

string
500 caractères maximum.

Le code promotionnel appliqué à la commande (par ex. SUMMER2018).

currency
optionnel

string

USD

discount
optionnel

integer

La réduction totale appliquée à la commande, indiquée en cents USD (par ex. 100 $ = 10000).

orderID\ required

string
500 caractères maximum.

Votre identifiant unique interne représentant la commande.

paymentMethod\ required

string
Maximum 150 caractères.

Le mode de paiement choisi par le client (par exemple, Visa)

revenue
optionnel

integer

Les frais d'expédition associés à la commande.

Expédition
optionnel

integer

Les frais d'expédition associés à la commande.

shippingMethod
optionnel

string
Maximum 150 caractères.

Le mode de livraison choisi par le client (par ex. FedEx).

taxes
optionnel

integer

Le montant total de la taxe associée à la commande, indiqué en cents Américains (par ex. 100 $ = 10000).

Total
optionnel

integer

Le montant total de la transaction, taxes et frais d'expédition compris, exprimé en cents américains (par ex. 100$ = 10 000). S'il n'est pas envoyé, le montant total sera calculé à l'aide des champs de quantité et de prix de chaque objet produit transmis.

Objet du produit
The product object defines the product offered by the merchant.

Paramètre

Description

marque optionnel

string
500 caractères maximum.

La marque du produit (par ex. Affirm).

Catégorie
optionnel

string
500 caractères maximum.

La catégorie de produit.

coupon
optionnel

string
500 caractères maximum.

Tout code promotionnel appliqué à ce produit particulier.

name
optionnel

string
500 caractères maximum.

Le nom complet du produit (par ex. le t-shirt Affirm).

Prix
optionnel

integer

Le prix du produit acheté, indiqué en cents Américains (par ex. 100 $ = 10000).

productID\ required

string
500 caractères maximum.

Votre identifiant interne unique représentant le produit, tel que le SKU ou un identifiant de base de données interne.

quantity
optionnel

integer

La quantité du produit acheté.

variante
optionnel

string
500 caractères maximum.

La variante du produit (par ex. noir).

currency
optionnel

string

Un code de devise associé à ce produit (USD)