Method Calls

addCartRows

addcartrows method // addcartrows method window\ monetateq push(\[ "addcartrows", \[{ "productid" "pidstring", "quantity" "quantitystring", "unitprice" "pricestring", "sku" "pidstring", "currency" "currencystring" }] ]); the addcartrows method is used to add products a customer has added to their cart to unlock full targeting functionality for your cart, include the addcartrows method to all pages and not just your cart page each row is an object with properties specific to the product added to the cart some object properties are required, and others are optional a product id can have a maximum of 50 characters any product id that exceeds this length is truncated after 50 characters if items are in the cart and a visitor adds a new one, the addcartrows method overwrites any existing cart details that your site passed to the monetate platform as a result, you should pass all products currently in the cart in each addcartrows method call the cart state is persistent throughout the monetate session therefore, the best practice is to call this method any time items are added or removed from the cart required and optional properties these object properties are required productid quantity unitprice these object properties are optional sku currency if your site doesn't use us dollars (usd) for purchases, then you must include currency information in this method don't send empty strings for optional property values only send properties that have a value monetate inspector view this screenshot shows the required properties—product id, quantity, and unit price—as they appear in the monetate inspector browser plug in the components tab of monetate inspector, with cart in the page type row and with product ids, quantity, and unit price in two cart products rows this code example contains the method in use that results in the monetate inspector results shown in the previous screenshot addcartrows example // addcartrows example window\ monetateq = window\ monetateq || \[]; window\ monetateq push(\[ "addcartrows", \[ { "productid" "21296", "quantity" "1", "unitprice" "69 99", "currency" "eur" }, { "productid" "127115", "quantity" "1", "unitprice" "34 99", "currency" "eur" }] ]); window\ monetateq push(\[ "trackdata" ]); reporting empty carts you can indicate an empty cart by calling addcartrows once with an empty array, as shown in this code example empty cart example // addcartrows empty cart example window\ monetateq = window\ monetateq || \[]; window\ monetateq push(\["addcartrows", \[]]); window\ monetateq push(\["trackdata"]);