E-commerce data tracking via Web API

Track user events and properties from the backend of your website

The following events will be interesting for e-commerce: item viewed, item is added to the cart, order made, etc.

Here are examples of code snippets which will send required data from selected pages to Dashly.

Lead properties are displayed on the left in lead card. 

Lead events are displayed in chronological order.

Events and properties of items viewed

This code should run when a visitor is viewing an item:

dashly.track('$product_viewed, {
    "$name": selector_name,
    "$url": selector_url,
    "$amount": selector_amount,
    "$img": selector_img,
});
dashly.identify([
    {op: "union", key: "$viewed_products", value: selector_name}
]);

 

enter the name of an item instead of selector_name;

link to the item instead of selector_url;

order total instead of selector_amount;

link to item image instead of selector_img.

Events and properties of adding an item to a cart

This code should run when one is adding an item to a cart:

dashly.track('$cart_added', {
    "$name": selector_name,
    "$url": selector_url,
    "$amount": selector_amount,
    "$img": selector_img,
});
dashly.identify([ 
    {op: "add", key: "$cart_amount", value: selector_amount},
    {op: "union", key: "$cart_items", value: selector_name}
]);

 

enter the name of an item instead of selector_name;

link to the item instead of selector_url;

order total instead of selector_amount;

link to item image instead of selector_img.

Events and properties of order payment

Events and properties of order payment

If you have online payment option, then this code should run when one is entering the payment confirmation page:

dashly.track("$order_paid", {
    "$order_id": order_id
});
dashly.identify([
    {op: "add", key: "$profit", value: order_amount},
]);

replace order_id with your system order id;

order total instead of order_amount.

Events and properties of the checkout process

The following code should run when one is entering checkout page:

dashly.track("$order_started"); 

When one enters a payment confirmation page this code should run:

dashly.track("$order_completed", {
    "$order_id": order_id, 
    "$order_id_human": order_id_human, 
    "$order_amount": order_amount
}); 
dashly.identify([ 
    {op: "add", key: "$orders_count", value: 1}, 
    {op: "add", key: "$revenue", value: order_amount},
    {op: "update_or_create", key: "$last_payment", value: order_amount} 
]);

enter order amount instead of order_amount;

enter your system order id instead of order_id.

enter id which one sees while making a purchase instead of order_id_human (not required).

Powered by Dashly