Barion Pixel Events Reference
Overview
Section titled “Overview”The plugin supports two operating modes:
- Base Pixel (always active when Pixel ID is configured): Loads
bp.jsand firespageViewautomatically on every page. Used for fraud prevention. - Full Tracking (optional, toggle in admin): Adds e-commerce event tracking for marketing analytics and lower Barion commission rates.
Event summary
Section titled “Event summary”| Event | Mode | bp() call | Trigger |
|---|---|---|---|
| pageView | Base | Automatic (bp.js) | Every page load |
| grantConsent | Base | bp('consent', 'grantConsent') |
Cookie consent accepted |
| rejectConsent | Base | bp('consent', 'rejectConsent') |
Cookie consent rejected |
| contentView | Full | bp('track', 'contentView', data) |
Single product page |
| addToCart | Full | bp('track', 'addToCart', data) |
Add to cart action |
| initiateCheckout | Full | bp('track', 'initiateCheckout', data) |
Checkout page load |
| purchase | Full | bp('track', 'purchase', data) |
Thank-you page |
| setEncryptedEmail | Full | bp('identify', 'setEncryptedEmail', email) |
Thank-you page |
Base Pixel events
Section titled “Base Pixel events”pageView
Section titled “pageView”Fires automatically when bp.js loads. No configuration needed beyond setting the Pixel ID.
grantConsent
Section titled “grantConsent”Fires when the user accepts marketing cookies. Handled automatically via WP Consent API or Cookie Law Info, or manually via window.wcBarionGrantConsent().
rejectConsent
Section titled “rejectConsent”Fires when the user rejects marketing cookies. Handled automatically via WP Consent API or Cookie Law Info, or manually via window.wcBarionRejectConsent(). Both grantConsent and rejectConsent are mandatory per Barion’s requirements.
See Cookie Consent Integration for details.
Full Tracking events
Section titled “Full Tracking events”contentView
Section titled “contentView”Trigger: Single product page (woocommerce_after_single_product hook)
Fields sent:
| Field | Type | Value |
|---|---|---|
| contentType | string | 'Product' |
| currency | string | WooCommerce store currency (e.g. 'HUF') |
| id | string | Product ID |
| name | string | Product display name |
| quantity | int | 1 (always — viewing one product) |
| unit | string | 'pcs' |
| unitPrice | float | Product price |
Note: The Barion API reference lists
totalItemPriceas required for this event, but bp.js rejects it at runtime with “Invalid key totalItemPrice in contentView event.” This field is intentionally omitted.
addToCart
Section titled “addToCart”Trigger: Client-side JavaScript (fires immediately on add-to-cart action)
Implementation: Two paths, both handled client-side to work with page caching:
-
AJAX add to cart (shop/archive pages): Listens for WooCommerce jQuery
added_to_cartevent. Reads product data from the<button>data attributes (data-product_id,data-product_name,data-product_price,data-quantity). -
Single product page form submit: Intercepts
form.cartsubmit. Product data is embedded as JSON in the footer. For variable products, reads the selected variation’sdisplay_pricefrom WooCommerce’s jQueryproduct_variationsdata.
Fields sent:
| Field | Type | Value |
|---|---|---|
| contentType | string | 'Product' |
| currency | string | Store currency |
| id | string | Product ID |
| name | string | Product name |
| quantity | int | Quantity added |
| unit | string | 'pcs' |
| unitPrice | float | Price per unit |
| totalItemPrice | float | unitPrice * quantity |
| step | int | 1 |
initiateCheckout
Section titled “initiateCheckout”Trigger: Checkout page load (woocommerce_before_checkout_form hook)
Fields sent:
| Field | Type | Value |
|---|---|---|
| contents | array | Array of cart items (see below) |
| currency | string | Store currency |
| revenue | float | Cart subtotal + tax (shipping excluded — may not be calculated yet) |
| step | int | 1 |
Contents item fields:
| Field | Type | Value |
|---|---|---|
| contentType | string | 'Product' |
| currency | string | Store currency |
| id | string | Product ID |
| name | string | Product name |
| quantity | int | Item quantity |
| unit | string | 'pcs' |
| unitPrice | float | Unit price |
| totalItemPrice | float | unitPrice * quantity |
purchase
Section titled “purchase”Trigger: Thank-you page (woocommerce_thankyou hook)
Duplicate prevention: Uses _wc_barion_tracked post meta to prevent firing on page reload.
Fields sent:
| Field | Type | Value |
|---|---|---|
| contents | array | Array of order items (see below) |
| currency | string | Order currency |
| revenue | float | Order total (includes shipping, tax, discounts) |
| step | int | 1 |
Contents item fields:
| Field | Type | Value |
|---|---|---|
| contentType | string | 'Product' |
| currency | string | Order currency |
| id | string | Product ID |
| name | string | Item name |
| quantity | int | Item quantity |
| unit | string | 'pcs' |
| unitPrice | float | (item_total + item_tax) / quantity (reflects discounts) |
| totalItemPrice | float | unitPrice * quantity |
Note on revenue: The purchase event uses the full order total (including shipping), while initiateCheckout uses subtotal + tax only (shipping may not be calculated at checkout start).
setEncryptedEmail
Section titled “setEncryptedEmail”Trigger: Thank-you page (woocommerce_thankyou hook)
bp() call: bp('identify', 'setEncryptedEmail', email)
The billing email is lowercased before sending. Barion’s bp.js handles SHA1 hashing automatically — the plugin sends the plain email address, not a hash.
Only fires when the order has a billing email address.
Events NOT implemented
Section titled “Events NOT implemented”| Event | Reason |
|---|---|
customEvent |
Not needed for standard e-commerce tracking |
initiatePayment |
Barion docs say implement purchase OR initiatePayment — we use purchase |
setPhoneNumber |
Optional; phone number is not reliably available in all WooCommerce flows |
search |
Optional; not part of the mandatory event set |