Using Afterpay analytics
Setting up Afterpay analytics collection
Afterpay analytics are collected as part of the AfterpayJS library. The Afterpay JavaScript library must be included in all pages where analytics metrics might be gathered.
To include the Afterpay JavaScript library in a page, add the following <script>
tag in the <head>
HTML section:
<script src="https://portal.afterpay.com/afterpay.js"</script>
Order confirmation analytics
Afterpay analytics records an order_confirmation
event each time a customer reaches an order confirmation screen. Each order confirmation event records whether Afterpay was used, as well as the order value, currency, merchant ID, and order ID.
Property | Type | Description |
---|---|---|
is_afterpay_used | boolean | If true, Afterpay was used to pay for this order. |
merchant_id | string | Afterpay merchant ID. |
order_amount | string | Value of the order that has been captured. |
order_currency | string | The currency of the order, using ISO 4217 currency codes. |
order_id | string (optional) | Optional field containing the merchant identifier of this order. |
If a USD 100 order was completed on your site using Afterpay with an Order Number of 11443 you would use the following attributes:
AfterPay.analyticsEvent('order_confirmation', {
is_afterpay_used: true,
merchant_id: '1123533532',
order_amount: '100',
order_currency: 'USD',
order_id: '11443'
});
Updated 10 months ago