Analyses de la page de confirmation
Feature is now deprecated.
DeprecatedThe 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 - array
products- 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 | Le nom de votre boutique. |
checkoutId | string | 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 | string | Le code promotionnel appliqué à la commande (par ex. SUMMER2018). |
currency | string | USD |
discount | integer | La réduction totale appliquée à la commande, indiquée en cents USD (par ex. 100 $ = 10000). |
orderID\ required | string | Votre identifiant unique interne représentant la commande. |
paymentMethod\ required | string | Le mode de paiement choisi par le client (par exemple, Visa) |
revenue | integer | Les frais d'expédition associés à la commande. |
Expédition | integer | Les frais d'expédition associés à la commande. |
shippingMethod | string | Le mode de livraison choisi par le client (par ex. FedEx). |
taxes | integer | Le montant total de la taxe associée à la commande, indiqué en cents Américains (par ex. 100 $ = 10000). |
Total | 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 | La marque du produit (par ex. Affirm). |
Catégorie | string | La catégorie de produit. |
coupon | string | Tout code promotionnel appliqué à ce produit particulier. |
name | string | Le nom complet du produit (par ex. le t-shirt Affirm). |
Prix | integer | Le prix du produit acheté, indiqué en cents Américains (par ex. 100 $ = 10000). |
productID\ required | string | Votre identifiant interne unique représentant le produit, tel que le SKU ou un identifiant de base de données interne. |
quantity | integer | La quantité du produit acheté. |
variante | string | La variante du produit (par ex. noir). |
currency | string | Un code de devise associé à ce produit (USD) |
Mis à jour about 2 months ago