How to target cart information and past orders

PRE-REQUISITES: Some Javascript Knowledge 

 

SHOPIFY CUSTOMERS: Please use this article to set up this feature instead

We have relatively easy to use targeting conditions for cart and orders in our advanced targeting rules under the "Cart and Past Order Rules" tab. To set these up you will need some javascript knowledge to add the following javascript code snippet so that it fires whenever your user adds an item to the cart. Once you have added the correct values for your website, please add the code right below the Justuno embed code! 

<script>
   window.juapp=window.juapp||function(){(window.juapp.q=window.juapp.q||[]).push(arguments)}

   /* 
   replace the [...] 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]',{name:'[item name]',quantity:[item quantity],price:[item price],color:'[item color]',size:'[item size]'}); 

   /* 
   While not required, the following code will make this more accurate by communicating to justuno when a user removes an item from their cart.  Uncomment and replace the [item id] if the next line to use and only fire this code when your user removes the item from their cart.
   */

   juapp('cartItemRemove','[item id]');
</script>

In order to target users based on past orders, you will first need to add the following javascript code snippet so that it fires whenever a purchase has been successfully completed (thank you page).

<script> 
   window.juapp=window.juapp||function(){(window.juapp.q=window.juapp.q||[]).push(arguments)}

   /* 
   replace the [...] portions below with the actual order information about order. 
   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]});

   /* 
   replace the [...] 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]',{name:'[item name]',quantity:[item quantity],price:[item price],color:'[item color]',size:'[item size]'}); 
</script>
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.