
Event codes for e‑commerce
Before implementing the event codes, the pixel embed script should be added on every page of the website. Instruction
The expected data types for the parameters are outlined on the page:
Available events and required parameters
View ‑ all pages
Insert on: the homepage and all other subpages of the site. What it handles: general script to be included on the entire website, analytical event. Triggered on init.
<script>
wph('track', 'ViewContent', { content_name: 'View' });
</script>
ProductList ‑ product listing page
Insert on: category pages, product listings, product or service directories, homepage if product listing blocks are present (does not include recommendation widgets). What it handles: sends product lists for a given category, including their prices, names, and product IDs. Triggered on init.
<script>
wph('track', 'ViewContent', {
content_name: 'ProductList',
currency: 'CURRENCY', // e.g. 'PLN', 'EUR'
contents: [
{
id: 'PRODUCT_ID1', // type text e.g. 'SUP1234', '878-3939', 'abcd-xyz'
name: 'PRODUCT_NAME1', // e.g. 'Super blue dress'
category: 'PRODUCT_CATEGORY1', // e.g. 'Dress'
price: PRODUCT_PRICE1 // type number e.g. 19.45
},
{
id: 'PRODUCT_ID2',
name: 'PRODUCT_NAME2',
category: 'PRODUCT_CATEGORY2',
price: PRODUCT_PRICE2
},
],
});
</script>
ViewProduct ‑ product page
Insert on: product or service detail pages. What it handles: sends data about the product, especially its ID, price, name, and category. Triggered on init.
<script>
wph('track', 'ViewContent', {
content_name: 'ViewProduct',
currency: 'CURRENCY',
contents: [
{
id: 'PRODUCT_ID1',
name: 'PRODUCT_NAME1',
category: 'PRODUCT_CATEGORY1',
price: PRODUCT_PRICE1
},
],
});
</script>
AddToCart ‑ adding a product to the cart
Insert on: everywhere a product or service can be added to the cart (product pages, listings, category pages). What it handles: sends data about the selected product, including ID, price, name, and category. Triggered at the moment of adding to the cart (button click or event request).
<script>
wph('track', 'AddToCart', {
currency: 'CURRENCY',
contents: [
{
id: 'PRODUCT_ID1',
name: 'PRODUCT_NAME1',
category: 'PRODUCT_CATEGORY1',
price: PRODUCT_PRICE1,
quantity: PRODUCT_QUANTITY1
},
],
});
</script>
ViewCart - show basket page
Insert on: the cart page or when the cart status is displayed (in the case of pages with a cart preview via a widget, banner, or modal). What it supports: provides data on the cart status, specifically product IDs, prices, names, and categories. The "active" parameter indicates whether someone has a product selected/active on the list and wants to pay for it, or whether they have it deselected and will not be included in the Purchase process. The "active" functionality is optional; if the parameter is not sent in the event, it is assumed to be active ('true') by default.
<script>
wph('track', 'ViewCart', {
currency: 'CURRENCY',
contents: [
{
id: 'PRODUCT_ID1',
name: 'PRODUCT_NAME1',
category: 'PRODUCT_CATEGORY1',
price: PRODUCT_PRICE1,
quantity: PRODUCT_QUANTITY1,
active: true // optional parameter boolean type - by default: true
},
{
id: 'PRODUCT_ID2',
name: 'PRODUCT_NAME2',
category: 'PRODUCT_CATEGORY2',
price: PRODUCT_PRICE2,
quantity: PRODUCT_QUANTITY2,
active: true // optional parameter boolean type - by default: true
},
],
});
</script>
StartOrder ‑ starting conversion process
Insert on: subpage or button where user proceeds to the conversion path, they have decided to purchase the products in their cart (usually by move to "checkout" section). What it handles: provides data on the final status of the cart, specifically product IDs, prices, names, and categories. An event triggered when the user navigates to the order fulfillment subpage (providing the delivery address, selecting a payment method, etc.) or clicks the "Checkout" button (or equivalent).
<script>
wph('track', 'StartOrder', {
currency: 'CURRENCY',
contents: [
{
id: 'PRODUCT_ID1',
name: 'PRODUCT_NAME1',
category: 'PRODUCT_CATEGORY1',
price: PRODUCT_PRICE1,
quantity: PRODUCT_QUANTITY1
},
{
id: 'PRODUCT_ID2',
name: 'PRODUCT_NAME2',
category: 'PRODUCT_CATEGORY2',
price: PRODUCT_PRICE2,
quantity: PRODUCT_QUANTITY2
},
],
});
</script>
Purchase ‑ order confirmation page (post‑transaction)
Insert on: purchase confirmation page (checkout success/done), or if not available, on the order confirmation page even before redirecting to the payment gateway. What it handles: sends transaction data, particularly product details, transaction ID, cart value, shipping cost, etc. Triggered on init or via event request.
<script>
wph('track', 'Purchase', {
transaction_id: 'TRANSACTION_ID', // type text e.g. 'SUP1234', '878-3939', 'abcd-xyz'
value: NET_VALUE_EXCLUDING_SHIPPING_COST, // type number e.g. 19.99
value_gross: GROSS_VALUE_EXCLUDING_SHIPPING_COST, // type number e.g. 23.59
shipping_cost: SHIPPING_COST, // type number e.g. 9.99
currency: 'CURRENCY',
contents: [
{
id: 'PRODUCT_ID1',
name: 'PRODUCT_NAME1',
category: 'PRODUCT_CATEGORY1',
price: PRODUCT_PRICE1,
quantity: PRODUCT_QUANTITY1
},
{
id: 'PRODUCT_ID2',
name: 'PRODUCT_NAME2',
category: 'PRODUCT_CATEGORY2',
price: PRODUCT_PRICE2,
quantity: PRODUCT_QUANTITY2
},
],
});
</script>
Additional events
RemoveFromCart - removing an item from the cart
Insert on: the cart page, where it is possible to remove a product or service from the list. What it handles: Provides data about the removed product, specifically the product ID, price, name, and category, or it can be empty, in which case it is an analytical event. The event is triggered when a product is removed from the cart (click or event request).
<script>
wph('track', 'RemoveFromCart', {
currency: 'CURRENCY',
contents: [
{
id: 'PRODUCT_ID1',
name: 'PRODUCT_NAME1',
category: 'PRODUCT_CATEGORY1',
price: PRODUCT_PRICE1
},
],
});
</script>
CartItemChange - changing data for a given product
The following actions can be performed on a product card: changing the product quantity, changing the variant, changing the price, adding an additional item and a possible discount for purchasing multiple items, and changing the status – for example, there are several products in the cart, and the user selects one for payment because they don't have enough funds in their account and want to keep x items in the cart and save one for a better time (the next checkout). To address these cases and detect user intent, we suggest introducing a new CartItemChange event.
Insert on: the cart page, where it is possible to remove a product or service from the list. What it handles: It provides data about the removed product, specifically the product ID, price, name, and category, or it can be empty, in which case it is an analytical event. The event is triggered when a product is removed from the cart (click or event request).
<script>
wph('track', 'CartItemChange', {
currency: 'CURRENCY',
contents: [
{
changes: ENUM[], // an array of enums "price" | "quantity" | "variant" | "active", the array is there because there may be situations where the store's shopping cart will allow editing several items and only then confirming the changes, so in order not to send several events, you need to provide several enums suggesting the name of the action.
id: 'PRODUCT_ID1',
name: 'PRODUCT_NAME1',
category: 'PRODUCT_CATEGORY1',
price: PRODUCT_PRICE1,
quantity: PRODUCT_QUANTITY1
delta_quantity: number // here we provide the difference between what was and what is, i.e. the customer had 5 products, deleted one and only has 4 left, we send -1 because that is exactly the difference.
active: true // if this event property is not present, we assume that the product is marked as "available for purchase" (true)
},
],
});
</script>
AddToWishList ‑ adding product to wishlist ‑ helper event
Insert on: wherever there’s an option to add a product or service to the favorites list (product pages, listings, category pages). What it handles: sends data about the selected product, especially ID, price, name, and category, or may be empty—then it serves as an analytical event. Triggered at the moment of adding to favorites (click or event request).
<script>
wph('track', 'ViewContent', {
content_name: 'AddToWishList',
currency: 'CURRENCY',
contents: [
{
id: 'PRODUCT_ID1',
name: 'PRODUCT_NAME1',
category: 'PRODUCT_CATEGORY1',
price: PRODUCT_PRICE1
},
],
});
</script>
RemoveFromWishList ‑ removing product from wishlist ‑ helper event
Insert on: wherever there’s an option to remove a product or service from favorites (product pages, listings, category pages, favorites page). What it handles: sends data about the removed product, especially ID, price, name, and category, or may be empty—then it serves as an analytical event. Triggered at the moment of removing from favorites (click or event request).
<script>
wph('track', 'ViewContent', {
content_name: 'RemoveFromWishList',
currency: 'CURRENCY',
contents: [
{
id: 'PRODUCT_ID1',
name: 'PRODUCT_NAME1',
category: 'PRODUCT_CATEGORY1',
price: PRODUCT_PRICE1
},
],
});
</script>
WishList ‑ adding product to the cart which was previously added to wishlist ‑ conversion event
Insert on: wherever there’s an option to add a product or service to the cart (product pages, listings, category pages). What it handles: sends data about the selected product, especially ID, price, name, and category. Triggered at the moment of adding to the cart a product that was previously added to favorites (click or event request).
<script>
wph('track', 'Conversion', {
content_name: 'WishList',
currency: 'CURRENCY',
contents: [
{
id: 'PRODUCT_ID1',
name: 'PRODUCT_NAME1',
category: 'PRODUCT_CATEGORY1',
price: PRODUCT_PRICE1
},
],
});
</script>
Frequently Asked Questions (FAQ)
Data is not being collected properly or there are issues with the Pixel functioning
Make sure that, for example, 'PRODUCT_ID1' is always automatically replaced with the actual product ID on every page — entering it literally will cause malfunction.