1. V3 Knowledge Base
  2. Products and Features

Tracking visitor carts, conversions & past orders

This feature requires basic knowledge of Javascript in order to complete.

Shopify Customers: Please use this article to set up this feature instead. If you installed JustUno via app install do not add the codes below.

BigCommerce Customers: Please use this article to set up this feature instead. If you installed JustUno via app install do not add the codes below.

 

Tracking visitor shopping cart items and totals

If your visitor stays on the page when they add an item to the cart (ajax cart) you should call the following javascript when that user adds the item. This option enables us to know right when an item is added to the cart vs waiting for them to visit your cart page.

<script>
window.juapp=window.juapp||function(){(window.juapp.q=window.juapp.q||[]).push(arguments)}
/*
Replace the [item ...] portions below with the actual item information being added to cart. You can omit any of the attributes that you don't have values other then the item id and quantity.
*/
juapp(
'cartItemAdd',
{
productid:'[item id]',
variationid:'[item variation id]',
sku:'[item sku]',
name:'[item name]',
quantity:[item quantity],
price:[item price],
color:'[item color]',
size:'[item size]'
}
);
</script>

 

When your visitor lands on your cart page or when the mini cart is shown, it's best to call the following javascript. This will ensure that their cart contents are up to date on our end.

<script>
window.juapp=window.juapp||function(){(window.juapp.q=window.juapp.q||[]).push(arguments)}
/*
Below you can update your cart with an array of items. This function will essentially replace the current Justuno tracked cart items with the array you provide.
Replace the [item ...] portions below with the actual item information being added to cart. You can omit any of the attributes that you don't have values other then the item id and quantity.
*/
juapp(
'cartItems',
[
{ productid: '[item 1 id]', variationid: '[item 1 variation id]', sku:'[item 1 sku]', quantity: [item 1 quantity], price: [item 1 price], name: '[item 1 name]', color: '[item 1 color]', size: '[item 1 size]' },
{ productid: '[item 2 id]', variationid: '[item 2 variation id]', sku:'[item 2 sku]', quantity: [item 2 quantity], price: [item 2 price], name: '[item 2 name]', color: '[item 2 color]', size: '[item 2 size]' }
]
);
/*
Below you can update your cart totals to reflect any discounts or other totals that are added. This is optional and is usually only necessary to track cart discounts applied.
Replace the [cart ...] portions below with the actual item information being added to cart. You can omit any of the attributes that you don't have values other then the item id and quantity.
*/
juapp(
'cart',
{
total:[cart total],
subtotal:[cart subtotal],
tax:[cart tax],
shipping:[cart shipping],
currency:'USD'
}
);
</script>

 

Conversion tracking & past order tracking

You will want to call the following code when a user successfully completes their order and visits the final conversion page (typically your thank you page).

<script> 
window.juapp=window.juapp||function(){(window.juapp.q=window.juapp.q||[]).push(arguments)}
/*
Replace the [order ...] portions below with the actual order information. You can omit any of the attributes that you don't have values other then the order id and order total.
*/
juapp(
'order',
'[order id]',
{
total:[order total],
subtotal:[order subtotal],
tax:[order tax],
shipping:[order shipping],
currency:'USD'
});
/*
Replace the [item ...] portions below with the actual item information in order.
You can omit any of the attributes that you don't have values other then the item id and quantity.
*/
/* You will need to repeat this line of code for each item in the order. */
juapp(
'orderItem',
{
productid:'[item id]',
variationid:'[item variation id]',
sku:'[item sku]',
name:'[item name]',
quantity:[item quantity],
price:[item price],
color:'[item color]',
size:'[item size]'
});
/* end of repeat section */
</script>

 

Visit Justuno @ justuno.com