Notifications¶
The following notification types are supported in the eSales Enterprise Web API and can easily be sent with the JavaScript library. The examples have instantiated the api
object as a variable:
var api = window.esalesAPI({ market: '{market}', clusterId:'{cluster-id}' });
See also the Notification set-up recommendations and Working with Notifications.
Click notification¶
The click notification is sent with a ticket when the visitor clicks on a product, an ad or in some special cases on a category.
api.notify.click("{ticket}");
Non-eSales click notification¶
The non-eSales click notification is sent when a visitor has clicked a product that is not returned by eSales (i.e. not having a ticket). Instead of a ticket, a product key (and if applicable, a variant key) is sent.
// send with productKey
api.notify.nonEsalesClick({ productKey: '{product_key_1}' });
// send with variantKey
api.notify.nonEsalesClick({ variantKey: '{variant_key_1}'});
// send with both variantKey and productKey
api.notify.nonEsalesClick({ productKey: '{product_key_2}', variantKey: '{variant_key_1}' });
Adding-to-cart notification¶
The adding-to-cart notification is sent with a ticket when a visitor adds an eSales product to their cart.
api.notify.addToCart('{ticket}');
Non-eSales adding-to-cart notification¶
The non-eSales adding-to-cart notification is sent when a visitor adds a product not returned by eSales (i.e. not having a ticket) to their cart. Instead of a ticket, a product key (and if applicable, a variant key) is sent.
// send with productKey
api.notify.nonEsalesAddToCart({ productKey: '{product_key_1}'});
// send with variantKey
api.notify.nonEsalesAddToCart({ variantKey: '{variant_key_1}'});
// send with both variantKey and productKey
api.notify.nonEsalesAddToCart({ productKey: '{product_key_2}', variantKey: '{variant_key_1}' });
Add favourite notification¶
The add favourite notification is to be sent when a visitor have marked a product or a variant as a favourite.
// send with both productKey and variantKey and adds as favourite
api.notify.addFavorite({ productKey: '{product_key_1}', variantKey: '{variant_key_1}' });
// sends with variantKey and adds as favourite
api.notify.addFavorite({ variantKey: '{variant_key_1}' });
// sends with productKey and adds as favourite
api.notify.addFavorite({ productKey: '{product_key_2}' });
Remove favourite notification¶
The remove favourite notification is to be sent when a visitor have unmarked a product or a variant as a favourite.
// send with both productKey and variantKey and removes as favourite
api.notify.removeFavorite({ productKey: '{product_key_1}', variantKey: '{variant_key_1}' });
// sends with variantKey and removes as favourite
api.notify.removeFavorite({ variantKey: '{variant_key_1}' });
// sends with productKey and removes as favourite
api.notify.removeFavorite({ productKey: '{product_key_2}' });
Payment notification¶
Multiple payment notification methods
All payment notifications are recommended to be made as server side operations by using Secure Payment Notification.
Client side payments must be enabled
Client side payments are disabled by default. Contact Apptus Support if there is a need to make payment notifications as client side operations.
The payment notification is sent when the visitor has placed an order and completed payment.
var payment = api.notify.payment();
payment.add({
productKey: '{product_key_1}',
quantity: 2,
unitSellingPrice: 99.90
});
payment.add({
productKey:'{product_key_2}',
variantKey:'{variant_key_1}',
quantity: 1,
unitSellingPrice: 150.00
});
payment.add({
variantKey:'{variant_key_2}',
quantity: 5,
unitSellingPrice: 165
});
payment.send();
End session notification¶
The end session notification is to be sent when the visitor session ends according to the level of personalisation. Visitors may experience strange or irrelevant recommendations if the session-handling is not supporting the selected level of personalisation.
api.notify.end();