E-Commerce Support

How to set up e-commerce view item, add to cart, and purchase events via the SDK.

In order to enable Abandoned Cart notifications Pushly must receive information about the specific items or products a subscriber has viewed, added to cart, and purchased. The following guide explains how to add these events via the JavaScript SDK.

The following steps assume that you are not providing a product catalog to our team and all item information will be sent via the JavaScript SDK.

If you will be providing a product catalog the JavaScript events still must be implemented but only the Item ID needs to be provided.

Item Definitions

All e-commerce events that are sent via the SDK accept one or more Products/Items as part of their payload. Pushly supports a flat custom item definition or you may provide your items in JSON+LD Structured Data format.

Pushly Flat Structure

The following properties can be specified as a flat object

Property

Description

id

Unique ID for item. Use the SKU if available.

Max character limit: 100.

name

A specific, relevant name for the item. Include as much detail as possible to ensure the item is specifically described for the user in future notifications. For example: White KitchenAid Mixer

Max character limit: 150

url

URL of the specific product page where visitors can buy the item.

description

A short, relevant description of the item. Include specific or unique product features, such as material or color. Use plain text.

Max character limit: 500

brand_name

Brand name, unique manufacturer part number (MPN), or Global Trade Item Number (GTIN) of the item.

Max character limit: 500

image

URL for the main image of your item. For push notifications, the optimal image specs are:

  • Must be in PNG or JPG format

  • Minimum image resolution is 360 x 180 px. We recommend 720 x 360 px for best quality.

  • Aspect ratio: 2:1

price_currency

Currency for the price in ISO format. For example: USD

price

Current price of the item. To indicate a decimal point use . rather than ,. Don't include symbols, such as $ in the price. For example: 123.45

This value may be provided as a string or integer.

quantity

Set to the number of duplicate items added to cart if more than 1.

This value may be provided as a string or integer.

For example:

{
"id": "FQA52LL",
"name": "iPhone X 64GB - Space Gray",
"url": "https://example.com/iphone",
"description": "The iPhone is a smartphone made by Apple that combines a computer, iPod, digital camera and cellular phone into one device with a touchscreen interface.",
"brand_name": "Apple",
"image": "https://www.example.com/iphone.png",
"price_currency": "USD",
"price": "599.00"
}

You may provide as little or as much item information as you want but id is always required.

Keep in mind that abandoned cart notifications will be created using the provided data and as such the provided text should be as user-friendly as possible.

JSON+LD Structured Data

You may also send your item details using the JSON+LD Structured Data Format. This format is accepted to provide ease of integration for merchants who have implemented product integration with Google, Facebook, Shopify, and other common online store providers.

{
"@context": "https://schema.org/",
"@type": "Product",
"name": "Executive Anvil",
"image": [
"https://example.com/photos/1x1/photo.jpg",
"https://example.com/photos/4x4/photo.jpg"
],
"description": "Sleeker than ACME's Classic Anvil, the Executive Anvil is perfect for the business traveler looking for something to drop from a height.",
"sku": "0446310786",
"brand": {
"@type": "Brand",
"name": "ACME"
},
"offers": {
"@type": "Offer",
"url": "https://example.com/anvil",
"priceCurrency": "USD",
"price": "119.99"
}
}

Ensure your provided JSON+LD Structured Data includes all item properties you wish to use in abandoned cart notifications.

For additional information visit Schema.org's Product Page.

E-Commerce Events

There are several events you may provide to Pushly to enable functionality like: Abandoned Cart Campaigns, Revenue Attribution, and Product Recommendation Campaigns:

  • Add To Cart: Fire this event whenever a user adds an item to their shopping cart.

  • Purchase Event: Fire this event after a visitor successfully completes their cart purchase.

  • Update Cart Item Event: Fire this event after a visitor makes a change to their cart.

Add To Cart

Use this event to inform Pushly whenever a visitor adds an item to their shopping cart.

pushly('add_to_cart', {
"items": [
{
"@context": "https://schema.org/",
"@type": "Product",
"name": "Executive Anvil",
"image": [
"https://example.com/photos/1x1/photo.jpg",
"https://example.com/photos/4x4/photo.jpg"
],
"description": "Sleeker than ACME's Classic Anvil, the Executive Anvil is perfect for the business traveler looking for something to drop from a height.",
"sku": "0446310786",
"brand": {
"@type": "Brand",
"name": "ACME"
},
"offers": {
"@type": "Offer",
"url": "https://example.com/anvil",
"priceCurrency": "USD",
"price": "119.99"
}
}
]
});

The above example uses the JSON+LD Structured Data in the items array. Alternatively, the Pushly Flat Structure could be used.

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 Event

Use this event to inform Pushly when a visitor successfully complete's their cart purchase. Providing this event will ensure that visitors do not receive notifications for items they have previously purchased. This event will also enable revenue attribution.

It is not required to provide the list of purchased items within the purchase event but can be provided if add to cart events are not implemented or to ensure cart contents are up-to-date.

pushly('purchase', {
"items": [
{
"id": "FQA52LL",
"name": "iPhone X 64GB - Space Gray",
"url": "https://example.com/iphone",
"description": "The iPhone is a smartphone made by Apple that combines a computer, iPod, digital camera and cellular phone into one device with a touchscreen interface.",
"brand_name": "Apple",
"image": "https://www.example.com/iphone.png",
"price_currency": "USD",
"price": "599.00"
}
],
"price_currency": "USD",
"price_value": "344.33" // the total price of the cart
});

The above example uses the JSON+LD Structured Data in the items array. Alternatively, the Pushly Flat Structure could be used.

If the top-level price_currency or price_value are not included they will be derived from the list of items, if provided.

Update Cart Item Event

This event can be used to change the properties on a cart item or remove an item from the visitor's cart.

Updating an existing item:

pushly('update_cart_item', {
"items": [
{
"id": "FQA52LL",
"price": "499.99"
}
]
});

Removing an item from the cart:

pushly('update_cart_item', {
"items": [
{
"id": "FQA52LL",
"quantity": "0"
}
]
});

FAQ

Can item details be provided via a feed or other non-SDK source?

Yes, contact your account manager for information on providing item information from sources other than the SDK.

What fields are required?

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

If you are not providing a separate product catalog the following fields are required:

  • id

  • name

  • url

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.