AddPaymentInfo

From Barion Documentation
Revision as of 09:45, 23 May 2024 by [email protected] (talk | contribs) (created page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

addPaymentInfo

Required event. Handling this event on your Barion shop's screens is required as part of a Barion Full Pixel implementation.

Short description

The event tracks what payment method the customer selects for a payment on the checkout page.

The event is part of the purchase stage of the the e-commerce sales funnel.

Trigger

Clicking a button during the checkout process after the payment method has already been selected.

Properties

Custom properties are supported.

  • step
  • integer
  • The order that the visited page is displayed in within a multi-step checkout process, if applicable.
  • yes
  • Step numbering starts at 1.
Name Data type Description Required? Note
contents array An array of content objects if the page displays multiple items for sale. yes Don't include shipping or coupons.
paymentMethod string The payment method that the user selects. yes
contentType One of the following string options: "Page", "Product", "Article", "Promotion", "Banner", "Misc" The type of page that triggered the event. yes In case this is an item listing page, pass "Product". Otherwise, select the option that best matches the type of page. See the event's list property also.
coupon string The coupon code used when the user added the item to the cart. no
creative string The associated promotion's name or description, such as an advertising slogan or the name of the promotional image file. no
currency string (ISO 4217 currency code) The currency that the associated item's price is listed in. yes Required if "contentType": "Product"
customerValue float Your self-defined metric that represents the business value of the given customer (based on for example their average basket value). no
list string Select the function of the visited page from one of the following string options: "HomePage", "SearchPage", "ProductPage", "Recommendation", "ComparisonPage", "BasketPage", "Checkout", "Misc" no
opt string Additional information about the purchase. no
orderNumber string The unique identifier of the purchase. no
positioning string The item's position in a list or collection (e.g. 2) or the position of its promotion on the page (e.g. banner_slot_1). no
shipping float The shipping costs associated with the purchase, in the specified currency. no
shippingAddress An address object. The shipping address associated with the order. no
tax float The tax to be paid for the items in the order, in the currency specified. no

Barion Pixel throws the following errors in your browser console if a required property is missing or is passed in the wrong format:

"Barion Pixel: Format of PROP_NAME is invalid in EVENT_NAME"

"Barion Pixel: The PROP_NAME parameter of the EVENT_NAME event cannot be empty"

Sample implementation

var addPaymentInfoProperties = {
    'contents': [{
        'contentType': 'Product',
        'currency': 'HUF',
        'id': 'item_42',
        'name': "Hitchhikers' Guide to the Galaxy, hardcover, ISBN: 9780575115347",
        'quantity': 3.0,
        'totalItemPrice': 7500.0,
        'unit': 'pcs',
        'unitPrice': 2500.0,
        'brand': 'Gollancz',
        'category': 'books|hardcover|scifi, books|hardcover|comedy',
        'description': 'The Hitchhikers Guide to the Galaxy is a comedy science fiction series created by Douglas Adams.',
        'ean': '9780575115347',
        'imageUrl': 'https://images-na.ssl-images-amazon.com/images/I/51MzUz8rQcL._SX305_BO1,204,203,200_.jpg',
        'variant': 'hardcover'
        },
        {
        'contentType': 'Product',
        'currency': 'USD',
        'id': 'item_42en',
        'name': "Hitchhikers' Guide to the Galaxy, hardcover, ISBN: 9780575115347",
        'quantity': 3.0,
        'totalItemPrice': 25935,
        'unit': 'pcs',
        'unitPrice': 8645,
        'brand': 'Gollancz',
        'category': 'books|hardcover|scifi, books|hardcover|comedy',
        'description': 'The Hitchhikers Guide to the Galaxy is a comedy science fiction series created by Douglas Adams.',
        'ean': '9780575115347',
        'imageUrl': 'https://images-na.ssl-images-amazon.com/images/I/51MzUz8rQcL._SX305_BO1,204,203,200_.jpg',
        'variant': 'hardcover'
        }],
    'paymentMethod': 'Barion',
    'step': 1,
    'contentType': 'Product',
    'coupon': '43763436874',
    'creative': 'preselected_cart_01',
    'currency': 'HUF',
    'customerValue': 150.0,
    'list': 'Checkout',
    'opt': 'To postal office, no street address',
    'orderNumber': '852',
    'positioning': '1',
    'revenue': 17500.0,
    'shipping': 2500.0,
    'shippingAddress': {
        'city': 'Budapest',
        'country': 'HU',
        'deliveryMethod': 'DHL',
        'fullName': 'John Doe',
        'phone': '+36 1 1111 111',
        'region': 'HU-BU',
        'street': 'Műegyetem rkpt. 3.',
        'street2': '2. porta',
        'zipCode': '1111'
    },
    'tax': 0.0
}
// Use one of these to add the event listener to the button click (use only one):
// vanilla JS (if you don't use jQuery)
document.getElementById('checkout_next').addEventListener('click', function() {
    bp('track', 'addPaymentInfo', addPaymentInfoProperties);
});
// jQuery
$("#checkout_next").click(function() {
    bp('track', 'addPaymentInfo', addPaymentInfoProperties);
});