Zowie Ecommerce API

Business Context

Zowie Ecommerce Tracking API offers JS methods to track the following events:

  • Product page visited
  • Cart updated
  • Order purchased

Tracking Order Purchased

Call Zowie.trackPurchased(...) from Zowie SDK when a customer places an order (e.g., landed at the success page).

Zowie.trackPurchased(
  orderId,
  lineItems,
  totalAmount,
  currency
)

Please make sure that you provided values for all non-optional arguments with the below structure. Line items argument accepts a list of products from the placed order.

ParameterTypeDescription
orderIdstringThe ID of an order placed by a customer.
lineItems.productIdstringUnique ID of product or SKU.
lineItems.variantIdstringA specific product’s variant added to a cart. If you don’t support this, simply pass “default” as value.
subtotalAmountnumber (int no float point), optionalSum of the line item values provided without no decimal places. Eg. $3.84 should be encoded as 384. To avoid float point, use parseInt(...) from JS.
discountAmountnumber (int no float point), optionalDiscount value provided without no decimal places. Eg. $3.84 should be encoded as 384. To avoid float point, use parseInt(...) from JS.
taxAmountnumber (int no float point), optionalTax value provided without no decimal places. Eg. $3.84 should be encoded as 384. To avoid float point, use parseInt(...) from JS.
shippingCostAmountnumber (int no float point), optionalThe value of shipping costs provided without no decimal places. Eg. $3.84 should be encoded as 384. To avoid float point, use parseInt(...) from JS.
totalAmountnumber (int no float point)Total value of placed order provided without no decimal places. Eg. $3.84 should be encoded as 384. To avoid float point, use parseInt(...) from JS.
currencystring (3 characters, capitalized letters)Currency, provided in USD, EUR, GBP, etc. format
📘

How do I know if tracking works?

Place a test order and use Developer Tools to find API call to https://tr.chatbotize.com/webhook/purchased. Make sure that all parameters are properly passed in the request’s body.

Tracking Product Page Visited

Call Zowie.trackVisitedProduct(...) from Zowie SDK at each product page visited by your customers.

Zowie.trackVisitedProduct({
  productId: "",
  imageUrl: "",
  price: 0,
  currency: "",
  title: "",
  shopUrl: "",
  category: {
    id: "",
    name: ""
  }
});
ParameterTypeDescription
productIdstringUnique ID of product or SKU.
imageUrlstringURL to main image of product which is publicly accessible.
pricenumber (int no float point)Price of product provided without decimal places. Eg. $3.84 should be encoded as 384. To avoid float point, use parseInt(...) from JS.
currencystring (3 characters, capitalized letters)Currency, provided in USD, EUR, GBP, etc. format.
titlestringTitle/name of product.
shopUrlstringURL to product page, can be simply window.location.href of the current page.
category.idstringID of product’s category. If you don’t have an ID, please provide the category's name.
category.namestringName of product’s category.
📘

How do I know if tracking works?

Visit your ecommerce’s product page and use Developer Tools to find API call to https://tr.chatbotize.com/webhook/visited-product. Make sure that all parameters are properly passed in the request’s body.


Tracking Cart Updated

Call Zowie.trackCartUpdated(...) from Zowie SDK whenever a customer adds an item, removes an item, changes quantity, or clears out the cart.

Zowie.trackCartUpdated([{   
    productId: "",
    variantId: "",
    imageUrl: "",
    price: 0,
    currency: "",
    quantity: 0,
    title: "",
    shopUrl: ""
}])

Above method accepts a list of items within a cart with the following structure:

ParameterTypeDescription
productIdstringUnique ID of product or SKU.
variantIdstringA specific product’s variant added to a cart. If you don’t support this, simply pass “default” as value.
imageUrlstringURL to main image of product which is publicly accessible.
pricenumber (int, no float point)Price of product provided without no decimal places. Eg. $3.84 should be encoded as 384. To avoid float point, use parseInt(...) from JS.
currencystring (3 characters, capitalized letters)Currency, provided in USD, EUR, GBP, etc. format.
quantitynumber (int, no float point)Quantity of product in a cart provided without no decimal places. To avoid float point, use parseInt(...) from JS.
titlestringTitle/name of product.
shopUrlstringURL to a product page.
📘

How do I know if tracking works?

Update a cart by adding/removing products and use Developer Tools to find API call to https://tr.chatbotize.com/webhook/cart-updated. Make sure that all parameters are properly passed in the request’s body.


Pushing Events to Google Analytics

Extend Zowie.init({...}) with the following configuration:

Zowie.init({
...

    onEcommercePurchased: function(total, currency) {
       gtag('event', 'zowie_purchased' , { 'total': total, 'currency': currency });
    },          
    onEcommerceProactiveChatSeen: function() {
       gtag('event', 'zowie_proactive_chat_seen');
    },
    onEcommerceProactiveChatClicked: function() {
       gtag('event', 'zowie_proactive_chat_clicked');
    },
    onEcommerceProductVisited: function() {
       gtag('event', 'zowie_proactive_product_visited');
    },
    onEcommerceConversationStarted: function() {
       gtag('event', 'zowie_conversation_started');
    }         

...
})