cart command passes the products your visitors have added to their cart to Emarsys. It has to be called on every page of your web store, and should pass the item ID, the quantity and price of each product found in the cart.
Emarys uses the data collected with this command for behavior analysis and personalization. You will also be able to use it to trigger events or personalize content in certain Emarsys products, such as the Automation Center, Smart Insight and Predict.
What happens with this data?
Within a few hours, the data reported by the
cart command is written to the following behavior fields in your contact database:
predict last abandoned products – This field is updated with a pipe-separated list of the items passed by the last
item1 | item2…). A maximum of 10 items are stored in the field.
- predict last abandoned categories – This field is updated with a pipe-separated list of the product categories the items left in the cart belonged to. A maximum of 10 categories are stored in the field.
- predict last abandoned total price – This field is updated with the total amount of the items left in the cart.
Where should this command go in my web store?
Cart contents have to be reported to Emarsys on each and every page of your web store, even if the cart is empty.
Who do I need to involve from my side?
cart command is implemented on the store frontend, for which you will need a frontend developer. It is a single script, taking an array of three parameters:
How can I monitor if it works properly?
The Data Sources page is your starting point for troubleshooting any integration issues and monitoring your Web Extend implementation.
In the Web Behavior box warnings and error messages will be displayed if we detect issues.
In the Product Matching box on the right, you will see warnings and error messages if the product IDs passed by the
cart command are not consistent with the IDs found in your product database.
testMode command to prevent test data from being written to your real contact database as this may skew your reporting.
- Call the command on every page.
- Issue the command only once on every page.
- Empty the cart once the purchase is completed.
- Make a decision about whether you want to report net or gross prices, and use either of them consistently whenever you pass prices with the Web Extend commands.
- If you have a dedicated m.domain.com mobile page and a mobile app, do not forget to add the command to these as well. For mobile apps, use our SDK.
Check if it works
To see if the
cart commands work properly on your website, do the following:
- In your browser, open a page in your web store.
- Open another tab in your browser, log in to your Emarsys account, go to Admin > Data Sources > Web Behavior and click Live Events in the upper right-hand corner. This will open the Live Events page.
- Select my visit in the second drop-down.
- You should see an event containing, among other things, an empty cart box.
- Now go back to your store and add some items to your cart.
- Then go back the Live Events page and click Refresh.
- You should see an event containing, among other things, a cart box with the selected items, their quantities and prices listed in it.
On the Live Events page, you will see product images in the cart boxes if the products reported by the
cart command are found in your product database. If no product image is shown, either a wrong ID was passed, or your uploaded product data is not up to date.
If the command is implemented correctly,:
- You should see an empty cart box for all your interactions as long as you do not add any products to the cart.
- The items shown in your cart should match those you have added to it on your website.
You can also install our Inspector bookmarklet that allows you to monitor live the Web Extend commands called on your website. If you implemented the
cart command correctly, it should appear in the Inspector overlay on all the pages of your web store, either with or without any contents.
If everything works as expected, deploy the code to your live environment.
Always remember to remove the
testMode command from your code first!
In this section, you can read about the tools you can use and the things you can do to check if the
cart command is doing its job properly on your website.
- Check if Live Validator has any warnings or error messages related to the
- If it does, fix the issues or contact Emarsys support if you need help.
Check contact DB field updates
Another way to validate cart-related data collection is to directly segment your contact database for a relevant behavior field, for example predict last abandoned products
is not empty. This segment should include all known contacts who have abandoned their cart.
Select a few random contacts, and review the contents of the two other predict last abandoned... behavior fields as well.