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: {
products: [
{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: {
products: [
{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: {
products: [
{id: 123, quantity: 2, price: 19.95},
{id: 456, quantity: 1, price: 7.5}
]}
};
</script>
<!-- BrainSINS Code Ends -->

If your online store is able to add products via AJAX, in the button “Add to cart” in the product page, you should include the following function that will notify us that the product has been added to the cart:

<!-- BrainSINS Code Starts -->
brainsins.addItem( ID_PRODUCT, QUANTITY, PRICE );
<!-- BrainSINS Code Ends -->

 < Previous | Next >

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

Comments

Powered by Zendesk