Sales Insights (ECommerce)
Sales Insight has multiple premade analysis that are based on native events but also on the properties that are currently tracked. It allows you to send events at different steps of the purchase funnel to give you a detailed view from start to finish.
You'll first have the products impressions, the creation and evolution of the cart and its content to finally have a transaction.
These are examples, the property list can be changed to fit your needs. You can very well remove properties and add custom properties on top. Please note that the implementation in those examples represent best practices whenever you want to fill the premade analyses available in the Piano Analytics interfaces.
Product events
product.display
Mandatory property: product_id
Impression of a product on a given page. Aside from the product_id
that is mandatory, this implementation is recommended at least to allow you to fill all of the premade analysis in the interface.
- Javascript
- Android (3.3.0+)
- Android
- Apple
- HTTP
pa.sendEvent('product.display', {
'product_id' : 'LPTAX174' // mandatory,
'product' : 'Laptop AX174',
'product_variant' : '8Go RAM',
'product_brand' : 'Laptop',
'product_discount' : false,
'product_pricetaxincluded' : 1399.9,
'product_pricetaxfree' : 1120.9,
'product_stock' : true,
'product_category1' : 'Hardware',
'product_category2' : 'Computer',
'product_category3' : 'Gaming',
'product_category4' : 'Laptop'
});
PianoAnalytics.getInstance().sendEvents(
Event.Builder("product.display")
.properties(
Property(PropertyName("product_id"), "LPTAX174"), // mandatory
Property(PropertyName("product"), "Laptop AX174"),
Property(PropertyName("product_variant"), "8Go RAM"),
Property(PropertyName("product_brand"), "Laptop"),
Property(PropertyName("product_discount"), false),
Property(PropertyName("product_pricetaxincluded"), 1399.9),
Property(PropertyName("product_pricetaxfree"), 1120.9),
Property(PropertyName("product_stock"), true),
Property(PropertyName("product_category1"), "Hardware"),
Property(PropertyName("product_category2"), "Computer"),
Property(PropertyName("product_category3"), "Gaming"),
Property(PropertyName("product_category4"), "Laptop"),
)
.build()
)
pa.sendEvent(new Event("product.display", new HashMap<String, Object>() {{
put("product_id", "LPTAX174"); // mandatory
put("product", "Laptop AX174");
put("product_variant", "8Go RAM");
put("product_brand", "Laptop");
put("product_discount", false);
put("product_pricetaxincluded", 1399.9);
put("product_pricetaxfree", 1120.9);
put("product_stock", true);
put("product_category1", "Hardware");
put("product_category2", "Computer");
put("product_category3", "Gaming");
put("product_category4", "Laptop");
}}));
pa.sendEvent(Event("product.display", data: [
"product_id" : "LPTAX174", // mandatory
"product" : "Laptop AX174",
"product_variant" : "8Go RAM",
"product_brand" : "Laptop",
"product_discount" : false,
"product_pricetaxincluded" : 1399.9,
"product_pricetaxfree" : 1120.9,
"product_stock" : true,
"product_category1" : "Hardware",
"product_category2" : "Computer",
"product_category3" : "Gaming",
"product_category4" : "Laptop"
]))
const site_id = `XXXXXXXXXX`;
const visitor_id = `<visitor_id>`;
const endpoint = `<xxxxxxx>.pa-cd.com`;
fetch(`https://${endpoint}/event?s=${site_id}&idclient=${visitor_id}`, {
method: "POST",
body: JSON.stringify({
events: [{
name: "product.display",
data: {
"product_id": "LPTAX174",
"product": "Laptop AX174",
"product_variant": "8Go RAM",
"product_brand": "Laptop",
"product_discount": false,
"product_pricetaxincluded": 1399.9,
"product_pricetaxfree": 1120.9,
"product_stock": true,
"product_category1": "Hardware",
"product_category2": "Computer",
"product_category3": "Gaming",
"product_category4": "Laptop"
}
}]
})
})
product.page_display
Mandatory property: product_id
Impression of a product page. Aside from the product_id
that is mandatory, this implementation is recommended at least to allow you to fill all of the premade analysis in the interface.
- Javascript
- Android (3.3.0+)
- Android
- Apple
- HTTP
pa.sendEvent('product.page_display', {
'product_id' : 'LPTAX174' // mandatory,
'product' : 'Laptop AX174',
'product_variant' : '8Go RAM',
'product_brand' : 'Laptop',
'product_discount' : false,
'product_pricetaxincluded' : 1399.9,
'product_pricetaxfree' : 1120.9,
'product_stock' : true,
'product_category1' : 'Hardware',
'product_category2' : 'Computer',
'product_category3' : 'Gaming',
'product_category4' : 'Laptop'
});
PianoAnalytics.getInstance().sendEvents(
Event.Builder("product.page_display")
.properties(
Property(PropertyName("product_id"), "LPTAX174"), // mandatory
Property(PropertyName("product"), "Laptop AX174"),
Property(PropertyName("product_variant"), "8Go RAM"),
Property(PropertyName("product_brand"), "Laptop"),
Property(PropertyName("product_discount"), false),
Property(PropertyName("product_pricetaxincluded"), 1399.9),
Property(PropertyName("product_pricetaxfree"), 1120.9),
Property(PropertyName("product_stock"), true),
Property(PropertyName("product_category1"), "Hardware"),
Property(PropertyName("product_category2"), "Computer"),
Property(PropertyName("product_category3"), "Gaming"),
Property(PropertyName("product_category4"), "Laptop"),
)
.build()
)
pa.sendEvent(new Event("product.page_display", new HashMap<String, Object>() {{
put("product_id", "LPTAX174"); // mandatory
put("product", "Laptop AX174");
put("product_variant", "8Go RAM");
put("product_brand", "Laptop");
put("product_discount", false);
put("product_pricetaxincluded", 1399.9);
put("product_pricetaxfree", 1120.9);
put("product_stock", true);
put("product_category1", "Hardware");
put("product_category2", "Computer");
put("product_category3", "Gaming");
put("product_category4", "Laptop");
}}));
pa.sendEvent(Event("product.page_display", data: [
"product_id" : "LPTAX174", // mandatory
"product" : "Laptop AX174",
"product_variant" : "8Go RAM",
"product_brand" : "Laptop",
"product_discount" : false,
"product_pricetaxincluded" : 1399.9,
"product_pricetaxfree" : 1120.9,
"product_stock" : true,
"product_category1" : "Hardware",
"product_category2" : "Computer",
"product_category3" : "Gaming",
"product_category4" : "Laptop"
]))
const site_id = `XXXXXXXXXX`;
const visitor_id = `<visitor_id>`;
const endpoint = `<xxxxxxx>.pa-cd.com`;
fetch(`https://${endpoint}/event?s=${site_id}&idclient=${visitor_id}`, {
method: "POST",
body: JSON.stringify({
events: [{
name: "product.page_display",
data: {
"product_id": "LPTAX174",
"product": "Laptop AX174",
"product_variant": "8Go RAM",
"product_brand": "Laptop",
"product_discount": false,
"product_pricetaxincluded": 1399.9,
"product_pricetaxfree": 1120.9,
"product_stock": true,
"product_category1": "Hardware",
"product_category2": "Computer",
"product_category3": "Gaming",
"product_category4": "Laptop"
}
}]
})
})
product.add_to_cart
Mandatory properties: product_id
Add a product to a cart. Aside from the product_id
that is mandatory, this implementation is recommended at least to allow you to fill all of the premade analysis in the interface.
Adding the cart.creation event is only needed whenever the 'product.add_to_cart' creates a new cart.
- Javascript
- Android
- Apple
pa.sendEvents([
{
name: "product.add_to_cart",
data: {
cart_id: "LAPW221C",
product_id: "LPTAX174", // mandatory property
product: "Laptop AX174",
product_variant: "8Go RAM",
product_brand: "Laptop",
product_discount: false,
product_pricetaxincluded: 1399.9,
product_pricetaxfree: 1120.9,
product_stock: true,
product_category1: "Hardware",
product_category2: "Computer",
product_category3: "Gaming",
product_category4: "Laptop",
product_quantity: 1,
product_cartcreation: true,
},
},
{
name: "cart.creation", // Only if product_cartcreation: true
data: {
cart_id: "LAPW221C", // mandatory property
cart_currency: "EUR",
cart_turnovertaxincluded: 1399.9,
cart_turnovertaxfree: 1120.9,
cart_quantity: 1,
cart_nbdistinctproduct: 1,
},
},
]);
pa.sendEvents(Arrays.asList(
new Event("product.add_to_cart", new HashMap<String, Object>() {{
put("cart_id", "LAPW221C");
put("product_id", "LPTAX174"); // mandatory property
put("product", "Laptop AX174");
put("product_variant", "8Go RAM");
put("product_brand", "Laptop");
put("product_discount", false);
put("product_pricetaxincluded", 1399.9);
put("product_pricetaxfree", 1120.9);
put("product_stock", true);
put("product_category1", "Hardware");
put("product_category2", "Computer");
put("product_category3", "Gaming");
put("product_category4", "Laptop");
put("product_quantity", 1);
put("product_cartcreation", true);
}}),
new Event("cart.creation", new HashMap<String, Object>() {{
put("cart_id", "LAPW221C"); // mandatory property
put("cart_currency", "EUR");
put("cart_turnovertaxincluded", 1399.9);
put("cart_turnovertaxfree", 1120.9);
put("cart_quantity", 1);
put("cart_nbdistinctproduct", 1);
}})
));
pa.sendEvents([
Event("product.add_to_cart", data: [
"cart_id": "LAPW221C",
"product_id": "LPTAX174", // mandatory property
"product": "Laptop AX174",
"product_variant": "8Go RAM",
"product_brand": "Laptop",
"product_discount": false,
"product_pricetaxincluded": 1399.9,
"product_pricetaxfree": 1120.9,
"product_stock": true,
"product_category1": "Hardware",
"product_category2": "Computer",
"product_category3": "Gaming",
"product_category4": "Laptop",
"product_quantity": 1,
"product_cartcreation": true
]),
Event("cart.creation", data: [
"cart_id": "LAPW221C", // mandatory property
"cart_currency": "EUR",
"cart_turnovertaxincluded": 1399.9,
"cart_turnovertaxfree": 1120.9,
"cart_quantity": 1,
"cart_nbdistinctproduct": 1
])
])
product.remove_from_cart
Mandatory properties: product_id
Remove a product from a cart. Aside from the product_id
that is mandatory, this implementation is recommended at least to allow you to fill all of the premade analysis in the interface.
- Javascript
- Android (3.3.0+)
- Android
- Apple
- HTTP
pa.sendEvent('product.remove_from_cart', {
'cart_id' : 'LAPW221C',
'product_id' : 'LPTAX174' // mandatory,
'product' : 'Laptop AX174',
'product_variant' : '8Go RAM',
'product_brand' : 'Laptop',
'product_discount' : false,
'product_pricetaxincluded' : 1399.9,
'product_pricetaxfree' : 1120.9,
'product_stock' : true,
'product_category1' : 'Hardware',
'product_category2' : 'Computer',
'product_category3' : 'Gaming',
'product_category4' : 'Laptop',
'product_quantity' : 1
});
PianoAnalytics.getInstance().sendEvents(
Event.Builder("product.remove_from_cart")
.properties(
Property(PropertyName("cart_id"), "LAPW221C"),
Property(PropertyName("product_id"), "LPTAX174"), // mandatory
Property(PropertyName("product"), "Laptop AX174"),
Property(PropertyName("product_variant"), "8Go RAM"),
Property(PropertyName("product_brand"), "Laptop"),
Property(PropertyName("product_discount"), false),
Property(PropertyName("product_pricetaxincluded"), 1399.9),
Property(PropertyName("product_pricetaxfree"), 1120.9),
Property(PropertyName("product_stock"), true),
Property(PropertyName("product_category1"), "Hardware"),
Property(PropertyName("product_category2"), "Computer"),
Property(PropertyName("product_category3"), "Gaming"),
Property(PropertyName("product_category4"), "Laptop"),
Property(PropertyName("product_quantity"), 1),
)
.build()
)
pa.sendEvent(new Event("product.remove_from_cart", new HashMap<String, Object>() {{
put("cart_id", "LAPW221C");
put("product_id", "LPTAX174"); // mandatory
put("product", "Laptop AX174");
put("product_variant", "8Go RAM");
put("product_brand", "Laptop");
put("product_discount", false);
put("product_pricetaxincluded", 1399.9);
put("product_pricetaxfree", 1120.9);
put("product_stock", true);
put("product_category1", "Hardware");
put("product_category2", "Computer");
put("product_category3", "Gaming");
put("product_category4", "Laptop");
put("product_quantity", 1);
}}));
pa.sendEvent(Event("product.remove_from_cart", data: [
"cart_id" : "LAPW221C",
"product_id" : "LPTAX174", // mandatory
"product" : "Laptop AX174",
"product_variant" : "8Go RAM",
"product_brand" : "Laptop",
"product_discount" : false,
"product_pricetaxincluded" : 1399.9,
"product_pricetaxfree" : 1120.9,
"product_stock" : true,
"product_category1" : "Hardware",
"product_category2" : "Computer",
"product_category3" : "Gaming",
"product_category4" : "Laptop",
"product_quantity" : 1
]))
const site_id = `XXXXXXXXXX`;
const visitor_id = `<visitor_id>`;
const endpoint = `<xxxxxxx>.pa-cd.com`;
fetch(`https://${endpoint}/event?s=${site_id}&idclient=${visitor_id}`, {
method: "POST",
body: JSON.stringify({
events: [{
name: "product.remove_from_cart",
data: {
"cart_id": "LAPW221C",
"product_id": "LPTAX174",
"product": "Laptop AX174",
"product_variant": "8Go RAM",
"product_brand": "Laptop",
"product_discount": false,
"product_pricetaxincluded": 1399.9,
"product_pricetaxfree": 1120.9,
"product_stock": true,
"product_category1": "Hardware",
"product_category2": "Computer",
"product_category3": "Gaming",
"product_category4": "Laptop",
"product_quantity": 1
}
}]
})
})
Cart events
cart.creation
Mandatory property: cart_id
This event can be used alongside others or as a standalone event whenever a new cart is created.
- Javascript
- Android (3.3.0+)
- Android
- Apple
- HTTP
pa.sendEvent('cart.creation', {
'cart_id' : 'LAPW221C' // mandatory,
'cart_currency' : 'EUR',
'cart_turnovertaxincluded' : 1399.9,
'cart_turnovertaxfree' : 1120.9,
'cart_quantity' : 1,
'cart_nbdistinctproduct' : 1
});
PianoAnalytics.getInstance().sendEvents(
Event.Builder("cart.creation")
.properties(
Property(PropertyName("cart_id"), "LAPW221C"), // mandatory
Property(PropertyName("cart_currency"), "EUR"),
Property(PropertyName("cart_turnovertaxincluded"), 1399.9),
Property(PropertyName("cart_turnovertaxfree"), 1120.9),
Property(PropertyName("cart_quantity"), 1),
Property(PropertyName("cart_nbdistinctproduct"), 1),
)
.build()
)
pa.sendEvent(new Event("cart.creation", new HashMap<String, Object>() {{
put("cart_id", "LAPW221C"); // mandatory
put("cart_currency", "EUR");
put("cart_turnovertaxincluded", 1399.9);
put("cart_turnovertaxfree", 1120.9);
put("cart_quantity", 1);
put("cart_nbdistinctproduct", 1);
}}));
pa.sendEvent(Event("cart.creation", data: [
"cart_id" : "LAPW221C", // mandatory
"cart_currency" : "EUR",
"cart_turnovertaxincluded" : 1399.9,
"cart_turnovertaxfree" : 1120.9,
"cart_quantity" : 1,
"cart_nbdistinctproduct" : 1
]))
const site_id = `XXXXXXXXXX`;
const visitor_id = `<visitor_id>`;
const endpoint = `<xxxxxxx>.pa-cd.com`;
fetch(`https://${endpoint}/event?s=${site_id}&idclient=${visitor_id}`, {
method: "POST",
body: JSON.stringify({
events: [{
name: "cart.creation",
data: {
"cart_id": "LAPW221C",
"cart_currency": "EUR",
"cart_turnovertaxincluded": 1399.9,
"cart_turnovertaxfree": 1120.9,
"cart_quantity": 1,
"cart_nbdistinctproduct": 1
}
}]
})
})
cart.display
Mandatory property: cart_id
This event can be sent everytime the cart page is loaded.
- Javascript
- Android (3.3.0+)
- Android
- Apple
- HTTP
pa.sendEvent('cart.display', {
'cart_id' : 'LAPW221C' // mandatory,
'cart_currency' : 'EUR',
'cart_turnovertaxincluded' : 1399.9,
'cart_turnovertaxfree' : 1120.9,
'cart_quantity' : 1,
'cart_nbdistinctproduct' : 1
});
PianoAnalytics.getInstance().sendEvents(
Event.Builder("cart.display")
.properties(
Property(PropertyName("cart_id"), "LAPW221C"), // mandatory
Property(PropertyName("cart_currency"), "EUR"),
Property(PropertyName("cart_turnovertaxincluded"), 1399.9),
Property(PropertyName("cart_turnovertaxfree"), 1120.9),
Property(PropertyName("cart_quantity"), 1),
Property(PropertyName("cart_nbdistinctproduct"), 1),
)
.build()
)
pa.sendEvent(new Event("cart.display", new HashMap<String, Object>() {{
put("cart_id", "LAPW221C"); // mandatory
put("cart_currency", "EUR");
put("cart_turnovertaxincluded", 1399.9);
put("cart_turnovertaxfree", 1120.9);
put("cart_quantity", 1);
put("cart_nbdistinctproduct", 1);
}}));
pa.sendEvent(Event("cart.display", data: [
"cart_id" : "LAPW221C", // mandatory
"cart_currency" : "EUR",
"cart_turnovertaxincluded" : 1399.9,
"cart_turnovertaxfree" : 1120.9,
"cart_quantity" : 1,
"cart_nbdistinctproduct" : 1
]))
const site_id = `XXXXXXXXXX`;
const visitor_id = `<visitor_id>`;
const endpoint = `<xxxxxxx>.pa-cd.com`;
fetch(`https://${endpoint}/event?s=${site_id}&idclient=${visitor_id}`, {
method: "POST",
body: JSON.stringify({
events: [{
name: "cart.display",
data: {
"cart_id": "LAPW221C",
"cart_currency": "EUR",
"cart_turnovertaxincluded": 1399.9,
"cart_turnovertaxfree": 1120.9,
"cart_quantity": 1,
"cart_nbdistinctproduct": 1
}
}]
})
})
cart.update
Mandatory property: cart_id
This event can be sent everytime the cart gets updated. It is meant to send the latest known state of the cart's value.
- Javascript
- Android (3.3.0+)
- Android
- Apple
- HTTP
pa.sendEvent('cart.update', {
'cart_id' : 'LAPW221C' // mandatory,
'cart_currency' : 'EUR',
'cart_turnovertaxincluded' : 1399.9,
'cart_turnovertaxfree' : 1120.9,
'cart_quantity' : 1,
'cart_nbdistinctproduct' : 1
});
PianoAnalytics.getInstance().sendEvents(
Event.Builder("cart.update")
.properties(
Property(PropertyName("cart_id"), "LAPW221C"), // mandatory
Property(PropertyName("cart_currency"), "EUR"),
Property(PropertyName("cart_turnovertaxincluded"), 1399.9),
Property(PropertyName("cart_turnovertaxfree"), 1120.9),
Property(PropertyName("cart_quantity"), 1),
Property(PropertyName("cart_nbdistinctproduct"), 1),
)
.build()
)
pa.sendEvent(new Event("cart.update", new HashMap<String, Object>() {{
put("cart_id", "LAPW221C"); // mandatory
put("cart_currency", "EUR");
put("cart_turnovertaxincluded", 1399.9);
put("cart_turnovertaxfree", 1120.9);
put("cart_quantity", 1);
put("cart_nbdistinctproduct", 1);
}}));
pa.sendEvent(Event("cart.update", data: [
"cart_id" : "LAPW221C", // mandatory
"cart_currency" : "EUR",
"cart_turnovertaxincluded" : 1399.9,
"cart_turnovertaxfree" : 1120.9,
"cart_quantity" : 1,
"cart_nbdistinctproduct" : 1
]))
const site_id = `XXXXXXXXXX`;
const visitor_id = `<visitor_id>`;
const endpoint = `<xxxxxxx>.pa-cd.com`;
fetch(`https://${endpoint}/event?s=${site_id}&idclient=${visitor_id}`, {
method: "POST",
body: JSON.stringify({
events: [{
name: "cart.update",
data: {
"cart_id": "LAPW221C",
"cart_currency": "EUR",
"cart_turnovertaxincluded": 1399.9,
"cart_turnovertaxfree": 1120.9,
"cart_quantity": 1,
"cart_nbdistinctproduct": 1
}
}]
})
})
cart.delivery
Mandatory property: cart_id
This event can be used to measure the delivery method selection step. The shipping properties in the example are not mandatory but can be sent on this step if known at this moment. Otherwise it can be done in the cart.payment step
- Javascript
- Android (3.3.0+)
- Android
- Apple
- HTTP
pa.sendEvent('cart.delivery', {
'cart_id' : 'LAPW221C' // mandatory,
'cart_currency' : 'EUR',
'cart_turnovertaxincluded' : 1399.9,
'cart_turnovertaxfree' : 1120.9,
'cart_quantity' : 1,
'cart_nbdistinctproduct' : 1,
'shipping_delivery' : '1Express',
'shipping_costtaxincluded' : 11.99,
'shipping_costtaxfree' : 10.99
});
PianoAnalytics.getInstance().sendEvents(
Event.Builder("cart.delivery")
.properties(
Property(PropertyName("cart_id"), "LAPW221C"), // mandatory
Property(PropertyName("cart_currency"), "EUR"),
Property(PropertyName("cart_turnovertaxincluded"), 1399.9),
Property(PropertyName("cart_turnovertaxfree"), 1120.9),
Property(PropertyName("cart_quantity"), 1),
Property(PropertyName("cart_nbdistinctproduct"), 1),
Property(PropertyName("shipping_delivery"), "1Express"),
Property(PropertyName("shipping_costtaxincluded"), 11.99),
Property(PropertyName("shipping_costtaxfree"), 10.99),
)
.build()
)
pa.sendEvent(new Event("cart.delivery", new HashMap<String, Object>() {{
put("cart_id", "LAPW221C"); // mandatory
put("cart_currency", "EUR");
put("cart_turnovertaxincluded", 1399.9);
put("cart_turnovertaxfree", 1120.9);
put("cart_quantity", 1);
put("cart_nbdistinctproduct", 1);
put("shipping_delivery", "1Express");
put("shipping_costtaxincluded", 11.99);
put("shipping_costtaxfree", 10.99);
}}));
pa.sendEvent(Event("cart.delivery", data: [
"cart_id" : "LAPW221C", // mandatory
"cart_currency" : "EUR",
"cart_turnovertaxincluded" : 1399.9,
"cart_turnovertaxfree" : 1120.9,
"cart_quantity" : 1,
"cart_nbdistinctproduct" : 1,
"shipping_delivery" : "1Express",
"shipping_costtaxincluded" : 11.99,
"shipping_costtaxfree" : 10.99
]))
const site_id = `XXXXXXXXXX`;
const visitor_id = `<visitor_id>`;
const endpoint = `<xxxxxxx>.pa-cd.com`;
fetch(`https://${endpoint}/event?s=${site_id}&idclient=${visitor_id}`, {
method: "POST",
body: JSON.stringify({
events: [{
name: "cart.delivery",
data: {
"cart_id": "LAPW221C",
"cart_currency": "EUR",
"cart_turnovertaxincluded": 1399.9,
"cart_turnovertaxfree": 1120.9,
"cart_quantity": 1,
"cart_nbdistinctproduct": 1,
"shipping_delivery": "1Express",
"shipping_costtaxincluded": 11.99,
"shipping_costtaxfree": 10.99
}
}]
})
})
cart.payment
Mandatory property: cart_id
This event can be used to measure the payment step. The payment method can be sent at this moment if known.
- Javascript
- Android (3.3.0+)
- Android
- Apple
- HTTP
pa.sendEvent('cart.payment', {
'cart_id' : 'LAPW221C' // mandatory,
'cart_currency' : 'EUR',
'cart_turnovertaxincluded' : 1399.9,
'cart_turnovertaxfree' : 1120.9,
'cart_quantity' : 1,
'cart_nbdistinctproduct' : 1,
'shipping_delivery' : 'Express',
'shipping_costtaxincluded' : 11.99,
'shipping_costtaxfree' : 10.99,
'payment_mode' : 'Credit card'
});
PianoAnalytics.getInstance().sendEvents(
Event.Builder("cart.payment")
.properties(
Property(PropertyName("cart_id"), "LAPW221C"), // mandatory
Property(PropertyName("cart_currency"), "EUR"),
Property(PropertyName("cart_turnovertaxincluded"), 1399.9),
Property(PropertyName("cart_turnovertaxfree"), 1120.9),
Property(PropertyName("cart_quantity"), 1),
Property(PropertyName("cart_nbdistinctproduct"), 1),
Property(PropertyName("shipping_delivery"), "Express"),
Property(PropertyName("shipping_costtaxincluded"), 11.99),
Property(PropertyName("shipping_costtaxfree"), 10.99),
Property(PropertyName("payment_mode"), "Credit card"),
)
.build()
)
pa.sendEvent(new Event("cart.payment", new HashMap<String, Object>() {{
put("cart_id", "LAPW221C"); // mandatory
put("cart_currency", "EUR");
put("cart_turnovertaxincluded", 1399.9);
put("cart_turnovertaxfree", 1120.9);
put("cart_quantity", 1);
put("cart_nbdistinctproduct", 1);
put("shipping_delivery", "Express");
put("shipping_costtaxincluded", 11.99);
put("shipping_costtaxfree", 10.99);
put("payment_mode", "Credit card");
}}));
pa.sendEvent(Event("cart.payment", data: [
"cart_id" : "LAPW221C", // mandatory
"cart_currency" : "EUR",
"cart_turnovertaxincluded" : 1399.9,
"cart_turnovertaxfree" : 1120.9,
"cart_quantity" : 1,
"cart_nbdistinctproduct" : 1,
"shipping_delivery" : "Express",
"shipping_costtaxincluded" : 11.99,
"shipping_costtaxfree" : 10.99,
"payment_mode" : "Credit card"
]))
const site_id = `XXXXXXXXXX`;
const visitor_id = `<visitor_id>`;
const endpoint = `<xxxxxxx>.pa-cd.com`;
fetch(`https://${endpoint}/event?s=${site_id}&idclient=${visitor_id}`, {
method: "POST",
body: JSON.stringify({
events: [{
name: "cart.payment",
data: {
"cart_id": "LAPW221C",
"cart_currency": "EUR",
"cart_turnovertaxincluded": 1399.9,
"cart_turnovertaxfree": 1120.9,
"cart_quantity": 1,
"cart_nbdistinctproduct": 1,
"shipping_delivery": "Express",
"shipping_costtaxincluded": 11.99,
"shipping_costtaxfree": 10.99,
"payment_mode": "Credit card"
}
}]
})
})
cart.awaiting_payment
and product.awaiting_payment
Mandatory property: cart_id
and product_id
and cart_version
These events can be used whenever the transaction needs to be validated by a third party (3D Secure for example). The products are not mandatory but will allow you to see the different articles in the cart.
You will then be able to validate the cart, once you get the response, through a transaction event (can also be done server-side).
- Javascript
- Android
- Apple
pa.sendEvents([
{
name: "cart.awaiting_payment",
data: {
cart_id: "LAPW221C", // mandatory property
cart_version: "VER211SQ", // mandatory property
cart_currency: "EUR",
cart_creation_utc: 1666196008,
cart_turnovertaxincluded: 1399.9,
cart_turnovertaxfree: 1120.9,
cart_quantity: 1,
cart_nbdistinctproduct: 1,
shipping_delivery: "Express",
shipping_costtaxincluded: 11.99,
shipping_costtaxfree: 10.99,
},
},
{
name: "product.awaiting_payment",
data: {
cart_id: "LAPW221C", // mandatory property
cart_version: "VER211SQ", // mandatory property
product_id: "LPTAX174", // mandatory property
product: "Laptop AX174",
product_variant: "8Go RAM",
product_brand: "Laptop",
product_discount: false,
product_pricetaxincluded: 1399.9,
product_pricetaxfree: 1120.9,
product_stock: true,
product_category1: "Hardware",
product_category2: "Computer",
product_category3: "Gaming",
product_category4: "Laptop",
product_quantity: 1,
},
},
]);
pa.sendEvents(Arrays.asList(
new Event("cart.awaiting_payment", new HashMap<String, Object>() {{
put("cart_id", "LAPW221C"); // mandatory property
put("cart_version", "VER211SQ"); // mandatory property
put("cart_currency", "EUR");
put("cart_creation_utc", 1666196008);
put("cart_turnovertaxincluded", 1399.9);
put("cart_turnovertaxfree", 1120.9);
put("cart_quantity", 1);
put("cart_nbdistinctproduct", 1);
put("shipping_delivery", "Express");
put("shipping_costtaxincluded", 11.99);
put("shipping_costtaxfree", 10.99);
}}),
new Event("product.awaiting_payment", new HashMap<String, Object>() {{
put("cart_id", "LAPW221C"); // mandatory property
put("cart_version", "VER211SQ"); // mandatory property
put("product_id", "LPTAX174"); // mandatory property
put("product", "Laptop AX174");
put("product_variant", "8Go RAM");
put("product_brand", "Laptop");
put("product_discount", false);
put("product_pricetaxincluded", 1399.9);
put("product_pricetaxfree", 1120.9);
put("product_stock", true);
put("product_category1", "Hardware");
put("product_category2", "Computer");
put("product_category3", "Gaming");
put("product_category4", "Laptop");
put("product_quantity", 1);
}})
));
pa.sendEvents([
Event("cart.awaiting_payment", data: [
"cart_id": "LAPW221C", // mandatory property
"cart_version": "VER211SQ", // mandatory property
"cart_currency": "EUR",
"cart_creation_utc": 1666196008,
"cart_turnovertaxincluded": 1399.9,
"cart_turnovertaxfree": 1120.9,
"cart_quantity": 1,
"cart_nbdistinctproduct": 1,
"shipping_delivery": "Express",
"shipping_costtaxincluded": 11.99,
"shipping_costtaxfree": 10.99
]),
Event("product.awaiting_payment", data: [
"cart_id": "LAPW221C", // mandatory property
"cart_version": "VER211SQ", // mandatory property
"product_id": "LPTAX174", // mandatory property
"product": "Laptop AX174",
"product_variant": "8Go RAM",
"product_brand": "Laptop",
"product_discount": false,
"product_pricetaxincluded": 1399.9,
"product_pricetaxfree": 1120.9,
"product_stock": true,
"product_category1": "Hardware",
"product_category2": "Computer",
"product_category3": "Gaming",
"product_category4": "Laptop",
"product_quantity": 1
])
])
Using this method, please note that the server-side confirmation needs to happen under 24h. The confirmation event will be excluded after this time limit. If needed, the confirmation_delay
property can be added to your awaiting_payment
events. Should this property be tagged with a relevant value, the limit can be extended from 24h to up to 72h.
Server-side events
Server-side transaction confirmation
Mandatory property: cart_id
and transaction_id
and offsite_confirmation:true
This server-side request allows you to validate a cart that was previously awaiting payment.
https://<xxxxxxx>.pa-cd.com/hit.xiti?s=123456789&events=[{"name":"transaction.confirmation","data":{"cart_id":"XXXXX",
"transaction_id":"XXXXX", "offsite_confirmation":true}}]&rdt=off
Transaction events
transaction.confirmation
and product.purchased
Mandatory property: product_id
and transaction_id
These events are sent whenever a transaction is made. On this example, the cart and the products are validated. The cart_id
is not mandatory for these events.
- Javascript
- Android
- Apple
pa.sendEvents([
{
name: "transaction.confirmation",
data: {
cart_id: "LAPW221C",
cart_currency: "EUR",
cart_turnovertaxincluded: 1399.9,
cart_creation_utc: 1666196008,
cart_turnovertaxfree: 1120.9,
cart_quantity: 1,
cart_nbdistinctproduct: 1,
shipping_delivery: "Express",
shipping_costtaxincluded: 11.99,
shipping_costtaxfree: 10.99,
transaction_id: "TR221SI", // mandatory property
transaction_promocode: ["REDUC10"],
transaction_status: "charged",
transaction_firstpurchase: true,
payment_mode: "Credit card",
},
},
{
name: "product.purchased",
data: {
cart_id: "LAPW221C",
product_id: "LPTAX174", // mandatory property
product: "Laptop AX174",
product_variant: "8Go RAM",
product_brand: "Laptop",
product_discount: false,
product_pricetaxincluded: 1399.9,
product_pricetaxfree: 1120.9,
product_stock: true,
product_category1: "Hardware",
product_category2: "Computer",
product_category3: "Gaming",
product_category4: "Laptop",
product_quantity: 1,
payment_mode: "Credit card",
transaction_id: "TR221SI", // mandatory property
transaction_promocode: ["REDUC10"],
},
},
{
name: "product.purchased",
data: {
cart_id: "LAPW221C",
product_id: "LPTAX176", // mandatory property
product: "Laptop AX176",
product_variant: "16Go RAM",
product_brand: "Laptop",
product_discount: false,
product_pricetaxincluded: 1599.9,
product_pricetaxfree: 1220.9,
product_stock: true,
product_category1: "Hardware",
product_category2: "Computer",
product_category3: "Gaming",
product_category4: "Laptop",
product_quantity: 1,
payment_mode: "Credit card",
transaction_id: "TR221SI", // mandatory property
transaction_promocode: ["REDUC10"],
},
},
]);
pa.sendEvents(Arrays.asList(
new Event("transaction.confirmation", new HashMap<String, Object>() {{
put("cart_id", "LAPW221C");
put("cart_currency", "EUR");
put("cart_turnovertaxincluded", 1399.9);
put("cart_creation_utc", 1666196008);
put("cart_turnovertaxfree", 1120.9);
put("cart_quantity", 1);
put("cart_nbdistinctproduct", 1);
put("shipping_delivery", "Express");
put("shipping_costtaxincluded", 11.99);
put("shipping_costtaxfree", 10.99);
put("transaction_id", "TR221SI"); // mandatory property
put("transaction_promocode", ["REDUC10"]);
put("transaction_status", "charged");
put("transaction_firstpurchase", true);
put("payment_mode", "Credit card");
}}),
new Event("product.purchased", new HashMap<String, Object>() {{
put("cart_id", "LAPW221C");
put("product_id", "LPTAX174"); // mandatory property
put("product", "Laptop AX174");
put("product_variant", "8Go RAM");
put("product_brand", "Laptop");
put("product_discount", false);
put("product_pricetaxincluded", 1399.9);
put("product_pricetaxfree", 1120.9);
put("product_stock", true);
put("product_category1", "Hardware");
put("product_category2", "Computer");
put("product_category3", "Gaming");
put("product_category4", "Laptop");
put("product_quantity", 1);
put("payment_mode", "Credit card");
put("transaction_id", "TR221SI"); // mandatory property
put("transaction_promocode", ["REDUC10"]);
}}),
new Event("product.purchased", new HashMap<String, Object>() {{
put("cart_id", "LAPW221C");
put("product_id", "LPTAX176"); // mandatory property
put("product", "Laptop AX176");
put("product_variant", "16Go RAM");
put("product_brand", "Laptop");
put("product_discount", false);
put("product_pricetaxincluded", 1599.9);
put("product_pricetaxfree", 1220.9);
put("product_stock", true);
put("product_category1", "Hardware");
put("product_category2", "Computer");
put("product_category3", "Gaming");
put("product_category4", "Laptop");
put("product_quantity", 1);
put("payment_mode", "Credit card");
put("transaction_id", "TR221SI"); // mandatory property
put("transaction_promocode", ["REDUC10"]);
}})
));
pa.sendEvents([
Event("transaction.confirmation", data: [
"cart_id": "LAPW221C",
"cart_currency": "EUR",
"cart_turnovertaxincluded": 1399.9,
"cart_creation_utc": 1666196008,
"cart_turnovertaxfree": 1120.9,
"cart_quantity": 1,
"cart_nbdistinctproduct": 1,
"shipping_delivery": "Express",
"shipping_costtaxincluded": 11.99,
"shipping_costtaxfree": 10.99,
"transaction_id": "TR221SI", // mandatory property
"transaction_promocode": ["REDUC10"],
"transaction_status": "charged",
"transaction_firstpurchase": true,
"payment_mode": "Credit card"
]),
Event("product.purchased", data: [
"cart_id": "LAPW221C",
"product_id": "LPTAX174", // mandatory property
"product": "Laptop AX174",
"product_variant": "8Go RAM",
"product_brand": "Laptop",
"product_discount": false,
"product_pricetaxincluded": 1399.9,
"product_pricetaxfree": 1120.9,
"product_stock": true,
"product_category1": "Hardware",
"product_category2": "Computer",
"product_category3": "Gaming",
"product_category4": "Laptop",
"product_quantity": 1,
"payment_mode": "Credit card",
"transaction_id": "TR221SI", // mandatory property
"transaction_promocode": ["REDUC10"]
]),
Event("product.purchased", data: [
"cart_id": "LAPW221C",
"product_id": "LPTAX176", // mandatory property
"product": "Laptop AX176",
"product_variant": "16Go RAM",
"product_brand": "Laptop",
"product_discount": false,
"product_pricetaxincluded": 1599.9,
"product_pricetaxfree": 1220.9,
"product_stock": true,
"product_category1": "Hardware",
"product_category2": "Computer",
"product_category3": "Gaming",
"product_category4": "Laptop",
"product_quantity": 1,
"payment_mode": "Credit card",
"transaction_id": "TR221SI", // mandatory property
"transaction_promocode": ["REDUC10"]
])
])
Annexes
Product properties
Property | Description | Type | Mandatory | Example |
---|---|---|---|---|
product_id | ID | string | Yes | 'LPTAX174' |
product | Label | string | 'Laptop AX174' | |
product_variant | Variant | string | '8Go RAM' | |
product_brand | Brand | string | 'Loptap' | |
product_discount | Discounted product? | boolean | false | |
product_pricetaxincluded | Price tax included | float | 1399.90 | |
product_pricetaxfree | Price tax free | float | 1120.90 | |
product_stock | Product in stock? | boolean | true | |
product_quantity | Quantity | int | 1 | |
product_category1 | Level 1 category | string | 'Hardware' | |
product_category2 | Level 2 category | string | 'Computer' | |
product_category3 | Level 3 category | string | 'Gaming' | |
product_category4 | Level 4 category | string | 'Laptop' | |
product_cartcreation | Cart created by this product addition? | boolean | false |
Cart properties
Property | Description | Type | Mandatory | Example |
---|---|---|---|---|
cart_id | ID | string | Yes | 'HW-8892' |
cart_currency | Currency (ISO 4217) | string | 'EUR' | |
cart_turnovertaxincluded | Turnover tax included | float | 2900.00 | |
cart_turnovertaxfree | Turnover tax free | float | 2340.50 | |
cart_creation_utc | Cart creation date (timestamp UTC in seconds) | int | 1501065673 | |
cart_quantity | Number of products | int | 3 | |
cart_nbdistinctproduct | Number of distinct products | int | 2 | |
cart_version | When updating the cart awaiting payment (adding/removing a product), it will be necessary to generate a new unique version identifier (cart_version) associated with the cart (cart_id). This is necessary when using pending carts/products (cart.awaiting_payment / product.awaiting_payment) | string | 'v1' | |
confirmation_delay | This property should be used if the default confirmation window needs to be extended, up to 72h. This is necessary when using pending carts/products (cart.awaiting_payment / product.awaiting_payment) | int | 72 |
Transaction properties
Property | Description | Type | Mandatory | Example |
---|---|---|---|---|
transaction_id | ID | string | Yes | '29984' |
transaction_promocode | Promo code list | array of string | ['BLACKFRIDAY', 'VIP'] | |
transaction_firstpurchase | First purchase of the customer? | boolean | true | |
transaction_status | Transaction status | string | 'charged' |
Shipping properties
Property | Description | Type | Mandatory | Example |
---|---|---|---|---|
shipping_delivery | Shipping type | string | 'Express' | |
shipping_costtaxincluded | Shipping cost tax included | float | 10.50 | |
shipping_costtaxfree | Shipping cost tax free | float | 8.00 |
Payment properties
Property | Description | Type | Mandatory | Example |
---|---|---|---|---|
payment_mode | Payment mode | string | 'Credit card' |
Available currencies
Code | Name | Country |
---|---|---|
AUD | Australian dollar | Australia |
BGN | Bulgarian lev | Bulgaria |
BRL | Brazilian Real | Brazil |
CAD | Canadian dollar | Canada |
CHF | Swiss franc | Switzerland |
CNY | Chinese Yuan Renminbi | China |
CYP | Chinese Yuan Renminbi | China |
CZK | Czech koruna | Czech Republic |
DKK | Danish Krone | Denmark |
EEK | Danish Krone | Denmark |
GBP | Pound sterling | United Kingdom |
HKD | Hong Kong dollar | Hong Kong |
HRK | Croatian kuna | Croatia |
HUF | Hungarian forint | Hungary |
IDR | Indonesian Rupiah | Indonesia |
ILS | Israeli Sheqel | Israel |
INR | Indian Rupee | India |
ISK | Icelandic Krona | Iceland |
JPY | Japanese Yen | Japan |
KRW | South Korean Won | South Korea |
LTL | South Korean Won | South Korea |
LVL | South Korean Won | South Korea |
MTL | South Korean Won | South Korea |
MXN | Mexican peso | Mexico |
MYR | Malaysian ringgit | Malaysia |
NOK | Norwegian krone | Norway |
NZD | New Zealand Dollar | New Zealand |
PHP | Philippine peso | Philippines |
PLN | Polish Zloty | Poland |
RON | Romanian leu | Romania |
RUB | Russian ruble | Russia |
SEK | Swedish krona | Sweden |
SGD | Singapore dollar | Singapore |
SIT | Singapore dollar | Singapore |
SKK | Singapore dollar | Singapore |
THB | Thai baht | Thailand |
TRL | Thai baht | Thailand |
TRY | Turkish Lira | Turkey |
USD | United States dollar | United States |
ZAR | South African rand | South Africa |