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_placement' : 'banner',
'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_placement"), "banner"),
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_placement", "banner");
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_placement" : "banner",
"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_placement": "banner",
"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_placement' : 'banner',
'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_placement"), "banner"),
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_placement", "banner");
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_placement" : "banner",
"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_placement": "banner",
"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_placement: "banner",
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_placement", "banner");
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_placement": "banner",
"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_placement' : 'banner',
'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_placement"), "banner"),
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_placement", "banner");
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_placement" : "banner",
"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_placement": "banner",
"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_placement: "banner",
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_placement", "banner");
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_placment": "banner",
"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_placement: "banner",
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_placement: "banner",
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_placement", "banner");
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_placement", "banner");
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_placement": "banner",
"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_placement": "banner",
"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_placement | Where is the product visible from? | string | 'banner' | |
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
Available currencies
Code | Name |
---|---|
AFN | Afghan Afghani |
ALL | Albanian Lek |
DZD | Algerian Dinar |
AOA | Angolan Kwanza |
ARS | Argentine Peso |
AMD | Armenian Dram |
AWG | Aruban Florin |
AUD | Australian Dollar |
AZN | Azerbaijani Manat |
BSD | Bahamian Dollar |
BHD | Bahraini Dinar |
BDT | Bangladeshi Taka |
BBD | Barbadian Dollar |
BYN | Belarusian Ruble |
BYR | Belarusian Ruble |
BZD | Belize Dollar |
BMD | Bermudian Dollar |
BTN | Bhutanese Ngultrum |
BOB | Bolivian Boliviano |
BAM | Bosnia and Herzegovina Convertible Mark |
BWP | Botswana Pula |
BRL | Brazilian Real |
GBP | British Pound |
BND | Brunei Dollar |
BGN | Bulgarian Lev |
BIF | Burundian Franc |
KHR | Cambodian Riel |
CAD | Canadian Dollar |
CVE | Cape Verdean Escudo |
KYD | Cayman Islands Dollar |
XAF | Central African Cfa Franc |
XPF | Cfp Franc |
CLP | Chilean Peso |
CNY | Chinese Renminbi Yuan |
CNH | Chinese Renminbi Yuan Offshore |
COP | Colombian Peso |
KMF | Comorian Franc |
CDF | Congolese Franc |
CRC | Costa Rican Colón |
HRK | Croatian Kuna |
CUC | Cuban Convertible Peso |
CZK | Czech Koruna |
DKK | Danish Krone |
DJF | Djiboutian Franc |
DOP | Dominican Peso |
XCD | East Caribbean Dollar |
EGP | Egyptian Pound |
EEK | Estonian Kroon |
ETB | Ethiopian Birr |
EUR | Euro |
FKP | Falkland Pound |
FJD | Fijian Dollar |
GMD | Gambian Dalasi |
GEL | Georgian Lari |
GHS | Ghanaian Cedi |
GIP | Gibraltar Pound |
XAU | Gold (Troy Ounce) |
GTQ | Guatemalan Quetzal |
GGP | Guernsey Pound |
GNF | Guinean Franc |
GYD | Guyanese Dollar |
HTG | Haitian Gourde |
HNL | Honduran Lempira |
HKD | Hong Kong Dollar |
HUF | Hungarian Forint |
ISK | Icelandic Króna |
INR | Indian Rupee |
IDR | Indonesian Rupiah |
IQD | Iraqi Dinar |
IMP | Isle of Man Pound |
ILS | Israeli New Sheqel |
JMD | Jamaican Dollar |
JPY | Japanese Yen |
JEP | Jersey Pound |
JOD | Jordanian Dinar |
KZT | Kazakhstani Tenge |
KES | Kenyan Shilling |
KWD | Kuwaiti Dinar |
KGS | Kyrgyzstani Som |
LAK | Lao Kip |
LVL | Latvian Lats |
LBP | Lebanese Pound |
LSL | Lesotho Loti |
LRD | Liberian Dollar |
LYD | Libyan Dinar |
LTL | Lithuanian Litas |
MOP | Macanese Pataca |
MKD | Macedonian Denar |
MGA | Malagasy Ariary |
MWK | Malawian Kwacha |
MYR | Malaysian Ringgit |
MVR | Maldivian Rufiyaa |
MRO | Mauritanian Ouguiya |
MUR | Mauritian Rupee |
MXN | Mexican Peso |
MDL | Moldovan Leu |
MNT | Mongolian Tögrög |
MAD | Moroccan Dirham |
MZN | Mozambican Metical |
MMK | Myanmar Kyat |
NAD | Namibian Dollar |
NPR | Nepalese Rupee |
ANG | Netherlands Antillean Gulden |
TWD | New Taiwan Dollar |
NZD | New Zealand Dollar |
NIO | Nicaraguan Córdoba |
NGN | Nigerian Naira |
NOK | Norwegian Krone |
OMR | Omani Rial |
PKR | Pakistani Rupee |
XPD | Palladium |
PAB | Panamanian Balboa |
PGK | Papua New Guinean Kina |
PYG | Paraguayan Guaraní |
PEN | Peruvian Sol |
PHP | Philippine Peso |
XPT | Platinum |
PLN | Polish Złoty |
QAR | Qatari Riyal |
RON | Romanian Leu |
RUB | Russian Ruble |
RWF | Rwandan Franc |
SHP | Saint Helenian Pound |
SVC | Salvadoran Colón |
WST | Samoan Tala |
STD | São Tomé and Príncipe Dobra |
SAR | Saudi Riyal |
RSD | Serbian Dinar |
SCR | Seychellois Rupee |
SLL | Sierra Leonean Leone |
XAG | Silver (Troy Ounce) |
SGD | Singapore Dollar |
SKK | Slovak Koruna |
SBD | Solomon Islands Dollar |
SOS | Somali Shilling |
ZAR | South African Rand |
KRW | South Korean Won |
LKR | Sri Lankan Rupee |
SDG | Sudanese Pound |
SRD | Surinamese Dollar |
SZL | Swazi Lilangeni |
SEK | Swedish Krona |
CHF | Swiss Franc |
TJS | Tajikistani Somoni |
TZS | Tanzanian Shilling |
THB | Thai Baht |
TOP | Tongan Paʻanga |
TTD | Trinidad and Tobago Dollar |
TND | Tunisian Dinar |
TRY | Turkish Lira |
TMT | Turkmenistani Manat |
TMM | Turkmenistani Manat |
UGX | Ugandan Shilling |
UAH | Ukrainian Hryvnia |
CLF | Unidad de Fomento |
AED | United Arab Emirates Dirham |
UYU | Uruguayan Peso |
USD | US Dollar |
UZS | Uzbekistan Som |
VUV | Vanuatu Vatu |
VEF | Venezuelan Bolívar |
VES | Venezuelan Bolívar Soberano |
VND | Vietnamese Đồng |
XOF | West African Cfa Franc |
YER | Yemeni Rial |
ZMK | Zambian Kwacha |
ZMW | Zambian Kwacha |
ZWD | Zimbabwean Dollar |