Follow

Cart

In the cart page you need to generate a code that sends to BrainSINS the cart contents, including the product ids and the quantity for each product:

<!-- BrainSINS Code Starts -->
<script type="text/javascript">    
var BrainSINSData = {       
pageType:"cart",       
cart: [
{id: ID, quantity: QUANTITY},
{id: ID, quantity: QUANTITY},
{id: ID, quantity: QUANTITY}
]
};
</script> <!-- BrainSINS Code Ends -->

In the cart section you have to include all the products that the user has added to his cart, including the ID or unique identifier of the product, and QUANTITY or the quantity that the user has added of that given product to his cart.

For instance, if your client has included 2 times the item 123 and 1 time the item 456, the code you’d generate should be the following one:

<!-- BrainSINS Code Starts -->
<script type="text/javascript">   
var BrainSINSData = {       
pageType:"cart",       
cart:[
{id: 123, quantity: 2},
{id: 456, quantity: 1}
]
};
</script>
<!-- BrainSINS Code Ends -->

If your cart page is the same one that the page where checkout starts, pageType should be "cart". In this situation, you should avoid the tracking checkout manual.

It is also possible to add the price of the products to the BrainSINSData object. This is useful, for example, when we have parents and children products but it is advisable to always put it in order to favor better product tracking. This price should be in float format, that is, with dot "." to separate the decimals as in the following example:

 

<!-- BrainSINS Code Starts -->
<script type="text/javascript">   
var BrainSINSData {       
pageType:"cart",       
cart: [
{id: 123, quantity: 2, price: 19.95},
{id: 456, quantity: 1, price: 7.5}
]
};
</script>
<!-- BrainSINS Code Ends -->

 

MISC
In case we need to recover some extra data we can use the misc field. This will be an array within the misc field as follows:

<!-- BrainSINS Code Starts -->
<script type="text/javascript">   
var BrainSINSData {       
pageType:"cart",       
cart: [
{id: 123, quantity: 2, price: 19.95},
{id: 456, quantity: 1, price: 7.5},
misc: [
{name: "product", discount: "20%"},
{name: "product2", discount: "35%"}
]
]
};
</script>
<!-- BrainSINS Code Ends -->

 



If your online store is able to modify the cart products via AJAX, we have the following functions that can be useful:


Add products to cart:

brainsins.addItem( ID_PRODUCT, QUANTITY, PRICE );


Update the quantity of a product in cart:

brainsins.updateItem( ID_PRODUCT, QUANTITY )


Delete a product in cart:

brainsins.deleteItem( ID_PRODUCT );


< Previous | Next >

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk