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

 

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',
      '[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',
'',
[
{ itemid: '[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]' },
{ itemid: '[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', '[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>
Have more questions? Submit a request

2 Comments

  • 0
    Avatar
    Alex Pearson

    Hi I'm using Squarespace, and can't get the Cart Information to pass to Just Uno in my testing. www.familytreedesign.net

  • 0
    Avatar
    Yuno

    Hey Alex!

    Thanks for reaching out. Since this section is tied to custom site information, it would require use to review and supply custom code. Not something we do unless tied to a managed account.

    Happy to review what you have to point you down the best direction. I've sent out an email to request the snippet of code you are using and where you are placing this.

    I look forward to your response. 

    Thanks,

    Yuno

Please sign in to leave a comment.