Purchase
purchase
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 monitors the items that a user has already purchased to inform the choice of ads that are served to the user.
Trigger
A page load event after the payment process has completed, that confirms to the user that the purchase is completed. (Typically a "Successful payment" or "Thank you for your purchase" screen.)
Fire this event when you notify the user about the completion of their purchase, even if the payment was unsuccessful – see the step
property.
Properties
Custom properties are supported.
Name | Data type | Description | Required? | Note |
---|---|---|---|---|
contents | array | An array of content objects if the page displays multiple items for sale. | no | Don't include shipping or coupons. |
currency | string (ISO 4217 currency code) | The currency that the associated item's price is listed in. | yes | Required if "contentType": "Product"
|
revenue | float | The total revenue associated with the transaction in the specified currency. | yes | Includes costs such as shipping, tax, or discounts. |
step | integer | The order that the visited page is displayed in within a multi-step checkout process. | yes | This property value should be the maximum value that your checkout process uses. If the user's payment was unsuccessful, pass "step": -1
|
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 | |
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 purchaseProperties = {
'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'
}],
'currency': 'HUF',
'revenue': 17500.0,
'step': 7,
'contentType': 'Product',
'coupon': '43763436874',
'creative': 'preselected_cart_01',
'customerValue': 150.0,
'list': 'Checkout',
'opt': 'To postal office, no street address',
'orderNumber': '852',
'positioning': '1',
'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
}
bp('track', 'purchase', purchaseProperties);