Search…
⌃K

E-Commerce Support

How to set up e-commerce view item, add to cart, and purchase interactions via the SDK.
In order to enable Abandoned Cart notifications we must receive information about the specific items a subscriber has viewed, added to cart, and purchased. The following guide explains how to add these user interactions via the JavaScript SDK.
The following steps assume that you are providing an item catalog/feed to our team.
If you will not be providing a product catalog item information can be provided via the inline JavaScript events. Please contact your account manager for more information on this process.

E-Commerce Interactions

There are several interactions you may provide to us to enable functionality like: Abandoned Cart Campaigns, Revenue Attribution, and Product Recommendation Campaigns:
  • Add To Cart: Fire this interaction whenever a user adds an item to their shopping cart.
  • Purchase Event: Fire this interaction after a visitor successfully completes their cart purchase.
  • Update Cart Event: Fire this interaction after a visitor makes a change to their cart.
All of the following code snippets must be ran after the SDK has been initialized.

Add To Cart

Use this interaction to inform us whenever a visitor adds an item to their shopping cart.
Products
Events
pushly('add_to_cart', {
"products": [
{
"id": "PRODUCT_ID",
"quantity": 1
}
]
});
pushly('add_to_cart', {
"events": [
{
"id": "EVENT_ID",
"quantity": 1
}
]
});
You may call add_to_cart as many times as necessary to keep track of all items in a visitor's cart. Abandoned Cart notifications may be sent for any item in a customer's cart that has not been purchased.
After a purchase is made the visitor's cart will be emptied and no notifications for a purchased item will be sent to the visitor.

Purchase

Use this interaction to inform us when a visitor successfully complete's their cart purchase. Providing this interaction will ensure that visitors do not receive notifications for items they have previously purchased. This interaction will also enable revenue attribution.
It is not required to provide the list of purchased items within the purchase payload but can be provided if add to cart interactions are not implemented or to ensure cart contents are up-to-date. The price_value and purchase_id properties are also not required but it is recommended that they are provided.
Products
Events
pushly('purchase', {
"products": [
{
"id": "PRODUCT_ID",
"quantity": 1
}
],
"price_value": "344.33",
"purchase_id": "ABC123"
});
pushly('purchase', {
"events": [
{
"id": "EVENT_ID",
"quantity": 1
}
],
"price_value": "344.33"
});

Update Cart

This interaction can be used to change the properties on a cart item or remove an item from the visitor's cart.
To remove an item from the cart call the update_cart method with the full current cart information (omitting the removed item):
Products
Events
pushly('update_cart', {
"products": [
{
"id": "PRODUCT_ID",
"quantity": 3
}
]
});
pushly('update_cart', {
"events": [
{
"id": "EVENT_ID",
"quantity": 3
}
]
});
Or if the cart has been completely emptied provide an empty array:
Products
Events
pushly('update_cart', {
"products": []
});
pushly('update_cart', {
"events": []
});

FAQ

What fields are required?

If you are providing a separate catalog the only required field is the item id.

Do you support server-to-server events instead of providing add to cart and purchase details via the SDK?

Yes, contact your account manager for more information on providing e-commerce events via server-side calls.