How to set up cart tracking
It’s important that helloretail is correctly installed on your website before you try to set up abandoned cart notifications.
This means you have
- Supplied us with your product data by giving us the URL to your product feed or adding the helloretail product span. Click here for a guide on how to do this.
- Supplied us with conversion data by adding the helloretail conversion span. Click here for a guide on how to do this.
Allow helloretail to track cart contents
First, you have to allow helloretail to track cart contents. This information is needed to send out personalized abandoned cart email notifications, as of Triggered emails, featuring the image, title, and price of the product the customer has left behind.
How can I do this?
You can do this by adding a span into the HTML of your cart page. A span is a small piece of code that will allow helloretail to collect data about the contents of the cart every time a user views the cart page. Spans should always be in the body of your HTML (in between <body> and</body>).This will allow the helloretail script to read the contents of the cart every time the cart page is viewed by a user.
This is how the span looks, using product URLs as a reference to the products in cart:
<span class="addwish-cart" style="display:none" data-url="http://example.com/cart/id/789" data-total="150.50" data-email="email@example.com"> <span class="addwish-product" data-url="http://example.com/product/456.html"> </span> <span class="addwish-product" data-url="http://example.com/product/2234.html"> </span> </span>
This is how the span looks, using product numbers as a reference to the products in cart:
<span class="addwish-cart" style="display:none" data-url="http://example.com/cart/id/789" data-total="150.50" data-email="firstname.lastname@example.org"> <span class="addwish-product" data-productnumber="p-456-2"> </span> <span class="addwish-product" data-productnumber="p-2234"> </span> </span>
The first and last span tags are called the root span. The other spans on the inside are called the inner spans (or product spans).
- The data-URL attribute in the first line of the span (root span) is optional. If you have a URL which will lead directly back to the cart you can include it here. This will allow you to link directly back to the abandoned cart in your notifications.
- The data-total attribute in the root span is required. This should contain the total value of the visitor's cart. Please note: The total cart value amount should be formatted with a. (dot) as decimal separator.
- The data-email attribute in the root span is optional. This is used to associate an already known email with the cart, this could be if the user is already logged in - then you can associate the user's email address with the current cart.
- Inside the root, a span is a number of product spans. There should be one of these for every product in the cart. If the cart is empty there are no product spans. helloretail can see that the cart is empty because the root span will still be there.
- In each product span, you can choose to reference products in cart either by URL or product number. If referencing the product URL, the data-URL attribute must contain the canonical URL for the product. If referencing the product number the data-product number should be the product number.