If you have a different website than the above, you will need to add code that is detailed in this article below to use cart rules.
1. When should I use eCommerce cart segmentation?
When you want to display your message based on the contents of the cart. For instance, when you want to provide a special offer to visitors who have added some products to their cart and a different message to visitors who haven’t put anything into their cart yet.
2. Why should I use eCommerce cart segmentation?
Cart abandonment is one of the main challenges for eCommerce sites. Using eCommerce cart segmentation with OptiMonk helps you keep your visitors moving towards checkout and encourages visitors to add items to their cart by displaying specific messages to each group of visitors.
3. How do I set up my site for OptiMonk to retrieve the contents of a visitor’s cart?
4. What code do I need for OptiMonk to retrieve information on cart contents?
When someone adds a product to their cart on your site, a code such as the one below should be executed:
Important: OptiMonk.Visitor exists only if there is at least one active campaign on the domain.
In the above example, OptiMonk only retrieves some very basic data about cart contents.
OptiMonk can also retrieve more detailed information about particular products in a visitor’s cart. For more detailed information, a code such as this should be executed:
In the above example two products added to the cart are defined, their IDs are:
- "product1" and "product2"
and, there are 3 unique variables passed for both products
- quantity, i.e. – "3"
- price, i.e. – "1000"
- color, i.e. – "blue"
Important: The quantity and price of the product are required data, so they should always be set up.
5. What happens when a visitor removes an item from their cart?
You can also add code to your site so OptiMonk knows when a visitor removes an item from their cart. To retrieve information when someone removes an item from their cart, use code such as this:
Or you can empty the cart with a single call:
6. Details to pay attention to when you insert the code
- The name of your custom variables or products cannot include special characters
- Products and variables are case-sensitive
- The OptiMonkOnReady function should be defined only once, i.e. - only one time per page.
7. How do I set up my OptiMonk campaigns to use the cart contents?
- Login to your Optimonk account at https://app.optimonk.com/login/en
- Go to “Campaigns” on the left menu
- Select the campaign you want to use your customer variables
- On “Settings summary” click on “Edit settings” on the right
- Go to the “Select who should see the popup” page
- Click on “Add new condition”
- Scroll down to “Cart rules” and click on the plus sign
For more information on how to set up and how to use the cart rules, please check our article: Who to show - Cart rules
That's it! :) If you have any further questions or need any help, please contact us at email@example.com, we would be happy to assist you :)